1.完成通过旧密码修改app密码
2.完成通过验证码修改app密码 3.完成app账号信息的修改
Showing
14 changed files
with
308 additions
and
20 deletions
| ... | @@ -31,6 +31,9 @@ public class MemberSimpleDTO implements Serializable { | ... | @@ -31,6 +31,9 @@ public class MemberSimpleDTO implements Serializable { |
| 31 | /** 是否会员 0:非会员;1:会员 */ | 31 | /** 是否会员 0:非会员;1:会员 */ |
| 32 | private Integer vip; | 32 | private Integer vip; |
| 33 | 33 | ||
| 34 | /** vip过期时间 */ | ||
| 35 | private Timestamp vipExpireTime; | ||
| 36 | |||
| 34 | /** 会员等级(对应level表的level字段,非id) */ | 37 | /** 会员等级(对应level表的level字段,非id) */ |
| 35 | private Integer level; | 38 | private Integer level; |
| 36 | 39 | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/module/user/app/domain/UserAppSimple.java
0 → 100644
| 1 | package com.topdraw.business.module.user.app.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 8 | |||
| 9 | import javax.persistence.*; | ||
| 10 | import java.io.Serializable; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @author XiangHan | ||
| 14 | * @date 2022-06-27 | ||
| 15 | */ | ||
| 16 | @Entity | ||
| 17 | @Data | ||
| 18 | @EntityListeners(AuditingEntityListener.class) | ||
| 19 | @Accessors(chain = true) | ||
| 20 | @Table(name="uc_user_app") | ||
| 21 | public class UserAppSimple implements Serializable { | ||
| 22 | |||
| 23 | // ID | ||
| 24 | @Id | ||
| 25 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 26 | @Column(name = "id") | ||
| 27 | private Long id; | ||
| 28 | |||
| 29 | // 会员id | ||
| 30 | @Column(name = "member_id") | ||
| 31 | private Long memberId; | ||
| 32 | |||
| 33 | // 用户名(一般为手机号) | ||
| 34 | @Column(name = "username", nullable = false) | ||
| 35 | private String username; | ||
| 36 | |||
| 37 | // 状态 0:禁用;1:生效;-1:注销 | ||
| 38 | @Column(name = "status", nullable = false) | ||
| 39 | private Integer status; | ||
| 40 | |||
| 41 | // 昵称 | ||
| 42 | @Column(name = "nickname") | ||
| 43 | private String nickname; | ||
| 44 | |||
| 45 | // 头像地址 | ||
| 46 | @Column(name = "headimgurl") | ||
| 47 | private String headimgurl; | ||
| 48 | |||
| 49 | // 邮箱 | ||
| 50 | @Column(name = "email") | ||
| 51 | private String email; | ||
| 52 | |||
| 53 | // 手机号 | ||
| 54 | @Column(name = "cellphone") | ||
| 55 | private String cellphone; | ||
| 56 | |||
| 57 | // 性别 0:女;1:男;-1:其他 | ||
| 58 | @Column(name = "gender") | ||
| 59 | private Integer gender; | ||
| 60 | |||
| 61 | // 生日 | ||
| 62 | @Column(name = "birthday") | ||
| 63 | private String birthday; | ||
| 64 | |||
| 65 | // 标签 | ||
| 66 | @Column(name = "tags") | ||
| 67 | private String tags; | ||
| 68 | |||
| 69 | // 描述 | ||
| 70 | @Column(name = "description") | ||
| 71 | private String description; | ||
| 72 | |||
| 73 | public void copy(UserAppSimple source){ | ||
| 74 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 75 | } | ||
| 76 | } |
| ... | @@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository; | ... | @@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository; |
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| 6 | import org.springframework.data.jpa.repository.Modifying; | 6 | import org.springframework.data.jpa.repository.Modifying; |
| 7 | import org.springframework.data.jpa.repository.Query; | 7 | import org.springframework.data.jpa.repository.Query; |
| 8 | import org.springframework.data.repository.query.Param; | ||
| 8 | 9 | ||
| 9 | import java.util.Optional; | 10 | import java.util.Optional; |
| 10 | 11 | ||
| ... | @@ -21,4 +22,15 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec | ... | @@ -21,4 +22,15 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec |
| 21 | @Modifying | 22 | @Modifying |
| 22 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `last_active_time` = now() WHERE `username` = ?1", nativeQuery = true) | 23 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `last_active_time` = now() WHERE `username` = ?1", nativeQuery = true) |
| 23 | Integer updateLastActiveTime(String username); | 24 | Integer updateLastActiveTime(String username); |
| 25 | |||
| 26 | @Modifying | ||
| 27 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `id` = ?1", nativeQuery = true) | ||
| 28 | Integer updatePasswordById(Long id, String password); | ||
| 29 | |||
| 30 | @Modifying | ||
| 31 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, " + | ||
| 32 | " `headimgurl` = :#{#resources.headimgurl}, `email` = :#{#resources.email}, `cellphone` = :#{#resources.cellphone}, " + | ||
| 33 | " `gender` = :#{#resources.gender}, `birthday` = :#{#resources.birthday}, `tags` = :#{#resources.tags}, `description` = :#{#resources.description}" + | ||
| 34 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | ||
| 35 | Integer updateAppInfo(@Param("resources") UserApp resources); | ||
| 24 | } | 36 | } | ... | ... |
| 1 | package com.topdraw.business.module.user.app.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.app.domain.UserAppSimple; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-06-27 | ||
| 10 | */ | ||
| 11 | public interface UserAppSimpleRepository extends JpaRepository<UserAppSimple, Long>, JpaSpecificationExecutor<UserAppSimple> { | ||
| 12 | |||
| 13 | } |
| ... | @@ -6,9 +6,11 @@ import com.topdraw.business.module.user.app.domain.UserAppBind; | ... | @@ -6,9 +6,11 @@ import com.topdraw.business.module.user.app.domain.UserAppBind; |
| 6 | import com.topdraw.business.module.user.app.service.UserAppBindService; | 6 | import com.topdraw.business.module.user.app.service.UserAppBindService; |
| 7 | import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; | 7 | import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; |
| 8 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | 8 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; |
| 9 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 9 | import com.topdraw.common.ResultInfo; | 10 | import com.topdraw.common.ResultInfo; |
| 10 | import com.topdraw.annotation.Log; | 11 | import com.topdraw.annotation.Log; |
| 11 | import com.topdraw.business.module.user.app.service.UserAppService; | 12 | import com.topdraw.business.module.user.app.service.UserAppService; |
| 13 | import com.topdraw.util.RegexUtil; | ||
| 12 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
| 13 | import org.apache.commons.lang3.StringUtils; | 15 | import org.apache.commons.lang3.StringUtils; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -34,6 +36,34 @@ public class UserAppController { | ... | @@ -34,6 +36,34 @@ public class UserAppController { |
| 34 | private UserAppBindService userAppBindService; | 36 | private UserAppBindService userAppBindService; |
| 35 | 37 | ||
| 36 | @Log | 38 | @Log |
| 39 | @PostMapping(value = "/updatePasswordById") | ||
| 40 | @ApiOperation("修改app账号密码") | ||
| 41 | @AnonymousAccess | ||
| 42 | public ResultInfo updatePasswordById(@Validated @RequestBody UserApp resources) { | ||
| 43 | log.info("修改app账号密码,参数 ==>> [updatePassword#{}]", resources); | ||
| 44 | String username = resources.getUsername(); | ||
| 45 | if (StringUtils.isBlank(username)) { | ||
| 46 | log.error("修改app账号密码,参数错误,app账号不得为空,[updateLastActiveTime#{}]", resources); | ||
| 47 | return ResultInfo.failure("修改app账号密码失败,参数错误,app账号不得为空"); | ||
| 48 | } | ||
| 49 | |||
| 50 | String password = resources.getPassword(); | ||
| 51 | if (StringUtils.isBlank(password)) { | ||
| 52 | log.error("修改app账号密码失败,参数错误,密码不得为空,[updatePassword#{}]", resources); | ||
| 53 | return ResultInfo.failure("修改app账号最新登录时间失败,参数错误,app账号不得为空"); | ||
| 54 | } | ||
| 55 | |||
| 56 | boolean passwordRegexResult = RegexUtil.appPasswordRegex(password); | ||
| 57 | if (!passwordRegexResult) { | ||
| 58 | log.error("修改app账号密码失败,参数错误,密码格式不正确,[updatePassword#{}]", resources); | ||
| 59 | return ResultInfo.failure("密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-10 之间"); | ||
| 60 | } | ||
| 61 | |||
| 62 | boolean result = this.userAppService.updatePasswordById(resources); | ||
| 63 | return ResultInfo.success(result); | ||
| 64 | } | ||
| 65 | |||
| 66 | @Log | ||
| 37 | @PostMapping(value = "/updateLastActiveTime") | 67 | @PostMapping(value = "/updateLastActiveTime") |
| 38 | @ApiOperation("修改app账号最新登录时间") | 68 | @ApiOperation("修改app账号最新登录时间") |
| 39 | @AnonymousAccess | 69 | @AnonymousAccess |
| ... | @@ -72,7 +102,7 @@ public class UserAppController { | ... | @@ -72,7 +102,7 @@ public class UserAppController { |
| 72 | 102 | ||
| 73 | @Log | 103 | @Log |
| 74 | @PostMapping(value = "/updateValidStatusAndUserAppIdAndNickname") | 104 | @PostMapping(value = "/updateValidStatusAndUserAppIdAndNickname") |
| 75 | @ApiOperation("修改第三方账号") | 105 | @ApiOperation("修改第三方账号绑定状态、绑定的app账号以及第三方账号昵称") |
| 76 | @AnonymousAccess | 106 | @AnonymousAccess |
| 77 | public ResultInfo updateValidStatusAndUserAppIdAndNickname(@Validated @RequestBody UserAppBind resources) { | 107 | public ResultInfo updateValidStatusAndUserAppIdAndNickname(@Validated @RequestBody UserAppBind resources) { |
| 78 | log.info("修改第三方账号 ==>> param ==>> [updateThirdAccountStatusAndUserAppId#{}]", resources); | 108 | log.info("修改第三方账号 ==>> param ==>> [updateThirdAccountStatusAndUserAppId#{}]", resources); |
| ... | @@ -89,7 +119,6 @@ public class UserAppController { | ... | @@ -89,7 +119,6 @@ public class UserAppController { |
| 89 | return ResultInfo.failure("检查第三方账号是否绑定了第三方账号失败, 参数错误, 第三方账号或者第三方账号类型不得为空"); | 119 | return ResultInfo.failure("检查第三方账号是否绑定了第三方账号失败, 参数错误, 第三方账号或者第三方账号类型不得为空"); |
| 90 | } | 120 | } |
| 91 | 121 | ||
| 92 | |||
| 93 | UserAppDTO userAppDTO = this.userAppService.findByUsername(username); | 122 | UserAppDTO userAppDTO = this.userAppService.findByUsername(username); |
| 94 | if (Objects.nonNull(userAppDTO.getId())) { | 123 | if (Objects.nonNull(userAppDTO.getId())) { |
| 95 | Long id = userAppDTO.getId(); | 124 | Long id = userAppDTO.getId(); |
| ... | @@ -104,7 +133,7 @@ public class UserAppController { | ... | @@ -104,7 +133,7 @@ public class UserAppController { |
| 104 | } | 133 | } |
| 105 | 134 | ||
| 106 | @Log | 135 | @Log |
| 107 | @PostMapping(value = "/updateThirdAccountStatusAndUserAppId") | 136 | @PostMapping(value = "/updateThirdAccountNickname") |
| 108 | @ApiOperation("修改第三方账号昵称") | 137 | @ApiOperation("修改第三方账号昵称") |
| 109 | @AnonymousAccess | 138 | @AnonymousAccess |
| 110 | public ResultInfo updateThirdAccountNickname(@Validated @RequestBody UserAppBind resources) { | 139 | public ResultInfo updateThirdAccountNickname(@Validated @RequestBody UserAppBind resources) { | ... | ... |
| ... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.user.app.service; | ... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.user.app.service; |
| 3 | import com.topdraw.business.module.user.app.domain.UserApp; | 3 | import com.topdraw.business.module.user.app.domain.UserApp; |
| 4 | import com.topdraw.business.module.user.app.domain.UserAppBind; | 4 | import com.topdraw.business.module.user.app.domain.UserAppBind; |
| 5 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | 5 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; |
| 6 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| 8 | * @author XiangHan | 9 | * @author XiangHan |
| ... | @@ -49,4 +50,18 @@ public interface UserAppService { | ... | @@ -49,4 +50,18 @@ public interface UserAppService { |
| 49 | * @return | 50 | * @return |
| 50 | */ | 51 | */ |
| 51 | boolean updateLastActiveTime(UserAppBind resources); | 52 | boolean updateLastActiveTime(UserAppBind resources); |
| 53 | |||
| 54 | /** | ||
| 55 | * | ||
| 56 | * @param resources | ||
| 57 | * @return | ||
| 58 | */ | ||
| 59 | boolean updatePasswordById(UserApp resources); | ||
| 60 | |||
| 61 | /** | ||
| 62 | * | ||
| 63 | * @param resources | ||
| 64 | * @return | ||
| 65 | */ | ||
| 66 | UserAppSimpleDTO updateAppInfo(UserApp resources); | ||
| 52 | } | 67 | } | ... | ... |
| 1 | package com.topdraw.business.module.user.app.service.dto; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 4 | import com.topdraw.business.module.member.service.dto.MemberSimpleDTO; | ||
| 5 | import lombok.Data; | ||
| 6 | |||
| 7 | import java.io.Serializable; | ||
| 8 | import java.sql.Timestamp; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * @author XiangHan | ||
| 12 | * @date 2022-06-27 | ||
| 13 | */ | ||
| 14 | @Data | ||
| 15 | public class UserAppSimpleDTO implements Serializable { | ||
| 16 | |||
| 17 | // ID | ||
| 18 | private Long id; | ||
| 19 | |||
| 20 | // 会员id | ||
| 21 | private Long memberId; | ||
| 22 | |||
| 23 | // 用户名(一般为手机号) | ||
| 24 | private String username; | ||
| 25 | |||
| 26 | // 状态 0:禁用;1:生效;-1:注销 | ||
| 27 | private Integer status; | ||
| 28 | |||
| 29 | // 昵称 | ||
| 30 | private String nickname; | ||
| 31 | |||
| 32 | // 头像地址 | ||
| 33 | private String headimgurl; | ||
| 34 | |||
| 35 | // 邮箱 | ||
| 36 | private String email; | ||
| 37 | |||
| 38 | // 手机号 | ||
| 39 | private String cellphone; | ||
| 40 | |||
| 41 | // 性别 0:女;1:男;-1:其他 | ||
| 42 | private Integer gender; | ||
| 43 | |||
| 44 | // 生日 | ||
| 45 | private String birthday; | ||
| 46 | |||
| 47 | // 标签 | ||
| 48 | private String tags; | ||
| 49 | |||
| 50 | // 描述 | ||
| 51 | private String description; | ||
| 52 | |||
| 53 | private MemberSimpleDTO member; | ||
| 54 | |||
| 55 | } |
| 1 | package com.topdraw.business.module.user.app.service.impl; | 1 | package com.topdraw.business.module.user.app.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.module.member.service.MemberService; | ||
| 4 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 5 | import com.topdraw.business.module.member.service.dto.MemberSimpleDTO; | ||
| 3 | import com.topdraw.business.module.user.app.domain.UserApp; | 6 | import com.topdraw.business.module.user.app.domain.UserApp; |
| 4 | import com.topdraw.business.module.user.app.domain.UserAppBind; | 7 | import com.topdraw.business.module.user.app.domain.UserAppBind; |
| 8 | import com.topdraw.business.module.user.app.domain.UserAppSimple; | ||
| 9 | import com.topdraw.business.module.user.app.repository.UserAppSimpleRepository; | ||
| 10 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 5 | import com.topdraw.utils.ValidationUtil; | 11 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.module.user.app.repository.UserAppRepository; | 12 | import com.topdraw.business.module.user.app.repository.UserAppRepository; |
| 7 | import com.topdraw.business.module.user.app.service.UserAppService; | 13 | import com.topdraw.business.module.user.app.service.UserAppService; |
| 8 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | 14 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; |
| 9 | import com.topdraw.business.module.user.app.service.mapper.UserAppMapper; | 15 | import com.topdraw.business.module.user.app.service.mapper.UserAppMapper; |
| 10 | import lombok.extern.slf4j.Slf4j; | 16 | import lombok.extern.slf4j.Slf4j; |
| 17 | import org.springframework.beans.BeanUtils; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 20 | import org.springframework.transaction.annotation.Propagation; |
| ... | @@ -29,7 +36,11 @@ public class UserAppServiceImpl implements UserAppService { | ... | @@ -29,7 +36,11 @@ public class UserAppServiceImpl implements UserAppService { |
| 29 | @Autowired | 36 | @Autowired |
| 30 | private UserAppRepository userAppRepository; | 37 | private UserAppRepository userAppRepository; |
| 31 | @Autowired | 38 | @Autowired |
| 39 | private UserAppSimpleRepository userAppSimpleRepository; | ||
| 40 | @Autowired | ||
| 32 | private UserAppMapper userAppMapper; | 41 | private UserAppMapper userAppMapper; |
| 42 | @Autowired | ||
| 43 | private MemberService memberService; | ||
| 33 | 44 | ||
| 34 | 45 | ||
| 35 | @Override | 46 | @Override |
| ... | @@ -80,7 +91,35 @@ public class UserAppServiceImpl implements UserAppService { | ... | @@ -80,7 +91,35 @@ public class UserAppServiceImpl implements UserAppService { |
| 80 | @Override | 91 | @Override |
| 81 | @Transactional(rollbackFor = Exception.class) | 92 | @Transactional(rollbackFor = Exception.class) |
| 82 | public boolean updateLastActiveTime(UserAppBind resources) { | 93 | public boolean updateLastActiveTime(UserAppBind resources) { |
| 83 | return this.userAppRepository.updateLastActiveTime(resources.getUsername()) > 0; | 94 | return this.userAppRepository.updateLastActiveTime(resources.getUsername()) > 0; |
| 95 | } | ||
| 96 | |||
| 97 | @Override | ||
| 98 | @Transactional(rollbackFor = Exception.class) | ||
| 99 | public boolean updatePasswordById(UserApp resources) { | ||
| 100 | return this.userAppRepository.updatePasswordById(resources.getId(), resources.getPassword()) > 0; | ||
| 101 | } | ||
| 102 | |||
| 103 | @Override | ||
| 104 | @Transactional(rollbackFor = Exception.class) | ||
| 105 | public UserAppSimpleDTO updateAppInfo(UserApp resources) { | ||
| 106 | |||
| 107 | if (this.userAppRepository.updateAppInfo(resources) > 0) { | ||
| 108 | UserAppSimple userAppSimple = this.userAppSimpleRepository.findById(resources.getId()).orElseGet(UserAppSimple::new); | ||
| 109 | if (Objects.nonNull(userAppSimple.getId())) { | ||
| 110 | MemberDTO memberDTO = this.memberService.findById(userAppSimple.getMemberId()); | ||
| 111 | |||
| 112 | UserAppSimpleDTO userAppSimpleDTO = new UserAppSimpleDTO(); | ||
| 113 | BeanUtils.copyProperties(userAppSimple, userAppSimpleDTO); | ||
| 114 | |||
| 115 | MemberSimpleDTO memberSimpleDTO = new MemberSimpleDTO(); | ||
| 116 | BeanUtils.copyProperties(memberDTO, memberSimpleDTO); | ||
| 117 | userAppSimpleDTO.setMember(memberSimpleDTO); | ||
| 118 | return userAppSimpleDTO; | ||
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 122 | return null; | ||
| 84 | } | 123 | } |
| 85 | 124 | ||
| 86 | 125 | ... | ... |
| 1 | package com.topdraw.business.module.user.app.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.user.app.domain.UserApp; | ||
| 5 | import com.topdraw.business.module.user.app.domain.UserAppSimple; | ||
| 6 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | ||
| 7 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 8 | import org.mapstruct.Mapper; | ||
| 9 | import org.mapstruct.ReportingPolicy; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * @author XiangHan | ||
| 13 | * @date 2022-06-27 | ||
| 14 | */ | ||
| 15 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 16 | public interface UserAppSimpleMapper extends BaseMapper<UserAppSimpleDTO, UserAppSimple> { | ||
| 17 | |||
| 18 | } |
| ... | @@ -12,6 +12,7 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; | ... | @@ -12,6 +12,7 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 12 | import com.topdraw.business.module.user.app.domain.UserApp; | 12 | import com.topdraw.business.module.user.app.domain.UserApp; |
| 13 | import com.topdraw.business.module.user.app.domain.UserAppBind; | 13 | import com.topdraw.business.module.user.app.domain.UserAppBind; |
| 14 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | 14 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; |
| 15 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 15 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 16 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 16 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 17 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 17 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 18 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| ... | @@ -28,6 +29,7 @@ import com.topdraw.exception.GlobeExceptionMsg; | ... | @@ -28,6 +29,7 @@ import com.topdraw.exception.GlobeExceptionMsg; |
| 28 | import com.topdraw.resttemplate.RestTemplateClient; | 29 | import com.topdraw.resttemplate.RestTemplateClient; |
| 29 | import com.topdraw.util.Base64Util; | 30 | import com.topdraw.util.Base64Util; |
| 30 | import com.topdraw.util.JSONUtil; | 31 | import com.topdraw.util.JSONUtil; |
| 32 | import com.topdraw.util.RegexUtil; | ||
| 31 | import com.topdraw.utils.RedisUtils; | 33 | import com.topdraw.utils.RedisUtils; |
| 32 | import com.topdraw.weixin.util.WeChatConstants; | 34 | import com.topdraw.weixin.util.WeChatConstants; |
| 33 | import com.topdraw.weixin.util.WeixinUtil; | 35 | import com.topdraw.weixin.util.WeixinUtil; |
| ... | @@ -46,7 +48,7 @@ import java.net.URLDecoder; | ... | @@ -46,7 +48,7 @@ import java.net.URLDecoder; |
| 46 | import java.sql.Timestamp; | 48 | import java.sql.Timestamp; |
| 47 | import java.util.*; | 49 | import java.util.*; |
| 48 | 50 | ||
| 49 | @Api("账户处理") | 51 | @Api("账号处理") |
| 50 | @RestController | 52 | @RestController |
| 51 | @RequestMapping(value = "/uce/userOperation") | 53 | @RequestMapping(value = "/uce/userOperation") |
| 52 | @Slf4j | 54 | @Slf4j |
| ... | @@ -72,6 +74,23 @@ public class UserOperationController { | ... | @@ -72,6 +74,23 @@ public class UserOperationController { |
| 72 | /******************************************************* APP ************************************/ | 74 | /******************************************************* APP ************************************/ |
| 73 | 75 | ||
| 74 | @Log | 76 | @Log |
| 77 | @PostMapping(value = "/updateAppInfo") | ||
| 78 | @ApiOperation("修改app账号信息") | ||
| 79 | @AnonymousAccess | ||
| 80 | public ResultInfo updateAppInfo(@Validated @RequestBody UserApp resources) { | ||
| 81 | log.info("修改app账号信息,参数 ==>> [updateAppInfo#{}]", resources); | ||
| 82 | Long id = resources.getId(); | ||
| 83 | if (Objects.isNull(id)) { | ||
| 84 | log.error("修改app账号密码,参数错误,id不得为空,[updateAppInfo#{}]", resources); | ||
| 85 | return ResultInfo.failure("修改app账号密码失败,参数错误,id不得为空"); | ||
| 86 | } | ||
| 87 | |||
| 88 | UserAppSimpleDTO result = this.userOperationService.updateAppInfo(resources); | ||
| 89 | return ResultInfo.success(result); | ||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 93 | @Log | ||
| 75 | @PostMapping(value = "/appRegister") | 94 | @PostMapping(value = "/appRegister") |
| 76 | @ApiOperation("app注册") | 95 | @ApiOperation("app注册") |
| 77 | @AnonymousAccess | 96 | @AnonymousAccess |
| ... | @@ -139,17 +158,6 @@ public class UserOperationController { | ... | @@ -139,17 +158,6 @@ public class UserOperationController { |
| 139 | } | 158 | } |
| 140 | 159 | ||
| 141 | @Log | 160 | @Log |
| 142 | @PostMapping(value = "/updateUserApp") | ||
| 143 | @ApiOperation("修改app账号信息") | ||
| 144 | @AnonymousAccess | ||
| 145 | public ResultInfo updateUserApp(@Validated @RequestBody UserApp resources) { | ||
| 146 | log.info("修改app账号信息 ==>> param ==>> [updateUserApp#{}]", resources); | ||
| 147 | |||
| 148 | UserAppDTO userAppDTO = this.userOperationService.updateUserApp(resources); | ||
| 149 | return ResultInfo.success(userAppDTO); | ||
| 150 | } | ||
| 151 | |||
| 152 | @Log | ||
| 153 | @PostMapping(value = "/cancelUserAppBind") | 161 | @PostMapping(value = "/cancelUserAppBind") |
| 154 | @ApiOperation("取消关联第三方账号") | 162 | @ApiOperation("取消关联第三方账号") |
| 155 | @AnonymousAccess | 163 | @AnonymousAccess | ... | ... |
| ... | @@ -4,6 +4,7 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; | ... | @@ -4,6 +4,7 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 4 | import com.topdraw.business.module.user.app.domain.UserApp; | 4 | import com.topdraw.business.module.user.app.domain.UserApp; |
| 5 | import com.topdraw.business.module.user.app.domain.UserAppBind; | 5 | import com.topdraw.business.module.user.app.domain.UserAppBind; |
| 6 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | 6 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; |
| 7 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 7 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 8 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 8 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 9 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 9 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 10 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| ... | @@ -197,5 +198,12 @@ public interface UserOperationService { | ... | @@ -197,5 +198,12 @@ public interface UserOperationService { |
| 197 | * @param resources | 198 | * @param resources |
| 198 | * @return | 199 | * @return |
| 199 | */ | 200 | */ |
| 200 | UserAppDTO updateUserApp(UserApp resources); | 201 | UserAppSimpleDTO updateAppInfo(UserApp resources); |
| 202 | |||
| 203 | /** | ||
| 204 | * | ||
| 205 | * @param resources | ||
| 206 | * @return | ||
| 207 | */ | ||
| 208 | boolean updatePasswordById(UserApp resources); | ||
| 201 | } | 209 | } | ... | ... |
| ... | @@ -17,6 +17,7 @@ import com.topdraw.business.module.user.app.service.UserAppBindService; | ... | @@ -17,6 +17,7 @@ import com.topdraw.business.module.user.app.service.UserAppBindService; |
| 17 | import com.topdraw.business.module.user.app.service.UserAppService; | 17 | import com.topdraw.business.module.user.app.service.UserAppService; |
| 18 | import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; | 18 | import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; |
| 19 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | 19 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; |
| 20 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 20 | import com.topdraw.business.module.user.iptv.domain.UserConstant; | 21 | import com.topdraw.business.module.user.iptv.domain.UserConstant; |
| 21 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 22 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 22 | import com.topdraw.business.module.user.iptv.domain.UserTvBuilder; | 23 | import com.topdraw.business.module.user.iptv.domain.UserTvBuilder; |
| ... | @@ -182,8 +183,13 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -182,8 +183,13 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 182 | } | 183 | } |
| 183 | 184 | ||
| 184 | @Override | 185 | @Override |
| 185 | public UserAppDTO updateUserApp(UserApp resources) { | 186 | public UserAppSimpleDTO updateAppInfo(UserApp resources) { |
| 186 | return this.userAppService.update(resources); | 187 | return this.userAppService.updateAppInfo(resources); |
| 188 | } | ||
| 189 | |||
| 190 | @Override | ||
| 191 | public boolean updatePasswordById(UserApp resources) { | ||
| 192 | return this.userAppService.updatePasswordById(resources); | ||
| 187 | } | 193 | } |
| 188 | 194 | ||
| 189 | /** | 195 | /** | ... | ... |
| ... | @@ -23,4 +23,10 @@ public class RegexUtil { | ... | @@ -23,4 +23,10 @@ public class RegexUtil { |
| 23 | return m.find(); | 23 | return m.find(); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | public static boolean appPasswordRegex(String password) { | ||
| 27 | String pattern = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,10}$"; | ||
| 28 | Pattern r = Pattern.compile(pattern); | ||
| 29 | Matcher m = r.matcher(password); | ||
| 30 | return m.find(); | ||
| 31 | } | ||
| 26 | } | 32 | } | ... | ... |
| ... | @@ -64,7 +64,7 @@ | ... | @@ -64,7 +64,7 @@ |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | <!--监控sql日志输出 --> | 66 | <!--监控sql日志输出 --> |
| 67 | <logger name="jdbc.sqlonly" level="OFF" additivity="false"> | 67 | <logger name="jdbc.sqlonly" level="INFO" additivity="false"> |
| 68 | <appender-ref ref="console" /> | 68 | <appender-ref ref="console" /> |
| 69 | <appender-ref ref="info" /> | 69 | <appender-ref ref="info" /> |
| 70 | </logger> | 70 | </logger> | ... | ... |
-
Please register or sign in to post a comment