浏览代码

fixed login

zero 1 年之前
父节点
当前提交
a6e21e9281

+ 4 - 2
src/main/java/com/example/xiaoshiweixinback/XiaoshiWeixinbackApplication.java

@@ -3,13 +3,15 @@ package com.example.xiaoshiweixinback;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
 @SpringBootApplication
 public class XiaoshiWeixinbackApplication {
 
     public static void main(String[] args) {
-
-
         SpringApplication.run(XiaoshiWeixinbackApplication.class, args);
+        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "后台程序已启动,请运行前台");
     }
 
 }

+ 8 - 0
src/main/java/com/example/xiaoshiweixinback/controller/LoginController.java

@@ -6,6 +6,7 @@ import com.example.xiaoshiweixinback.business.common.base.Constants;
 import com.example.xiaoshiweixinback.entity.dto.person.*;
 import com.example.xiaoshiweixinback.entity.vo.person.LoginByWxVO;
 import com.example.xiaoshiweixinback.entity.vo.person.LoginVO;
+import com.example.xiaoshiweixinback.entity.vo.person.PersonVO;
 import com.example.xiaoshiweixinback.service.LoginService;
 import io.swagger.v3.oas.annotations.Operation;
 import jakarta.validation.Valid;
@@ -73,6 +74,13 @@ public class LoginController {
         return Response.success(map);
     }
 
+    @PostMapping("/selectPerson")
+    @Operation(summary = "查询个人信息")
+    public Response selectPerson(@RequestBody PersonIdDTO vo) throws Exception {
+        PersonVO personVO = loginService.selectPerson(vo);
+        return Response.success(personVO);
+    }
+
     @PostMapping("/editPerson")
     @Operation(summary = "修改个人信息")
     public Response editPerson(@RequestBody EditPersonDTO vo) throws Exception {

+ 24 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vo/person/PersonVO.java

@@ -0,0 +1,24 @@
+package com.example.xiaoshiweixinback.entity.vo.person;
+
+import lombok.Data;
+
+
+@Data
+public class PersonVO {
+
+    private Integer id;
+
+    private String name;
+
+    private String fileGuid;
+
+    private String phoneNum;
+
+    private String email;
+
+    private String userName;
+
+    private String uuid;
+
+    private String openId;
+}

+ 10 - 4
src/main/java/com/example/xiaoshiweixinback/service/LoginService.java

@@ -5,11 +5,8 @@ import cn.hutool.captcha.CaptchaUtil;
 import cn.hutool.captcha.CircleCaptcha;
 import cn.hutool.core.img.ImgUtil;
 import cn.hutool.core.util.IdUtil;
-import cn.hutool.crypto.SecureUtil;
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.example.xiaoshiweixinback.business.common.Response;
-import com.example.xiaoshiweixinback.business.common.base.RedisConf;
 import com.example.xiaoshiweixinback.business.common.log.LogHelper;
 import com.example.xiaoshiweixinback.business.exception.BusinessException;
 import com.example.xiaoshiweixinback.business.exception.ExceptionEnum;
@@ -22,11 +19,13 @@ import com.example.xiaoshiweixinback.entity.dto.person.*;
 import com.example.xiaoshiweixinback.entity.vo.person.Jscode2SessionWo;
 import com.example.xiaoshiweixinback.entity.vo.person.LoginByWxVO;
 import com.example.xiaoshiweixinback.entity.vo.person.LoginVO;
+import com.example.xiaoshiweixinback.entity.vo.person.PersonVO;
 import com.example.xiaoshiweixinback.mapper.PersonMapper;
 import com.example.xiaoshiweixinback.okhttp.RequestManager;
 import com.example.xiaoshiweixinback.okhttp.ResponseManager;
 import org.apache.commons.codec.binary.Base64;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -228,10 +227,17 @@ public class LoginService {
         result.put("captcha", ImgUtil.toBase64DataUri(captcha.getImage(), "png"));
         result.put("uuid", uuid);
         //4.将验证码存放到Redis里面并设置过期时间为 60 单位:秒 KEY值格式为: 验证码:UUID  VALUE值为:验证码生成工具所生成的验证码
-        redisUtil.setEx(AppCacheKeyUtil.getCheckCode(vo.getPhoneNum()), captcha.getCode(), 60, TimeUnit.SECONDS);
+//        redisUtil.setEx(AppCacheKeyUtil.getCheckCode(vo.getPhoneNum()), captcha.getCode(), 60, TimeUnit.SECONDS);
         return result;
     }
 
+    public PersonVO selectPerson(PersonIdDTO vo) {
+        Person person = personMapper.selectById(vo.getId());
+        PersonVO personVO = new PersonVO();
+        BeanUtil.copy(person, personVO);
+        return personVO;
+    }
+
     @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
     public boolean editPerson(EditPersonDTO vo) {
         if (!RegexUtil.isPhoneLegal(vo.getPhoneNum())) {

+ 2 - 0
src/test/java/com/example/xiaoshiweixinback/XiaoshiWeixinbackApplicationTests.java

@@ -5,6 +5,7 @@ import com.example.xiaoshiweixinback.service.LoginService;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Lazy;
 
 import java.util.Map;
 
@@ -12,6 +13,7 @@ import java.util.Map;
 class XiaoshiWeixinbackApplicationTests {
 
     @Autowired
+    @Lazy
     private LoginService loginService;
 
     @Test