Browse Source

修改用戶登出用被禁用問題

andy 1 year ago
parent
commit
54732594cc

+ 6 - 2
mainFactory/src/main/java/org/bfkj/application/AuthApplicationImpl.java

@@ -238,7 +238,7 @@ public class AuthApplicationImpl {
         if (applicationList == null || applicationList.isEmpty()) {
             return processFail("验证码错误或过期");
         }
-        Map<String, Object> userInfoResult = myDbHelper.queryByParamsReturnList("select user_id,token_valid_duration from t_user where user_name = ?  and user_pwd =?", username, password);
+        Map<String, Object> userInfoResult = myDbHelper.queryByParamsReturnList("select user_id,token_valid_duration,user_status from t_user where user_name = ?  and user_pwd =?", username, password);
         if (!userInfoResult.get("code").equals("0")) {
             return processFail("校验用户信息,执行异常");
         }
@@ -247,6 +247,10 @@ public class AuthApplicationImpl {
             return processFail("用户名或密码错误");
         }
         String userID = userInfoList.get(0).get("user_id").toString();
+        String userStatus = Optional.ofNullable(userInfoList.get(0).get("user_status")).map(Object::toString).orElse("-1");
+        if(Objects.equals(userStatus,"0")){
+            return processFail("用户已被禁用");
+        }
         String userToken = MapTools.getMD5Str(String.valueOf(new Date().getTime()));
         try {
             Object token_valid_duration = userInfoList.get(0).get("token_valid_duration");
@@ -292,7 +296,7 @@ public class AuthApplicationImpl {
         }
         try {
             String user_id = params.get("user_id");
-            myDbHelper.updateByCondition("update t_user set user_token = null,user_status = 0,LogoutTime = NOW() where user_id=?", null, user_id);
+            myDbHelper.updateByCondition("update t_user set user_token = null,LogoutTime = NOW() where user_id=?", null, user_id);
             return processSuccess("用户登出成功");
         } catch (Exception e) {
             return processFail("用户登出失败: ");

+ 5 - 4
mainFactory/src/main/java/org/bfkj/protocol/MyRabbitMQ.java

@@ -9,7 +9,6 @@ import org.bfkj.utils.MapTools;
 
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.TimeoutException;
@@ -28,9 +27,11 @@ public class MyRabbitMQ {
         }
 
         Map<String, Object>  connectConfigMaps = (Map<String, Object>) MapTools.strToObj(connectConfig);
+        Object arguments = connectConfigMaps.get("arguments");
+//        Object prefetchCount = connectConfigMaps.get("prefetchCount");
         try (Connection connection = createConnectFactory(connectConfigMaps).newConnection(); Channel currentChannel = connection.createChannel();) {
             //创建消息通道
-            currentChannel.queueDeclare(sourceObjectName, true, false, false, null);
+            currentChannel.queueDeclare(sourceObjectName, true, false, false, Objects.isNull(arguments)?null: ((Map<String,Object>) arguments));
             currentChannel.basicQos(1); //服务端在同一时刻只发送1条数据
             GetResponse getResponse = currentChannel.basicGet(sourceObjectName, true);
             String repBody = null;
@@ -65,11 +66,11 @@ public class MyRabbitMQ {
      *
      * @return 发送结果信息
      */
-    public Map<String,Object > sendMethod(String sourceObjectName, String routingKey, String data, String connectConfig, String exchangeName) {
+    public Map<String, Object> sendMethod(String sourceObjectName, String routingKey, String data, String connectConfig, String exchangeName) {
         if (Objects.isNull(sourceObjectName) || Objects.isNull(data)) {
             return MapTools.processFail(Objects.isNull(sourceObjectName) ? ("队列为空 " + data) : ("数据内容为空 " + data));
         }
-        Map<String, Object>  connectConfigMaps = (Map<String, Object>) MapTools.strToObj(connectConfig);
+        Map<String, Object> connectConfigMaps = (Map<String, Object>) MapTools.strToObj(connectConfig);
         ConnectionFactory connectFactory = createConnectFactory(connectConfigMaps);
         try (Connection connection = connectFactory.newConnection()) {
             try (Channel channel = connection.createChannel()) {