Parcourir la source

Merge branch 'master' into ftt

# Conflicts:
#	XiaoETech-admin/src/main/resources/application.yml
feng_ting-ting il y a 2 semaines
Parent
commit
8f93d3b16e

+ 12 - 7
XiaoETech-admin/pom.xml

@@ -24,6 +24,11 @@
             <optional>true</optional> <!-- 表示依赖不会传递 -->
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+        </dependency>
+
         <!-- swagger3-->
         <dependency>
             <groupId>io.springfox</groupId>
@@ -80,17 +85,17 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>   
-                <groupId>org.apache.maven.plugins</groupId>   
-                <artifactId>maven-war-plugin</artifactId>   
-                <version>3.1.0</version>   
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>3.1.0</version>
                 <configuration>
                     <failOnMissingWebXml>false</failOnMissingWebXml>
                     <warName>${project.artifactId}</warName>
-                </configuration>   
-           </plugin>   
+                </configuration>
+           </plugin>
         </plugins>
         <finalName>${project.artifactId}</finalName>
     </build>
 
-</project>
+</project>

+ 2 - 2
XiaoETech-admin/src/main/java/com/zhentao/web/controller/common/CaptchaController.java

@@ -22,7 +22,7 @@ import com.zhentao.system.service.ISysConfigService;
 
 /**
  * 验证码操作处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
@@ -36,7 +36,7 @@ public class CaptchaController
 
     @Autowired
     private RedisCache redisCache;
-    
+
     @Autowired
     private ISysConfigService configService;
     /**

+ 19 - 24
XiaoETech-admin/src/main/java/com/zhentao/web/controller/system/SysLoginController.java

@@ -1,47 +1,38 @@
 package com.zhentao.web.controller.system;
 
-import java.io.UnsupportedEncodingException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.spec.AlgorithmParameterSpec;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
 import com.zhentao.common.config.WxAppConfig;
-import com.zhentao.common.core.domain.model.WxLoginBody;
-import com.zhentao.common.utils.StringUtils;
-import com.zhentao.common.utils.sign.Base64;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.session.SessionInformation;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
 import com.zhentao.common.constant.Constants;
 import com.zhentao.common.core.domain.AjaxResult;
 import com.zhentao.common.core.domain.entity.SysMenu;
 import com.zhentao.common.core.domain.entity.SysUser;
 import com.zhentao.common.core.domain.model.LoginBody;
 import com.zhentao.common.core.domain.model.LoginUser;
+import com.zhentao.common.core.domain.model.WxLoginBody;
 import com.zhentao.common.utils.SecurityUtils;
+import com.zhentao.common.utils.StringUtils;
+import com.zhentao.common.utils.sign.Base64;
 import com.zhentao.framework.web.service.SysLoginService;
 import com.zhentao.framework.web.service.SysPermissionService;
 import com.zhentao.framework.web.service.TokenService;
 import com.zhentao.system.service.ISysMenuService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.client.RestTemplate;
 
-import javax.crypto.BadPaddingException;
 import javax.crypto.Cipher;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.NoSuchPaddingException;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
+import java.security.spec.AlgorithmParameterSpec;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
 
 /**
  * 登录验证
@@ -103,6 +94,7 @@ public class SysLoginController
             // 如果解析成功, 获取token
             String token = loginService.wxLogin(decryptResult);
             AjaxResult ajax = AjaxResult.success();
+            ajax.put(Constants.TOKEN, token);
             return ajax;
         }else{
             return AjaxResult.error("微信登录失败");
@@ -185,12 +177,15 @@ public class SysLoginController
     public AjaxResult getInfo()
     {
         LoginUser loginUser = SecurityUtils.getLoginUser();
+        if (loginUser == null) {
+            return AjaxResult.error("未获取到登录用户信息");
+        }
         SysUser user = loginUser.getUser();
         // 角色集合
         Set<String> roles = permissionService.getRolePermission(user);
         // 权限集合
         Set<String> permissions = permissionService.getMenuPermission(user);
-        if (!loginUser.getPermissions().equals(permissions))
+        if (loginUser.getPermissions() != null && !loginUser.getPermissions().equals(permissions))
         {
             loginUser.setPermissions(permissions);
             tokenService.refreshToken(loginUser);

+ 7 - 12
XiaoETech-admin/src/main/java/com/zhentao/web/controller/system/SysRegisterController.java

@@ -1,19 +1,18 @@
 package com.zhentao.web.controller.system;
 
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
 import com.zhentao.common.core.controller.BaseController;
 import com.zhentao.common.core.domain.AjaxResult;
 import com.zhentao.common.core.domain.model.RegisterBody;
-import com.zhentao.common.utils.StringUtils;
 import com.zhentao.framework.web.service.SysRegisterService;
 import com.zhentao.system.service.ISysConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 注册验证
- * 
+ *
  * @author ruoyi
  */
 @RestController
@@ -28,11 +27,7 @@ public class SysRegisterController extends BaseController
     @PostMapping("/register")
     public AjaxResult register(@RequestBody RegisterBody user)
     {
-        if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
-        {
-            return error("当前系统没有开启注册功能!");
-        }
-        String msg = registerService.register(user);
-        return StringUtils.isEmpty(msg) ? success() : error(msg);
+        registerService.register(user);
+        return AjaxResult.success("注册成功");
     }
 }

+ 5 - 4
XiaoETech-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -125,6 +125,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		where u.user_name = #{userName} and u.del_flag = '0'
 	</select>
 
+	<select id="selectWxUserByOpenId" parameterType="string" resultMap="SysUserResult">
+		<include refid="selectUserVo"/>
+		where u.open_id = #{openId} and u.del_flag = '0'
+	</select>
+
 	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
 		<include refid="selectUserVo"/>
 		where u.user_id = #{userId}
@@ -141,10 +146,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
 		select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
 	</select>
-    <select id="selectWxUserByOpenId" parameterType="string" resultMap="SysUserResult">
-		<include refid="selectUserVo"/>
-		where u.open_id = #{openId} and u.del_flag = '0'
-	</select>
 
     <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
  		insert into sys_user(