fix: 修复oss bean加载问题

This commit is contained in:
zlg
2024-05-15 13:04:54 +08:00
parent 2b45768b19
commit a522e11872
10 changed files with 121 additions and 76 deletions

View File

@@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSON;
import com.schisandra.auth.application.convert.SchisandraAuthUserDTOConverter;
import com.schisandra.auth.application.dto.SchisandraAuthUserDTO;
import com.schisandra.auth.common.entity.Result;
import com.schisandra.auth.common.redis.RedisUtil;
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
import com.schisandra.auth.domain.service.SchisandraAuthUserDomainService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
@@ -25,13 +27,41 @@ import javax.annotation.Resource;
public class SchisandraAuthUserController {
@Resource
private SchisandraAuthUserDomainService schisandraAuthUserDomainService;
@Resource
private RedisUtil redisUtil;
/**
* @description 更新用户信息
* @param schisandraAuthUserDTO
* @return com.schisandra.auth.common.entity.Result<java.lang.Boolean>
* @description 更新用户信息
* @author schisandra
* @date 2024/3/21 23:06
*/
@PostMapping("register")
public Result register(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
if (log.isInfoEnabled()) {
log.info("UserController.register.dto:{}", JSON.toJSONString(schisandraAuthUserDTO));
}
if (redisUtil.exist("auth.phone."+schisandraAuthUserDTO.getPhone())){
if (redisUtil.get("auth.phone."+schisandraAuthUserDTO.getPhone())!=schisandraAuthUserDTO.getAvatar()){
return Result.fail("验证码错误,请重新验证");
}
}else {
return Result.fail("验证码错误,请重新验证");
}
try {
checkUserInfo(schisandraAuthUserDTO);
SchisandraAuthUserBO authUserBO = SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
if (schisandraAuthUserDomainService.register(authUserBO)==1){
return Result.fail("注册用户成功");
}else {
return Result.fail("注册用户失败");
}
} catch (Exception e) {
return Result.fail("注册用户失败");
}
}
@PostMapping("update")
public Result update(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
try {
@@ -46,17 +76,18 @@ public class SchisandraAuthUserController {
return Result.fail("更新用户信息失败");
}
}
/**
* @description 查询用户信息
* @param schisandraAuthUserDTO
* @return
* @description 查询用户信息
* @author msz
* @date 2024/4/3 22:05
*/
@PostMapping("/query")
public Result query(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO){
try{
if(log.isInfoEnabled()){
public Result query(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
try {
if (log.isInfoEnabled()) {
log.info("UserController.select.dto:{}", JSON.toJSONString(schisandraAuthUserDTO));
}
checkUserInfo(schisandraAuthUserDTO);
@@ -67,17 +98,18 @@ public class SchisandraAuthUserController {
return Result.fail("查询用户信息失败");
}
}
/**
* @description 添加用户信息
* @param schisandraAuthUserDTO
* @return
* @description 添加用户信息
* @author msz
* @date 2024/4/3 22:12
*/
@PostMapping("/insert")
public Result insert(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO){
try{
if(log.isInfoEnabled()){
public Result insert(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
try {
if (log.isInfoEnabled()) {
log.info("UserController.insert.dto:{}", JSON.toJSONString(schisandraAuthUserDTO));
}
checkUserInfo(schisandraAuthUserDTO);
@@ -88,18 +120,19 @@ public class SchisandraAuthUserController {
return Result.fail("添加用户信息失败");
}
}
/**
* @description 删除用户信息
* @param id
* @return
* @description 删除用户信息
* @author msz
* @date 2024/4/3 22:12
*/
@GetMapping("/delete/{id}")
public Result delete(@PathVariable Long id){
try{
if(log.isInfoEnabled()){
log.info("UserController.insert.dto:{}",id);
public Result delete(@PathVariable Long id) {
try {
if (log.isInfoEnabled()) {
log.info("UserController.insert.dto:{}", id);
}
return Result.ok(schisandraAuthUserDomainService.deleteById(id));
} catch (Exception e) {
@@ -107,10 +140,11 @@ public class SchisandraAuthUserController {
return Result.fail("删除用户信息失败");
}
}
/**
* @description 用户信息断言校验
* @param schisandraAuthUserDTO
* @param schisandraAuthUserDTO
* @return void
* @description 用户信息断言校验
* @author schisandra
* @date 2024/3/21 23:09
*/

View File

@@ -12,6 +12,9 @@ import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
*/
public interface SchisandraAuthUserDomainService {
int register(SchisandraAuthUserBO schisandraAuthUserBO);
/**
* @description 更新用户信息
* @param schisandraAuthUserBO

View File

@@ -16,11 +16,33 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
@Resource
private SchisandraAuthUserService schisandraAuthUserService;
/**
* @description: 注册用户
* @param: [schisandraAuthUserBO]
* @return: com.schisandra.auth.domain.bo.SchisandraAuthUserBO
* @author zlg
* @date: 2024/5/14 20:59
*/
@Override
public int register(SchisandraAuthUserBO schisandraAuthUserBO) {
SchisandraAuthUser schisandraAuthUser = schisandraAuthUserService.queryByPhone(schisandraAuthUserBO.getPhone());
if (schisandraAuthUser != null) {
return 0;
} else {
SchisandraAuthUser schisandraAuthUser1 = SchisandraAuthUserBOConverter.INSTANCE.convertBOToEntity(schisandraAuthUserBO);
if (schisandraAuthUserService.insert(schisandraAuthUser1)==null) {
return 0;
}else {
return 1;
}
}
}
/**
* @description 更新用户信息
* @param schisandraAuthUserBO
* @return java.lang.Object
* @description 更新用户信息
* @author schisandra
* @date 2024/3/21 23:14
*/
@@ -30,10 +52,11 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
Integer count = schisandraAuthUserService.update(schisandraAuthUser);
return count > 0;
}
/**
* @description 查询用户信息
* @param schisandraAuthUserBO
* @return
* @description 查询用户信息
* @author msz
* @date 2024/4/3 22:10
*/
@@ -43,10 +66,11 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
SchisandraAuthUserBO schisandraAuthUserBO1 = SchisandraAuthUserBOConverter.INSTANCE.convertEntityToBO(schisandraAuthUser);
return schisandraAuthUserBO1;
}
/**
* @description 添加用户信息
* @param schisandraAuthUserBO
* @return java.lang.Object
* @description 添加用户信息
* @author msz
* @date 2024/4/3 22:17
*/
@@ -54,12 +78,13 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
public Object insert(SchisandraAuthUserBO schisandraAuthUserBO) {
SchisandraAuthUser schisandraAuthUser = SchisandraAuthUserBOConverter.INSTANCE.convertBOToEntity(schisandraAuthUserBO);
SchisandraAuthUser user = schisandraAuthUserService.insert(schisandraAuthUser);
return user!=null;
return user != null;
}
/**
* @description 添加用户信息
* @param id
* @return java.lang.Object
* @description 添加用户信息
* @author msz
* @date 2024/4/3 22:30
*/

View File

@@ -79,5 +79,7 @@ public interface SchisandraAuthUserDao {
*/
int deleteById(Long id);
SchisandraAuthUser queryByPhone(String phone);
}

View File

@@ -53,4 +53,6 @@ public interface SchisandraAuthUserService {
*/
boolean deleteById(Long id);
SchisandraAuthUser queryByPhone(String phone);
}

View File

@@ -79,4 +79,9 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService
public boolean deleteById(Long id) {
return this.schisandraAuthUserDao.deleteById(id) > 0;
}
@Override
public SchisandraAuthUser queryByPhone(String phone) {
return this.schisandraAuthUserDao.queryByPhone(phone);
}
}

View File

@@ -232,5 +232,11 @@
where id = #{id}
</delete>
<select id="queryByPhone" resultMap="SchisandraAuthUserMap">
select id,user_name,nick_name,email,phone,password,sex,avatar,status,introduce,ext_json,created_by,created_time,update_by,update_time,is_deleted
from schisandra_auth_user
where phone = #{phone}
</select>
</mapper>