From ce48bb49a44807d32a4f4fc9ec55121fd04426bf Mon Sep 17 00:00:00 2001 From: chen <1251790704@qq.com> Date: Mon, 7 Jun 2021 16:37:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=B1=E5=AF=86=E7=A0=81=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserInfoController.java | 27 ++++++++++--------- .../liuwanr/entity/vo/AccountLoginVO.java | 17 ++++++++++++ .../yipin/liuwanr/entity/vo/AdminLoginVO.java | 16 +++++++++++ .../liuwanr/service/UserInfoService.java | 10 ++----- 4 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/yipin/liuwanr/entity/vo/AccountLoginVO.java create mode 100644 src/main/java/com/yipin/liuwanr/entity/vo/AdminLoginVO.java diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java index 9568ee5..1c29d0b 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java @@ -1,6 +1,8 @@ package com.yipin.liuwanr.controller; import com.yipin.liuwanr.entity.*; +import com.yipin.liuwanr.entity.vo.AccountLoginVO; +import com.yipin.liuwanr.entity.vo.AdminLoginVO; import com.yipin.liuwanr.helper.RedisHelper; import com.yipin.liuwanr.service.*; import com.yipin.liuwanr.vo.UserInfoVO; @@ -11,7 +13,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.security.Permissions; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -304,10 +305,13 @@ public class UserInfoController { /** * 登陆查询学校/电子科大 */ - @GetMapping("/loginSchoolClient") - Response loginSchoolClient(@RequestParam("account") String account, @RequestParam("password") String password, @RequestParam("schoolId") Integer schoolId , - @RequestParam("source") Integer source, HttpServletRequest req, HttpServletResponse res) { + @PostMapping("/loginSchoolClient") + Response loginSchoolClient(@RequestBody AccountLoginVO accountLogin) { Response resp = new Response(); + String account = accountLogin.getAccount(); + String password = accountLogin.getPassword(); + Integer schoolId = accountLogin.getSchoolId(); + Integer source = accountLogin.getSource(); if (account == null || account=="") { resp.setStatus(300); resp.setErrmessage("用户账号为空,登录失败!"); @@ -331,17 +335,14 @@ public class UserInfoController { /** - * 服务端登陆 - * - * @param account source是0就是用户账号、1则是手机号或邮箱 - * @param password 密码 - * @param source 来源区分 + * 科大教师端登陆 */ - @GetMapping("/adminLogins") - Response adminLogins(@RequestParam("account") String account, @RequestParam("password") String password, - @RequestParam("source") Integer source, HttpServletRequest req, HttpServletResponse res) { + @PostMapping("/adminLogins") + public Response adminLogins(@RequestBody AdminLoginVO adminLogin) { Response resp = new Response(); - + String account = adminLogin.getAccount(); + String password = adminLogin.getPassword(); + Integer source = adminLogin.getSource(); HashMap map = new HashMap<>(); if (account == null) { resp.setStatus(300); diff --git a/src/main/java/com/yipin/liuwanr/entity/vo/AccountLoginVO.java b/src/main/java/com/yipin/liuwanr/entity/vo/AccountLoginVO.java new file mode 100644 index 0000000..cad0697 --- /dev/null +++ b/src/main/java/com/yipin/liuwanr/entity/vo/AccountLoginVO.java @@ -0,0 +1,17 @@ +package com.yipin.liuwanr.entity.vo; + +import lombok.Data; + +/** + * @Author chen + * @DATE 2021/6/7 16:20 + * @Version 1.0 + */ +@Data +public class AccountLoginVO { + + private String account; + private String password; + private Integer source; + private Integer schoolId; +} diff --git a/src/main/java/com/yipin/liuwanr/entity/vo/AdminLoginVO.java b/src/main/java/com/yipin/liuwanr/entity/vo/AdminLoginVO.java new file mode 100644 index 0000000..5a41fed --- /dev/null +++ b/src/main/java/com/yipin/liuwanr/entity/vo/AdminLoginVO.java @@ -0,0 +1,16 @@ +package com.yipin.liuwanr.entity.vo; + +import lombok.Data; + +/** + * @Author chen + * @DATE 2021/6/7 15:35 + * @Version 1.0 + */ +@Data +public class AdminLoginVO { + + private String account; + private String password; + private Integer source; +} diff --git a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java index 6ff0524..2baad86 100644 --- a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java +++ b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java @@ -508,7 +508,7 @@ public class UserInfoService { public HashMap adminLogins(String account,String password,Integer source){ HashMap resp = new HashMap(); UserInfo user = new UserInfo(); - user.setPassword(password); + user.setPassword(MD5.encrypt(password)); try { if (source == 0){ user.setAccount(account); @@ -526,12 +526,6 @@ public class UserInfoService { } user = userInfoMapper.adminLogins(user); - //区分密码大小写 - boolean num = false; - if (user != null){ - num = password.equals(user.getPassword()); - user.setPassword(null); - } if(user != null){ if (user.getRoleId().contains("1")){ user.setSchoolId(null); @@ -540,7 +534,7 @@ public class UserInfoService { user.setSchoolId(schoolId); } } - if (num == false || user == null){ + if (user == null){ resp.put("retvalue","账号密码有误,请稍后再试!"); resp.put("retcode", 300); }else{