1.优化配置文件
2.同步app账号
Showing
38 changed files
with
1897 additions
and
35 deletions
... | @@ -42,7 +42,8 @@ public class MemberBuilder { | ... | @@ -42,7 +42,8 @@ public class MemberBuilder { |
42 | member.setCouponAmount(DEFAULT_VALUE); | 42 | member.setCouponAmount(DEFAULT_VALUE); |
43 | member.setDueCouponAmount(DEFAULT_VALUE); | 43 | member.setDueCouponAmount(DEFAULT_VALUE); |
44 | member.setBlackStatus(DEFAULT_VALUE); | 44 | member.setBlackStatus(DEFAULT_VALUE); |
45 | member.setBirthday(StringUtils.isBlank(member.getBirthday())?"1900-01-01":member.getBirthday()); | 45 | // member.setBirthday(StringUtils.isBlank(member.getBirthday())?"1900-01-01":member.getBirthday()); |
46 | member.setBirthday(null); | ||
46 | String nickname = member.getNickname(); | 47 | String nickname = member.getNickname(); |
47 | if (StringUtils.isNotEmpty(nickname)) { | 48 | if (StringUtils.isNotEmpty(nickname)) { |
48 | // String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8))); | 49 | // String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8))); | ... | ... |
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.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2022-06-27 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="uc_user_app") | ||
24 | public class UserAppIdManual implements Serializable { | ||
25 | |||
26 | // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号 | ||
27 | @Transient | ||
28 | private Integer accountType; | ||
29 | |||
30 | // 第三方账号 | ||
31 | @Transient | ||
32 | private String account; | ||
33 | |||
34 | @Transient | ||
35 | private String memberCode; | ||
36 | |||
37 | // ID | ||
38 | @Id | ||
39 | @GeneratedValue(strategy = GenerationType.SEQUENCE) | ||
40 | @Column(name = "id") | ||
41 | private Long id; | ||
42 | |||
43 | // 会员id | ||
44 | @Column(name = "member_id") | ||
45 | private Long memberId; | ||
46 | |||
47 | // 用户名(一般为手机号) | ||
48 | @Column(name = "username", nullable = false) | ||
49 | private String username; | ||
50 | |||
51 | // 密码 | ||
52 | @Column(name = "password") | ||
53 | private String password; | ||
54 | |||
55 | // 类型 0:苹果;1:安卓;-1:未知 | ||
56 | @Column(name = "type", nullable = false) | ||
57 | private Integer type; | ||
58 | |||
59 | // 状态 0:禁用;1:生效;-1:注销 | ||
60 | @Column(name = "status", nullable = false) | ||
61 | private Integer status; | ||
62 | |||
63 | // 昵称 | ||
64 | @Column(name = "nickname") | ||
65 | private String nickname; | ||
66 | |||
67 | // 头像地址 | ||
68 | @Column(name = "headimgurl") | ||
69 | private String headimgurl; | ||
70 | |||
71 | // 邮箱 | ||
72 | @Column(name = "email") | ||
73 | private String email; | ||
74 | |||
75 | // 手机号 | ||
76 | @Column(name = "cellphone") | ||
77 | private String cellphone; | ||
78 | |||
79 | // 性别 0:女;1:男;-1:其他 | ||
80 | @Column(name = "gender") | ||
81 | private Integer gender; | ||
82 | |||
83 | // 生日 | ||
84 | @Column(name = "birthday") | ||
85 | private String birthday; | ||
86 | |||
87 | // 最近活跃时间 | ||
88 | @Column(name = "last_active_time") | ||
89 | private Timestamp lastActiveTime; | ||
90 | |||
91 | // 注销时间 | ||
92 | @Column(name = "delete_time") | ||
93 | private Timestamp deleteTime; | ||
94 | |||
95 | // 标签 | ||
96 | @Column(name = "tags") | ||
97 | private String tags; | ||
98 | |||
99 | // 描述 | ||
100 | @Column(name = "description") | ||
101 | private String description; | ||
102 | |||
103 | // 创建时间 | ||
104 | @CreatedDate | ||
105 | @Column(name = "create_time") | ||
106 | private Timestamp createTime; | ||
107 | |||
108 | // 更新时间 | ||
109 | @LastModifiedDate | ||
110 | @Column(name = "update_time") | ||
111 | private Timestamp updateTime; | ||
112 | |||
113 | public void copy(UserAppIdManual source){ | ||
114 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
115 | } | ||
116 | } |
1 | package com.topdraw.business.module.user.app.repository; | 1 | package com.topdraw.business.module.user.app.repository; |
2 | 2 | ||
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.UserAppIdManual; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | 5 | import org.springframework.data.jpa.repository.JpaRepository; |
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
6 | import org.springframework.data.jpa.repository.Modifying; | 7 | import org.springframework.data.jpa.repository.Modifying; |
... | @@ -47,4 +48,17 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec | ... | @@ -47,4 +48,17 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec |
47 | @Query(value = "UPDATE `uc_user_app` SET `last_active_time` = now(), `nickname` = ?2, `headimgurl` = ?3 " + | 48 | @Query(value = "UPDATE `uc_user_app` SET `last_active_time` = now(), `nickname` = ?2, `headimgurl` = ?3 " + |
48 | " WHERE `username` = ?1 and `status` = 1 ", nativeQuery = true) | 49 | " WHERE `username` = ?1 and `status` = 1 ", nativeQuery = true) |
49 | Integer updateAppLastActiveTimeAndNicknameAndHeadImg(String username, String nickname, String headimgurl); | 50 | Integer updateAppLastActiveTimeAndNicknameAndHeadImg(String username, String nickname, String headimgurl); |
51 | |||
52 | @Modifying | ||
53 | @Query(value = "INSERT INTO `uc_user_app`(`id`, `member_id`, `username`, `password`, `type`, `status`, `nickname`, `headimgurl`, `email`, `cellphone`, `gender`, `birthday`, `last_active_time`, `delete_time`, `tags`, `description`, `create_time`, `update_time`) " + | ||
54 | " VALUES (:#{#resources.id}, :#{#resources.memberId}, :#{#resources.username}, :#{#resources.password}, :#{#resources.type}," + | ||
55 | " 1, :#{#resources.nickname}, :#{#resources.headimgurl}, :#{#resources.email}, :#{#resources.cellphone}, " + | ||
56 | " :#{#resources.gender}, NULL, now(), NULL, :#{#resources.tags}, " + | ||
57 | " :#{#resources.description}, :#{#resources.createTime}, now());", nativeQuery = true) | ||
58 | void saveByIdManual(@Param("resources") UserAppIdManual userAppIdManual); | ||
59 | |||
60 | @Modifying | ||
61 | @Query(value = "UPDATE `uc_user_app` SET `username`= :#{#resources.username},`cellphone`= :#{#resources.cellphone}, `last_active_time` = now(), `nickname` = :#{#resources.nickname}, `headimgurl` = :#{#resources.headimgurl} " + | ||
62 | " WHERE `id` = :#{#resources.id} and `status` = 1 ", nativeQuery = true) | ||
63 | Integer updateAppLastActiveTimeAndNicknameAndHeadImgById(@Param("resources") UserApp userApp); | ||
50 | } | 64 | } | ... | ... |
... | @@ -2,8 +2,13 @@ package com.topdraw.business.module.user.app.service; | ... | @@ -2,8 +2,13 @@ package com.topdraw.business.module.user.app.service; |
2 | 2 | ||
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.domain.UserAppIdManual; | ||
5 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | 6 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; |
6 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | 7 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; |
8 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
9 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
10 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
11 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
7 | 12 | ||
8 | /** | 13 | /** |
9 | * @author XiangHan | 14 | * @author XiangHan |
... | @@ -72,9 +77,26 @@ public interface UserAppService { | ... | @@ -72,9 +77,26 @@ public interface UserAppService { |
72 | */ | 77 | */ |
73 | boolean updateAppInfo(UserApp resources); | 78 | boolean updateAppInfo(UserApp resources); |
74 | 79 | ||
75 | 80 | /** | |
81 | * | ||
82 | * @param id | ||
83 | * @return | ||
84 | */ | ||
76 | boolean appCancellation(Long id); | 85 | boolean appCancellation(Long id); |
77 | 86 | ||
78 | 87 | /** | |
88 | * | ||
89 | * @param resources | ||
90 | * @return | ||
91 | */ | ||
79 | boolean updateAppLastActiveTimeAndNicknameAndHeadImg(UserApp resources); | 92 | boolean updateAppLastActiveTimeAndNicknameAndHeadImg(UserApp resources); |
93 | |||
94 | /** | ||
95 | * | ||
96 | * @param resources | ||
97 | * @return | ||
98 | */ | ||
99 | boolean asyncSaveByIdManual(UserAppIdManual resources); | ||
100 | |||
101 | |||
80 | } | 102 | } | ... | ... |
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.domain.Member; | ||
4 | import com.topdraw.business.module.member.domain.MemberBuilder; | ||
5 | import com.topdraw.business.module.member.domain.MemberTypeConstant; | ||
6 | import com.topdraw.business.module.member.service.MemberService; | ||
7 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
3 | import com.topdraw.business.module.user.app.domain.UserApp; | 8 | import com.topdraw.business.module.user.app.domain.UserApp; |
4 | import com.topdraw.business.module.user.app.domain.UserAppBind; | 9 | import com.topdraw.business.module.user.app.domain.UserAppBind; |
10 | import com.topdraw.business.module.user.app.domain.UserAppIdManual; | ||
5 | import com.topdraw.business.module.user.app.repository.UserAppRepository; | 11 | import com.topdraw.business.module.user.app.repository.UserAppRepository; |
6 | import com.topdraw.business.module.user.app.repository.UserAppSimpleRepository; | 12 | import com.topdraw.business.module.user.app.repository.UserAppSimpleRepository; |
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.dto.UserAppSimpleDTO; | 15 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; |
10 | import com.topdraw.business.module.user.app.service.mapper.UserAppMapper; | 16 | import com.topdraw.business.module.user.app.service.mapper.UserAppMapper; |
17 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
18 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
19 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
20 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
11 | import com.topdraw.utils.ValidationUtil; | 21 | import com.topdraw.utils.ValidationUtil; |
12 | import lombok.extern.slf4j.Slf4j; | 22 | import lombok.extern.slf4j.Slf4j; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 23 | import org.springframework.beans.factory.annotation.Autowired; |
... | @@ -34,6 +44,8 @@ public class UserAppServiceImpl implements UserAppService { | ... | @@ -34,6 +44,8 @@ public class UserAppServiceImpl implements UserAppService { |
34 | private UserAppSimpleRepository userAppSimpleRepository; | 44 | private UserAppSimpleRepository userAppSimpleRepository; |
35 | @Autowired | 45 | @Autowired |
36 | private UserAppMapper userAppMapper; | 46 | private UserAppMapper userAppMapper; |
47 | @Autowired | ||
48 | private MemberService memberService; | ||
37 | 49 | ||
38 | 50 | ||
39 | @Override | 51 | @Override |
... | @@ -124,6 +136,31 @@ public class UserAppServiceImpl implements UserAppService { | ... | @@ -124,6 +136,31 @@ public class UserAppServiceImpl implements UserAppService { |
124 | resources.getNickname(), resources.getHeadimgurl()) > 0; | 136 | resources.getNickname(), resources.getHeadimgurl()) > 0; |
125 | } | 137 | } |
126 | 138 | ||
139 | @Transactional(rollbackFor = Exception.class) | ||
140 | public void asyncUpdateAppLastActiveTimeAndNicknameAndHeadImgById(UserApp resources) { | ||
141 | this.userAppRepository.updateAppLastActiveTimeAndNicknameAndHeadImgById(resources); | ||
142 | } | ||
143 | |||
144 | @Override | ||
145 | @Transactional(rollbackFor = Exception.class) | ||
146 | public boolean asyncSaveByIdManual(UserAppIdManual resources) { | ||
147 | String memberCode = resources.getMemberCode(); | ||
148 | |||
149 | Member member = new Member(); | ||
150 | member.setVip(0); | ||
151 | member.setType(MemberTypeConstant.app); | ||
152 | member.setCode(memberCode); | ||
153 | member.setNickname(resources.getNickname()); | ||
154 | member.setAvatarUrl(resources.getHeadimgurl()); | ||
155 | Member _member = MemberBuilder.build(member); | ||
156 | MemberDTO memberDTO = memberService.create(_member); | ||
157 | |||
158 | resources.setMemberId(memberDTO.getId()); | ||
159 | |||
160 | this.userAppRepository.saveByIdManual(resources); | ||
161 | return true; | ||
162 | } | ||
163 | |||
127 | @Override | 164 | @Override |
128 | @Transactional(rollbackFor = Exception.class) | 165 | @Transactional(rollbackFor = Exception.class) |
129 | public boolean updatePasswordById(UserApp resources) { | 166 | public boolean updatePasswordById(UserApp resources) { | ... | ... |
1 | package com.topdraw.business.module.vis.hainan.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.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2022-07-14 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="vis_user") | ||
24 | public class VisUser implements Serializable { | ||
25 | |||
26 | // ID | ||
27 | @Id | ||
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
29 | @Column(name = "id") | ||
30 | private Long id; | ||
31 | |||
32 | // 所有者ID | ||
33 | @Column(name = "person_id") | ||
34 | private Long personId; | ||
35 | |||
36 | // 平台 | ||
37 | @Column(name = "platform") | ||
38 | private String platform; | ||
39 | |||
40 | // 平台账号 | ||
41 | @Column(name = "platform_account") | ||
42 | private String platformAccount; | ||
43 | |||
44 | // 用户名 | ||
45 | @Column(name = "username") | ||
46 | private String username; | ||
47 | |||
48 | // 密码 | ||
49 | @Column(name = "password") | ||
50 | private String password; | ||
51 | |||
52 | // 积分 | ||
53 | @Column(name = "points") | ||
54 | private Integer points; | ||
55 | |||
56 | // 昵称 | ||
57 | @Column(name = "nickname") | ||
58 | private String nickname; | ||
59 | |||
60 | // 真实姓名 | ||
61 | @Column(name = "realname") | ||
62 | private String realname; | ||
63 | |||
64 | // 头像 | ||
65 | @Column(name = "image") | ||
66 | private String image; | ||
67 | |||
68 | // 电子邮件 | ||
69 | @Column(name = "email") | ||
70 | private String email; | ||
71 | |||
72 | // 手机号 | ||
73 | @Column(name = "cellphone") | ||
74 | private String cellphone; | ||
75 | |||
76 | // 0-女 1-男 2-其他 | ||
77 | @Column(name = "gender") | ||
78 | private Integer gender; | ||
79 | |||
80 | // 生日 | ||
81 | @Column(name = "birthday") | ||
82 | private Integer birthday; | ||
83 | |||
84 | // 登录天数(总天数) | ||
85 | @Column(name = "login_days") | ||
86 | private Integer loginDays; | ||
87 | |||
88 | // 连续天数 | ||
89 | @Column(name = "continue_days") | ||
90 | private Integer continueDays; | ||
91 | |||
92 | // 活跃时间 | ||
93 | @Column(name = "active_time") | ||
94 | private Timestamp activeTime; | ||
95 | |||
96 | // 标签 | ||
97 | @Column(name = "tags") | ||
98 | private String tags; | ||
99 | |||
100 | // 登录类型:1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录 | ||
101 | @Column(name = "login_type") | ||
102 | private Integer loginType; | ||
103 | |||
104 | // 用户绑定ID | ||
105 | @Column(name = "vis_user_id") | ||
106 | private Long visUserId; | ||
107 | |||
108 | // 微信绑定ID | ||
109 | @Column(name = "vis_user_weixin_id") | ||
110 | private Long visUserWeixinId; | ||
111 | |||
112 | // QQ绑定ID | ||
113 | @Column(name = "vis_user_qq_id") | ||
114 | private Long visUserQqId; | ||
115 | |||
116 | // 微博绑定ID | ||
117 | @Column(name = "vis_user_weibo_id") | ||
118 | private Long visUserWeiboId; | ||
119 | |||
120 | // 苹果绑定ID | ||
121 | @Column(name = "vis_user_apple_id") | ||
122 | private Long visUserAppleId; | ||
123 | |||
124 | // 状态:默认1-生效 2-失效 | ||
125 | @Column(name = "status") | ||
126 | private Integer status; | ||
127 | |||
128 | // 创建时间 | ||
129 | @CreatedDate | ||
130 | @Column(name = "create_time") | ||
131 | private Timestamp createTime; | ||
132 | |||
133 | // 更新时间 | ||
134 | @LastModifiedDate | ||
135 | @Column(name = "update_time") | ||
136 | private Timestamp updateTime; | ||
137 | |||
138 | public void copy(VisUser source){ | ||
139 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
140 | } | ||
141 | } |
src/main/java/com/topdraw/business/module/vis/hainan/app/repository/VisUserRepository.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.app.repository; | ||
2 | |||
3 | |||
4 | import com.topdraw.business.module.vis.hainan.app.domain.VisUser; | ||
5 | import org.springframework.data.jpa.repository.JpaRepository; | ||
6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
7 | |||
8 | /** | ||
9 | * @author XiangHan | ||
10 | * @date 2022-07-14 | ||
11 | */ | ||
12 | public interface VisUserRepository extends JpaRepository<VisUser, Long>, JpaSpecificationExecutor<VisUser> { | ||
13 | |||
14 | } |
1 | package com.topdraw.business.module.vis.hainan.app.service; | ||
2 | |||
3 | import com.topdraw.business.module.vis.hainan.app.domain.VisUser; | ||
4 | import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO; | ||
5 | |||
6 | /** | ||
7 | * @author XiangHan | ||
8 | * @date 2022-07-14 | ||
9 | */ | ||
10 | public interface VisUserService { | ||
11 | |||
12 | /** | ||
13 | * 根据ID查询 | ||
14 | * @param id ID | ||
15 | * @return UserDTO | ||
16 | */ | ||
17 | VisUserDTO findById(Long id); | ||
18 | |||
19 | void create(VisUser resources); | ||
20 | |||
21 | void update(VisUser resources); | ||
22 | |||
23 | void delete(Long id); | ||
24 | |||
25 | } |
1 | package com.topdraw.business.module.vis.hainan.app.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | import java.io.Serializable; | ||
6 | import java.sql.Timestamp; | ||
7 | |||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | @Data | ||
14 | public class VisUserDTO implements Serializable { | ||
15 | |||
16 | // ID | ||
17 | private Long id; | ||
18 | |||
19 | // 所有者ID | ||
20 | private Long personId; | ||
21 | |||
22 | // 平台 | ||
23 | private String platform; | ||
24 | |||
25 | // 平台账号 | ||
26 | private String platformAccount; | ||
27 | |||
28 | // 用户名 | ||
29 | private String username; | ||
30 | |||
31 | // 密码 | ||
32 | private String password; | ||
33 | |||
34 | // 积分 | ||
35 | private Integer points; | ||
36 | |||
37 | // 昵称 | ||
38 | private String nickname; | ||
39 | |||
40 | // 真实姓名 | ||
41 | private String realname; | ||
42 | |||
43 | // 头像 | ||
44 | private String image; | ||
45 | |||
46 | // 电子邮件 | ||
47 | private String email; | ||
48 | |||
49 | // 手机号 | ||
50 | private String cellphone; | ||
51 | |||
52 | // 0-女 1-男 2-其他 | ||
53 | private Integer gender; | ||
54 | |||
55 | // 生日 | ||
56 | private Integer birthday; | ||
57 | |||
58 | // 登录天数(总天数) | ||
59 | private Integer loginDays; | ||
60 | |||
61 | // 连续天数 | ||
62 | private Integer continueDays; | ||
63 | |||
64 | // 活跃时间 | ||
65 | private Timestamp activeTime; | ||
66 | |||
67 | // 标签 | ||
68 | private String tags; | ||
69 | |||
70 | // 登录类型:1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录 | ||
71 | private Integer loginType; | ||
72 | |||
73 | // 用户绑定ID | ||
74 | private Long visUserId; | ||
75 | |||
76 | // 微信绑定ID | ||
77 | private Long visUserWeixinId; | ||
78 | |||
79 | // QQ绑定ID | ||
80 | private Long visUserQqId; | ||
81 | |||
82 | // 微博绑定ID | ||
83 | private Long visUserWeiboId; | ||
84 | |||
85 | // 苹果绑定ID | ||
86 | private Long visUserAppleId; | ||
87 | |||
88 | // 状态:默认1-生效 2-失效 | ||
89 | private Integer status; | ||
90 | |||
91 | // 创建时间 | ||
92 | private Timestamp createTime; | ||
93 | |||
94 | // 更新时间 | ||
95 | private Timestamp updateTime; | ||
96 | } |
src/main/java/com/topdraw/business/module/vis/hainan/app/service/impl/VisUserServiceImpl.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.app.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.vis.hainan.app.domain.VisUser; | ||
4 | import com.topdraw.business.module.vis.hainan.app.repository.VisUserRepository; | ||
5 | import com.topdraw.business.module.vis.hainan.app.service.VisUserService; | ||
6 | import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO; | ||
7 | import com.topdraw.business.module.vis.hainan.app.service.mapper.VisUserMapper; | ||
8 | import com.topdraw.utils.ValidationUtil; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
11 | import org.springframework.stereotype.Service; | ||
12 | import org.springframework.transaction.annotation.Propagation; | ||
13 | import org.springframework.transaction.annotation.Transactional; | ||
14 | import org.springframework.util.Assert; | ||
15 | |||
16 | /** | ||
17 | * @author XiangHan | ||
18 | * @date 2022-07-14 | ||
19 | */ | ||
20 | @Service | ||
21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
22 | public class VisUserServiceImpl implements VisUserService { | ||
23 | |||
24 | @Autowired | ||
25 | private VisUserRepository visUserRepository; | ||
26 | |||
27 | @Autowired | ||
28 | private VisUserMapper visUserMapper; | ||
29 | |||
30 | @Override | ||
31 | public VisUserDTO findById(Long id) { | ||
32 | VisUser visUser = visUserRepository.findById(id).orElseGet(VisUser::new); | ||
33 | ValidationUtil.isNull(visUser.getId(),"User","id",id); | ||
34 | return visUserMapper.toDto(visUser); | ||
35 | } | ||
36 | |||
37 | @Override | ||
38 | @Transactional(rollbackFor = Exception.class) | ||
39 | public void create(VisUser resources) { | ||
40 | visUserRepository.save(resources); | ||
41 | } | ||
42 | |||
43 | @Override | ||
44 | @Transactional(rollbackFor = Exception.class) | ||
45 | public void update(VisUser resources) { | ||
46 | VisUser User = visUserRepository.findById(resources.getId()).orElseGet(VisUser::new); | ||
47 | ValidationUtil.isNull( User.getId(),"User","id",resources.getId()); | ||
48 | User.copy(resources); | ||
49 | visUserRepository.save(User); | ||
50 | } | ||
51 | |||
52 | @Override | ||
53 | @Transactional(rollbackFor = Exception.class) | ||
54 | public void delete(Long id) { | ||
55 | Assert.notNull(id, "The given id must not be null!"); | ||
56 | VisUser User = visUserRepository.findById(id).orElseThrow( | ||
57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUser.class, id), 1)); | ||
58 | visUserRepository.delete(User); | ||
59 | } | ||
60 | |||
61 | |||
62 | } |
src/main/java/com/topdraw/business/module/vis/hainan/app/service/mapper/VisUserMapper.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.app.service.mapper; | ||
2 | |||
3 | import com.topdraw.base.BaseMapper; | ||
4 | import com.topdraw.business.module.vis.hainan.app.domain.VisUser; | ||
5 | import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO; | ||
6 | import org.mapstruct.Mapper; | ||
7 | import org.mapstruct.ReportingPolicy; | ||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
14 | public interface VisUserMapper extends BaseMapper<VisUserDTO, VisUser> { | ||
15 | |||
16 | } |
1 | package com.topdraw.business.module.vis.hainan.apple.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.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2022-07-14 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="vis_user_apple") | ||
24 | public class VisUserApple implements Serializable { | ||
25 | |||
26 | |||
27 | @Transient | ||
28 | private String username; | ||
29 | @Transient | ||
30 | private Integer type; | ||
31 | |||
32 | // ID | ||
33 | @Id | ||
34 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
35 | @Column(name = "id") | ||
36 | private Long id; | ||
37 | |||
38 | // 所有者ID | ||
39 | @Column(name = "person_id") | ||
40 | private Long personId; | ||
41 | |||
42 | // 用户ID | ||
43 | @Column(name = "vis_user_id") | ||
44 | private Long visUserId; | ||
45 | |||
46 | // 苹果用户ID | ||
47 | @Column(name = "user") | ||
48 | private String user; | ||
49 | |||
50 | @Column(name = "identity_token") | ||
51 | private String identityToken; | ||
52 | |||
53 | @Column(name = "real_user_status") | ||
54 | private String realUserStatus; | ||
55 | |||
56 | @Column(name = "authorized_scopes") | ||
57 | private String authorizedScopes; | ||
58 | |||
59 | @Column(name = "authorization_code") | ||
60 | private String authorizationCode; | ||
61 | |||
62 | // 状态 0-失效 1-有效 | ||
63 | @Column(name = "status") | ||
64 | private Integer status; | ||
65 | |||
66 | // 全名 | ||
67 | @Column(name = "full_name") | ||
68 | private String fullName; | ||
69 | |||
70 | // E-main | ||
71 | @Column(name = "email") | ||
72 | private String email; | ||
73 | |||
74 | // 昵称 | ||
75 | @Column(name = "nickname") | ||
76 | private String nickname; | ||
77 | |||
78 | // 性别 | ||
79 | @Column(name = "sex") | ||
80 | private Integer sex; | ||
81 | |||
82 | // 国家 | ||
83 | @Column(name = "country") | ||
84 | private String country; | ||
85 | |||
86 | // 省份 | ||
87 | @Column(name = "province") | ||
88 | private String province; | ||
89 | |||
90 | // 城市 | ||
91 | @Column(name = "city") | ||
92 | private String city; | ||
93 | |||
94 | // 头像地址 | ||
95 | @Column(name = "icon") | ||
96 | private String icon; | ||
97 | |||
98 | // 描述 | ||
99 | @Column(name = "description") | ||
100 | private String description; | ||
101 | |||
102 | // 创建时间 | ||
103 | @CreatedDate | ||
104 | @Column(name = "create_time") | ||
105 | private Timestamp createTime; | ||
106 | |||
107 | // 更新时间 | ||
108 | @LastModifiedDate | ||
109 | @Column(name = "update_time") | ||
110 | private Timestamp updateTime; | ||
111 | |||
112 | public void copy(VisUserApple source){ | ||
113 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
114 | } | ||
115 | } |
src/main/java/com/topdraw/business/module/vis/hainan/apple/repository/VisUserAppleRepository.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.apple.repository; | ||
2 | |||
3 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | |||
7 | /** | ||
8 | * @author XiangHan | ||
9 | * @date 2022-07-14 | ||
10 | */ | ||
11 | public interface VisUserAppleRepository extends JpaRepository<VisUserApple, Long>, JpaSpecificationExecutor<VisUserApple> { | ||
12 | |||
13 | } |
src/main/java/com/topdraw/business/module/vis/hainan/apple/service/VisUserAppleService.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.apple.service; | ||
2 | |||
3 | |||
4 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
5 | import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO; | ||
6 | |||
7 | /** | ||
8 | * @author XiangHan | ||
9 | * @date 2022-07-14 | ||
10 | */ | ||
11 | public interface VisUserAppleService { | ||
12 | |||
13 | /** | ||
14 | * 根据ID查询 | ||
15 | * @param id ID | ||
16 | * @return VisUserAppleDTO | ||
17 | */ | ||
18 | VisUserAppleDTO findById(Long id); | ||
19 | |||
20 | void create(VisUserApple resources); | ||
21 | |||
22 | void update(VisUserApple resources); | ||
23 | |||
24 | void delete(Long id); | ||
25 | |||
26 | } |
src/main/java/com/topdraw/business/module/vis/hainan/apple/service/dto/VisUserAppleDTO.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.apple.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | import java.io.Serializable; | ||
6 | import java.sql.Timestamp; | ||
7 | |||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | @Data | ||
14 | public class VisUserAppleDTO implements Serializable { | ||
15 | |||
16 | // ID | ||
17 | private Long id; | ||
18 | |||
19 | // 所有者ID | ||
20 | private Long personId; | ||
21 | |||
22 | // 用户ID | ||
23 | private Long visUserId; | ||
24 | |||
25 | // 苹果用户ID | ||
26 | private String user; | ||
27 | |||
28 | private String identityToken; | ||
29 | |||
30 | private String realUserStatus; | ||
31 | |||
32 | private String authorizedScopes; | ||
33 | |||
34 | private String authorizationCode; | ||
35 | |||
36 | // 状态 0-失效 1-有效 | ||
37 | private Integer status; | ||
38 | |||
39 | // 全名 | ||
40 | private String fullName; | ||
41 | |||
42 | // E-main | ||
43 | private String email; | ||
44 | |||
45 | // 昵称 | ||
46 | private String nickname; | ||
47 | |||
48 | // 性别 | ||
49 | private Integer sex; | ||
50 | |||
51 | // 国家 | ||
52 | private String country; | ||
53 | |||
54 | // 省份 | ||
55 | private String province; | ||
56 | |||
57 | // 城市 | ||
58 | private String city; | ||
59 | |||
60 | // 头像地址 | ||
61 | private String icon; | ||
62 | |||
63 | // 描述 | ||
64 | private String description; | ||
65 | |||
66 | // 创建时间 | ||
67 | private Timestamp createTime; | ||
68 | |||
69 | // 更新时间 | ||
70 | private Timestamp updateTime; | ||
71 | } |
src/main/java/com/topdraw/business/module/vis/hainan/apple/service/impl/VisUserAppleServiceImpl.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.apple.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
4 | import com.topdraw.business.module.vis.hainan.apple.repository.VisUserAppleRepository; | ||
5 | import com.topdraw.business.module.vis.hainan.apple.service.VisUserAppleService; | ||
6 | import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO; | ||
7 | import com.topdraw.business.module.vis.hainan.apple.service.mapper.VisUserAppleMapper; | ||
8 | import com.topdraw.utils.ValidationUtil; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
11 | import org.springframework.stereotype.Service; | ||
12 | import org.springframework.transaction.annotation.Propagation; | ||
13 | import org.springframework.transaction.annotation.Transactional; | ||
14 | import org.springframework.util.Assert; | ||
15 | |||
16 | /** | ||
17 | * @author XiangHan | ||
18 | * @date 2022-07-14 | ||
19 | */ | ||
20 | @Service | ||
21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
22 | public class VisUserAppleServiceImpl implements VisUserAppleService { | ||
23 | |||
24 | @Autowired | ||
25 | private VisUserAppleRepository visUserAppleRepository; | ||
26 | |||
27 | @Autowired | ||
28 | private VisUserAppleMapper visUserAppleMapper; | ||
29 | |||
30 | @Override | ||
31 | public VisUserAppleDTO findById(Long id) { | ||
32 | VisUserApple visUserApple = visUserAppleRepository.findById(id).orElseGet(VisUserApple::new); | ||
33 | ValidationUtil.isNull(visUserApple.getId(),"VisUserApple","id",id); | ||
34 | return visUserAppleMapper.toDto(visUserApple); | ||
35 | } | ||
36 | |||
37 | @Override | ||
38 | @Transactional(rollbackFor = Exception.class) | ||
39 | public void create(VisUserApple resources) { | ||
40 | visUserAppleRepository.save(resources); | ||
41 | } | ||
42 | |||
43 | @Override | ||
44 | @Transactional(rollbackFor = Exception.class) | ||
45 | public void update(VisUserApple resources) { | ||
46 | VisUserApple visUserApple = visUserAppleRepository.findById(resources.getId()).orElseGet(VisUserApple::new); | ||
47 | ValidationUtil.isNull( visUserApple.getId(),"VisUserApple","id",resources.getId()); | ||
48 | visUserApple.copy(resources); | ||
49 | visUserAppleRepository.save(visUserApple); | ||
50 | } | ||
51 | |||
52 | @Override | ||
53 | @Transactional(rollbackFor = Exception.class) | ||
54 | public void delete(Long id) { | ||
55 | Assert.notNull(id, "The given id must not be null!"); | ||
56 | VisUserApple visUserApple = visUserAppleRepository.findById(id).orElseThrow( | ||
57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserApple.class, id), 1)); | ||
58 | visUserAppleRepository.delete(visUserApple); | ||
59 | } | ||
60 | |||
61 | |||
62 | } |
src/main/java/com/topdraw/business/module/vis/hainan/apple/service/mapper/VisUserAppleMapper.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.apple.service.mapper; | ||
2 | |||
3 | import com.topdraw.base.BaseMapper; | ||
4 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
5 | import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO; | ||
6 | import org.mapstruct.Mapper; | ||
7 | import org.mapstruct.ReportingPolicy; | ||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
14 | public interface VisUserAppleMapper extends BaseMapper<VisUserAppleDTO, VisUserApple> { | ||
15 | |||
16 | } |
1 | package com.topdraw.business.module.vis.hainan.qq.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.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2022-07-14 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="vis_user_qq") | ||
24 | public class VisUserQq implements Serializable { | ||
25 | @Transient | ||
26 | private String username; | ||
27 | @Transient | ||
28 | private Integer type; | ||
29 | // ID | ||
30 | @Id | ||
31 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
32 | @Column(name = "id") | ||
33 | private Long id; | ||
34 | |||
35 | // 所有者ID | ||
36 | @Column(name = "person_id") | ||
37 | private Long personId; | ||
38 | |||
39 | // 用户ID | ||
40 | @Column(name = "vis_user_id") | ||
41 | private Long visUserId; | ||
42 | |||
43 | // QQunionid,针对开发者 | ||
44 | @Column(name = "unionid") | ||
45 | private String unionid; | ||
46 | |||
47 | // QQappid | ||
48 | @Column(name = "app_id") | ||
49 | private String appId; | ||
50 | |||
51 | // QQopenid | ||
52 | @Column(name = "openid") | ||
53 | private String openid; | ||
54 | |||
55 | // QQuserid | ||
56 | @Column(name = "user_id") | ||
57 | private String userId; | ||
58 | |||
59 | // 状态 0-失效 1-有效 | ||
60 | @Column(name = "status") | ||
61 | private Integer status; | ||
62 | |||
63 | // 昵称 | ||
64 | @Column(name = "nickname") | ||
65 | private String nickname; | ||
66 | |||
67 | // 性别 | ||
68 | @Column(name = "sex") | ||
69 | private Integer sex; | ||
70 | |||
71 | // 国家 | ||
72 | @Column(name = "country") | ||
73 | private String country; | ||
74 | |||
75 | // 省份 | ||
76 | @Column(name = "province") | ||
77 | private String province; | ||
78 | |||
79 | // 城市 | ||
80 | @Column(name = "city") | ||
81 | private String city; | ||
82 | |||
83 | // 头像地址 | ||
84 | @Column(name = "icon") | ||
85 | private String icon; | ||
86 | |||
87 | @Column(name = "pay_token") | ||
88 | private String payToken; | ||
89 | |||
90 | @Column(name = "secretType") | ||
91 | private String secretType; | ||
92 | |||
93 | @Column(name = "secret") | ||
94 | private String secret; | ||
95 | |||
96 | @Column(name = "pfkey") | ||
97 | private String pfkey; | ||
98 | |||
99 | @Column(name = "pf") | ||
100 | private String pf; | ||
101 | |||
102 | // access_token | ||
103 | @Column(name = "access_token") | ||
104 | private String accessToken; | ||
105 | |||
106 | // expires_in | ||
107 | @Column(name = "expires_in") | ||
108 | private Integer expiresIn; | ||
109 | |||
110 | // expires_time | ||
111 | @Column(name = "expires_time") | ||
112 | private Timestamp expiresTime; | ||
113 | |||
114 | // 描述 | ||
115 | @Column(name = "description") | ||
116 | private String description; | ||
117 | |||
118 | // 创建时间 | ||
119 | @CreatedDate | ||
120 | @Column(name = "create_time") | ||
121 | private Timestamp createTime; | ||
122 | |||
123 | // 更新时间 | ||
124 | @LastModifiedDate | ||
125 | @Column(name = "update_time") | ||
126 | private Timestamp updateTime; | ||
127 | |||
128 | public void copy(VisUserQq source){ | ||
129 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
130 | } | ||
131 | } |
src/main/java/com/topdraw/business/module/vis/hainan/qq/repository/VisUserQqRepository.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.qq.repository; | ||
2 | |||
3 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | |||
7 | /** | ||
8 | * @author XiangHan | ||
9 | * @date 2022-07-14 | ||
10 | */ | ||
11 | public interface VisUserQqRepository extends JpaRepository<VisUserQq, Long>, JpaSpecificationExecutor<VisUserQq> { | ||
12 | |||
13 | } |
1 | package com.topdraw.business.module.vis.hainan.qq.service; | ||
2 | |||
3 | |||
4 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
5 | import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO; | ||
6 | |||
7 | /** | ||
8 | * @author XiangHan | ||
9 | * @date 2022-07-14 | ||
10 | */ | ||
11 | public interface VisUserQqService { | ||
12 | |||
13 | /** | ||
14 | * 根据ID查询 | ||
15 | * @param id ID | ||
16 | * @return VisUserQqDTO | ||
17 | */ | ||
18 | VisUserQqDTO findById(Long id); | ||
19 | |||
20 | void create(VisUserQq resources); | ||
21 | |||
22 | void update(VisUserQq resources); | ||
23 | |||
24 | void delete(Long id); | ||
25 | |||
26 | VisUserQqDTO findByOpenid(String account); | ||
27 | } |
1 | package com.topdraw.business.module.vis.hainan.qq.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | import java.io.Serializable; | ||
6 | import java.sql.Timestamp; | ||
7 | |||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | @Data | ||
14 | public class VisUserQqDTO implements Serializable { | ||
15 | |||
16 | // ID | ||
17 | private Long id; | ||
18 | |||
19 | // 所有者ID | ||
20 | private Long personId; | ||
21 | |||
22 | // 用户ID | ||
23 | private Long visUserId; | ||
24 | |||
25 | // QQunionid,针对开发者 | ||
26 | private String unionid; | ||
27 | |||
28 | // QQappid | ||
29 | private String appId; | ||
30 | |||
31 | // QQopenid | ||
32 | private String openid; | ||
33 | |||
34 | // QQuserid | ||
35 | private String userId; | ||
36 | |||
37 | // 状态 0-失效 1-有效 | ||
38 | private Integer status; | ||
39 | |||
40 | // 昵称 | ||
41 | private String nickname; | ||
42 | |||
43 | // 性别 | ||
44 | private Integer sex; | ||
45 | |||
46 | // 国家 | ||
47 | private String country; | ||
48 | |||
49 | // 省份 | ||
50 | private String province; | ||
51 | |||
52 | // 城市 | ||
53 | private String city; | ||
54 | |||
55 | // 头像地址 | ||
56 | private String icon; | ||
57 | |||
58 | private String payToken; | ||
59 | |||
60 | private String secretType; | ||
61 | |||
62 | private String secret; | ||
63 | |||
64 | private String pfkey; | ||
65 | |||
66 | private String pf; | ||
67 | |||
68 | // access_token | ||
69 | private String accessToken; | ||
70 | |||
71 | // expires_in | ||
72 | private Integer expiresIn; | ||
73 | |||
74 | // expires_time | ||
75 | private Timestamp expiresTime; | ||
76 | |||
77 | // 描述 | ||
78 | private String description; | ||
79 | |||
80 | // 创建时间 | ||
81 | private Timestamp createTime; | ||
82 | |||
83 | // 更新时间 | ||
84 | private Timestamp updateTime; | ||
85 | } |
src/main/java/com/topdraw/business/module/vis/hainan/qq/service/impl/VisUserQqServiceImpl.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.qq.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
4 | import com.topdraw.business.module.vis.hainan.qq.repository.VisUserQqRepository; | ||
5 | import com.topdraw.business.module.vis.hainan.qq.service.VisUserQqService; | ||
6 | import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO; | ||
7 | import com.topdraw.business.module.vis.hainan.qq.service.mapper.VisUserQqMapper; | ||
8 | import com.topdraw.utils.ValidationUtil; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
11 | import org.springframework.stereotype.Service; | ||
12 | import org.springframework.transaction.annotation.Propagation; | ||
13 | import org.springframework.transaction.annotation.Transactional; | ||
14 | import org.springframework.util.Assert; | ||
15 | |||
16 | /** | ||
17 | * @author XiangHan | ||
18 | * @date 2022-07-14 | ||
19 | */ | ||
20 | @Service | ||
21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
22 | public class VisUserQqServiceImpl implements VisUserQqService { | ||
23 | |||
24 | @Autowired | ||
25 | private VisUserQqRepository visUserQqRepository; | ||
26 | |||
27 | @Autowired | ||
28 | private VisUserQqMapper visUserQqMapper; | ||
29 | |||
30 | @Override | ||
31 | public VisUserQqDTO findById(Long id) { | ||
32 | VisUserQq visUserQq = visUserQqRepository.findById(id).orElseGet(VisUserQq::new); | ||
33 | ValidationUtil.isNull(visUserQq.getId(),"VisUserQq","id",id); | ||
34 | return visUserQqMapper.toDto(visUserQq); | ||
35 | } | ||
36 | |||
37 | @Override | ||
38 | @Transactional(rollbackFor = Exception.class) | ||
39 | public void create(VisUserQq resources) { | ||
40 | visUserQqRepository.save(resources); | ||
41 | } | ||
42 | |||
43 | @Override | ||
44 | @Transactional(rollbackFor = Exception.class) | ||
45 | public void update(VisUserQq resources) { | ||
46 | VisUserQq visUserQq = visUserQqRepository.findById(resources.getId()).orElseGet(VisUserQq::new); | ||
47 | ValidationUtil.isNull( visUserQq.getId(),"VisUserQq","id",resources.getId()); | ||
48 | visUserQq.copy(resources); | ||
49 | visUserQqRepository.save(visUserQq); | ||
50 | } | ||
51 | |||
52 | @Override | ||
53 | @Transactional(rollbackFor = Exception.class) | ||
54 | public void delete(Long id) { | ||
55 | Assert.notNull(id, "The given id must not be null!"); | ||
56 | VisUserQq visUserQq = visUserQqRepository.findById(id).orElseThrow( | ||
57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserQq.class, id), 1)); | ||
58 | visUserQqRepository.delete(visUserQq); | ||
59 | } | ||
60 | |||
61 | @Override | ||
62 | public VisUserQqDTO findByOpenid(String account) { | ||
63 | return null; | ||
64 | } | ||
65 | |||
66 | |||
67 | } |
src/main/java/com/topdraw/business/module/vis/hainan/qq/service/mapper/VisUserQqMapper.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.qq.service.mapper; | ||
2 | |||
3 | import com.topdraw.base.BaseMapper; | ||
4 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
5 | import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO; | ||
6 | import org.mapstruct.Mapper; | ||
7 | import org.mapstruct.ReportingPolicy; | ||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
14 | public interface VisUserQqMapper extends BaseMapper<VisUserQqDTO, VisUserQq> { | ||
15 | |||
16 | } |
1 | package com.topdraw.business.module.vis.hainan.weibo.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.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2022-07-14 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="vis_user_weibo") | ||
24 | public class VisUserWeibo implements Serializable { | ||
25 | @Transient | ||
26 | private String username; | ||
27 | @Transient | ||
28 | private Integer type; | ||
29 | // ID | ||
30 | @Id | ||
31 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
32 | @Column(name = "id") | ||
33 | private Long id; | ||
34 | |||
35 | // 所有者ID | ||
36 | @Column(name = "person_id") | ||
37 | private Long personId; | ||
38 | |||
39 | // 用户ID | ||
40 | @Column(name = "vis_user_id") | ||
41 | private Long visUserId; | ||
42 | |||
43 | // 微博appid | ||
44 | @Column(name = "app_id") | ||
45 | private String appId; | ||
46 | |||
47 | // 微博用户ID | ||
48 | @Column(name = "user_id") | ||
49 | private String userId; | ||
50 | |||
51 | // 状态 0-失效 1-有效 | ||
52 | @Column(name = "status") | ||
53 | private Integer status; | ||
54 | |||
55 | // 昵称 | ||
56 | @Column(name = "nickname") | ||
57 | private String nickname; | ||
58 | |||
59 | // 性别 | ||
60 | @Column(name = "sex") | ||
61 | private Integer sex; | ||
62 | |||
63 | // 国家 | ||
64 | @Column(name = "country") | ||
65 | private String country; | ||
66 | |||
67 | // 省份 | ||
68 | @Column(name = "province") | ||
69 | private String province; | ||
70 | |||
71 | // 城市 | ||
72 | @Column(name = "city") | ||
73 | private String city; | ||
74 | |||
75 | // 头像地址 | ||
76 | @Column(name = "icon") | ||
77 | private String icon; | ||
78 | |||
79 | // secretType | ||
80 | @Column(name = "secretType") | ||
81 | private String secretType; | ||
82 | |||
83 | // secret | ||
84 | @Column(name = "secret") | ||
85 | private String secret; | ||
86 | |||
87 | // snsregat | ||
88 | @Column(name = "snsregat") | ||
89 | private String snsregat; | ||
90 | |||
91 | // snsUserUrl | ||
92 | @Column(name = "snsUserUrl") | ||
93 | private String snsUserUrl; | ||
94 | |||
95 | // shareCount | ||
96 | @Column(name = "shareCount") | ||
97 | private String shareCount; | ||
98 | |||
99 | // followerCount | ||
100 | @Column(name = "followerCount") | ||
101 | private String followerCount; | ||
102 | |||
103 | // refresh_token | ||
104 | @Column(name = "refresh_token") | ||
105 | private String refreshToken; | ||
106 | |||
107 | // access_token | ||
108 | @Column(name = "access_token") | ||
109 | private String accessToken; | ||
110 | |||
111 | // expires_in | ||
112 | @Column(name = "expires_in") | ||
113 | private Long expiresIn; | ||
114 | |||
115 | // expires_time | ||
116 | @Column(name = "expires_time") | ||
117 | private Timestamp expiresTime; | ||
118 | |||
119 | // 描述 | ||
120 | @Column(name = "description") | ||
121 | private String description; | ||
122 | |||
123 | // 创建时间 | ||
124 | @CreatedDate | ||
125 | @Column(name = "create_time") | ||
126 | private Timestamp createTime; | ||
127 | |||
128 | // 更新时间 | ||
129 | @LastModifiedDate | ||
130 | @Column(name = "update_time") | ||
131 | private Timestamp updateTime; | ||
132 | |||
133 | public void copy(VisUserWeibo source){ | ||
134 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
135 | } | ||
136 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weibo/repository/VisUserWeiboRepository.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.weibo.repository; | ||
2 | |||
3 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | |||
7 | /** | ||
8 | * @author XiangHan | ||
9 | * @date 2022-07-14 | ||
10 | */ | ||
11 | public interface VisUserWeiboRepository extends JpaRepository<VisUserWeibo, Long>, JpaSpecificationExecutor<VisUserWeibo> { | ||
12 | |||
13 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weibo/service/VisUserWeiboService.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.weibo.service; | ||
2 | |||
3 | |||
4 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
5 | import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO; | ||
6 | |||
7 | /** | ||
8 | * @author XiangHan | ||
9 | * @date 2022-07-14 | ||
10 | */ | ||
11 | public interface VisUserWeiboService { | ||
12 | |||
13 | /** | ||
14 | * 根据ID查询 | ||
15 | * @param id ID | ||
16 | * @return VisUserWeiboDTO | ||
17 | */ | ||
18 | VisUserWeiboDTO findById(Long id); | ||
19 | |||
20 | void create(VisUserWeibo resources); | ||
21 | |||
22 | void update(VisUserWeibo resources); | ||
23 | |||
24 | void delete(Long id); | ||
25 | |||
26 | VisUserWeiboDTO findByUserid(String account); | ||
27 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weibo/service/dto/VisUserWeiboDTO.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.weibo.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | import java.io.Serializable; | ||
6 | import java.sql.Timestamp; | ||
7 | |||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | @Data | ||
14 | public class VisUserWeiboDTO implements Serializable { | ||
15 | |||
16 | // ID | ||
17 | private Long id; | ||
18 | |||
19 | // 所有者ID | ||
20 | private Long personId; | ||
21 | |||
22 | // 用户ID | ||
23 | private Long visUserId; | ||
24 | |||
25 | // 微博appid | ||
26 | private String appId; | ||
27 | |||
28 | // 微博用户ID | ||
29 | private String userId; | ||
30 | |||
31 | // 状态 0-失效 1-有效 | ||
32 | private Integer status; | ||
33 | |||
34 | // 昵称 | ||
35 | private String nickname; | ||
36 | |||
37 | // 性别 | ||
38 | private Integer sex; | ||
39 | |||
40 | // 国家 | ||
41 | private String country; | ||
42 | |||
43 | // 省份 | ||
44 | private String province; | ||
45 | |||
46 | // 城市 | ||
47 | private String city; | ||
48 | |||
49 | // 头像地址 | ||
50 | private String icon; | ||
51 | |||
52 | // secretType | ||
53 | private String secretType; | ||
54 | |||
55 | // secret | ||
56 | private String secret; | ||
57 | |||
58 | // snsregat | ||
59 | private String snsregat; | ||
60 | |||
61 | // snsUserUrl | ||
62 | private String snsUserUrl; | ||
63 | |||
64 | // shareCount | ||
65 | private String shareCount; | ||
66 | |||
67 | // followerCount | ||
68 | private String followerCount; | ||
69 | |||
70 | // refresh_token | ||
71 | private String refreshToken; | ||
72 | |||
73 | // access_token | ||
74 | private String accessToken; | ||
75 | |||
76 | // expires_in | ||
77 | private Long expiresIn; | ||
78 | |||
79 | // expires_time | ||
80 | private Timestamp expiresTime; | ||
81 | |||
82 | // 描述 | ||
83 | private String description; | ||
84 | |||
85 | // 创建时间 | ||
86 | private Timestamp createTime; | ||
87 | |||
88 | // 更新时间 | ||
89 | private Timestamp updateTime; | ||
90 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weibo/service/impl/VisUserWeiboServiceImpl.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.weibo.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
4 | import com.topdraw.business.module.vis.hainan.weibo.repository.VisUserWeiboRepository; | ||
5 | import com.topdraw.business.module.vis.hainan.weibo.service.VisUserWeiboService; | ||
6 | import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO; | ||
7 | import com.topdraw.business.module.vis.hainan.weibo.service.mapper.VisUserWeiboMapper; | ||
8 | import com.topdraw.utils.ValidationUtil; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
11 | import org.springframework.stereotype.Service; | ||
12 | import org.springframework.transaction.annotation.Propagation; | ||
13 | import org.springframework.transaction.annotation.Transactional; | ||
14 | import org.springframework.util.Assert; | ||
15 | |||
16 | /** | ||
17 | * @author XiangHan | ||
18 | * @date 2022-07-14 | ||
19 | */ | ||
20 | @Service | ||
21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
22 | public class VisUserWeiboServiceImpl implements VisUserWeiboService { | ||
23 | |||
24 | @Autowired | ||
25 | private VisUserWeiboRepository visUserWeiboRepository; | ||
26 | |||
27 | @Autowired | ||
28 | private VisUserWeiboMapper visUserWeiboMapper; | ||
29 | |||
30 | @Override | ||
31 | public VisUserWeiboDTO findById(Long id) { | ||
32 | VisUserWeibo visUserWeibo = visUserWeiboRepository.findById(id).orElseGet(VisUserWeibo::new); | ||
33 | ValidationUtil.isNull(visUserWeibo.getId(),"VisUserWeibo","id",id); | ||
34 | return visUserWeiboMapper.toDto(visUserWeibo); | ||
35 | } | ||
36 | |||
37 | @Override | ||
38 | @Transactional(rollbackFor = Exception.class) | ||
39 | public void create(VisUserWeibo resources) { | ||
40 | visUserWeiboRepository.save(resources); | ||
41 | } | ||
42 | |||
43 | @Override | ||
44 | @Transactional(rollbackFor = Exception.class) | ||
45 | public void update(VisUserWeibo resources) { | ||
46 | VisUserWeibo visUserWeibo = visUserWeiboRepository.findById(resources.getId()).orElseGet(VisUserWeibo::new); | ||
47 | ValidationUtil.isNull( visUserWeibo.getId(),"VisUserWeibo","id",resources.getId()); | ||
48 | visUserWeibo.copy(resources); | ||
49 | visUserWeiboRepository.save(visUserWeibo); | ||
50 | } | ||
51 | |||
52 | @Override | ||
53 | @Transactional(rollbackFor = Exception.class) | ||
54 | public void delete(Long id) { | ||
55 | Assert.notNull(id, "The given id must not be null!"); | ||
56 | VisUserWeibo visUserWeibo = visUserWeiboRepository.findById(id).orElseThrow( | ||
57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserWeibo.class, id), 1)); | ||
58 | visUserWeiboRepository.delete(visUserWeibo); | ||
59 | } | ||
60 | |||
61 | @Override | ||
62 | public VisUserWeiboDTO findByUserid(String account) { | ||
63 | return null; | ||
64 | } | ||
65 | |||
66 | |||
67 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weibo/service/mapper/VisUserWeiboMapper.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.weibo.service.mapper; | ||
2 | |||
3 | import com.topdraw.base.BaseMapper; | ||
4 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
5 | import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO; | ||
6 | import org.mapstruct.Mapper; | ||
7 | import org.mapstruct.ReportingPolicy; | ||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
14 | public interface VisUserWeiboMapper extends BaseMapper<VisUserWeiboDTO, VisUserWeibo> { | ||
15 | |||
16 | } |
1 | package com.topdraw.business.module.vis.hainan.weixin.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.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2022-07-14 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="vis_user_weixin") | ||
24 | public class VisUserWeixin implements Serializable { | ||
25 | |||
26 | |||
27 | @Transient | ||
28 | private String username; | ||
29 | @Transient | ||
30 | private Integer type; | ||
31 | |||
32 | // ID | ||
33 | @Id | ||
34 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
35 | @Column(name = "id") | ||
36 | private Long id; | ||
37 | |||
38 | // 所有者ID | ||
39 | @Column(name = "person_id") | ||
40 | private Long personId; | ||
41 | |||
42 | // 用户ID | ||
43 | @Column(name = "vis_user_id") | ||
44 | private Long visUserId; | ||
45 | |||
46 | // 微信unionid,针对开发者 | ||
47 | @Column(name = "unionid") | ||
48 | private String unionid; | ||
49 | |||
50 | // 微信appid | ||
51 | @Column(name = "appid") | ||
52 | private String appid; | ||
53 | |||
54 | // 微信appid | ||
55 | @Column(name = "app_id") | ||
56 | private String appId; | ||
57 | |||
58 | // 微信openid,针对微信app | ||
59 | @Column(name = "openid") | ||
60 | private String openid; | ||
61 | |||
62 | // 状态 0-失效 1-有效 | ||
63 | @Column(name = "status") | ||
64 | private Integer status; | ||
65 | |||
66 | // 昵称 | ||
67 | @Column(name = "nickname") | ||
68 | private String nickname; | ||
69 | |||
70 | // 性别 | ||
71 | @Column(name = "sex") | ||
72 | private Integer sex; | ||
73 | |||
74 | // 国家 | ||
75 | @Column(name = "country") | ||
76 | private String country; | ||
77 | |||
78 | // 省份 | ||
79 | @Column(name = "province") | ||
80 | private String province; | ||
81 | |||
82 | // 城市 | ||
83 | @Column(name = "city") | ||
84 | private String city; | ||
85 | |||
86 | // 头像地址 | ||
87 | @Column(name = "headimgurl") | ||
88 | private String headimgurl; | ||
89 | |||
90 | // 特权信息 | ||
91 | @Column(name = "privilege") | ||
92 | private String privilege; | ||
93 | |||
94 | // refresh_token | ||
95 | @Column(name = "refresh_token") | ||
96 | private String refreshToken; | ||
97 | |||
98 | // access_token | ||
99 | @Column(name = "access_token") | ||
100 | private String accessToken; | ||
101 | |||
102 | // expires_in | ||
103 | @Column(name = "expires_in") | ||
104 | private Integer expiresIn; | ||
105 | |||
106 | // expires_time | ||
107 | @Column(name = "expires_time") | ||
108 | private Timestamp expiresTime; | ||
109 | |||
110 | // 描述 | ||
111 | @Column(name = "description") | ||
112 | private String description; | ||
113 | |||
114 | // 创建时间 | ||
115 | @CreatedDate | ||
116 | @Column(name = "create_time") | ||
117 | private Timestamp createTime; | ||
118 | |||
119 | // 更新时间 | ||
120 | @LastModifiedDate | ||
121 | @Column(name = "update_time") | ||
122 | private Timestamp updateTime; | ||
123 | |||
124 | public void copy(VisUserWeixin source){ | ||
125 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
126 | } | ||
127 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weixin/repository/VisUserWeixinRepository.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.weixin.repository; | ||
2 | |||
3 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | |||
7 | import java.util.Optional; | ||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | public interface VisUserWeixinRepository extends JpaRepository<VisUserWeixin, Long>, JpaSpecificationExecutor<VisUserWeixin> { | ||
14 | |||
15 | |||
16 | Optional<VisUserWeixin> findByOpenid(String account); | ||
17 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weixin/service/VisUserWeixinService.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.weixin.service; | ||
2 | |||
3 | |||
4 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
5 | import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO; | ||
6 | |||
7 | /** | ||
8 | * @author XiangHan | ||
9 | * @date 2022-07-14 | ||
10 | */ | ||
11 | public interface VisUserWeixinService { | ||
12 | |||
13 | /** | ||
14 | * 根据ID查询 | ||
15 | * @param id ID | ||
16 | * @return VisUserWeixinDTO | ||
17 | */ | ||
18 | VisUserWeixinDTO findById(Long id); | ||
19 | |||
20 | void create(VisUserWeixin resources); | ||
21 | |||
22 | void update(VisUserWeixin resources); | ||
23 | |||
24 | void delete(Long id); | ||
25 | |||
26 | VisUserWeixinDTO findByOpenid(String account); | ||
27 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weixin/service/dto/VisUserWeixinDTO.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.weixin.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | import java.io.Serializable; | ||
6 | import java.sql.Timestamp; | ||
7 | |||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | @Data | ||
14 | public class VisUserWeixinDTO implements Serializable { | ||
15 | |||
16 | |||
17 | // ID | ||
18 | private Long id; | ||
19 | |||
20 | // 所有者ID | ||
21 | private Long personId; | ||
22 | |||
23 | // 用户ID | ||
24 | private Long visUserId; | ||
25 | |||
26 | // 微信unionid,针对开发者 | ||
27 | private String unionid; | ||
28 | |||
29 | // 微信appid | ||
30 | private String appid; | ||
31 | |||
32 | // 微信appid | ||
33 | private String appId; | ||
34 | |||
35 | // 微信openid,针对微信app | ||
36 | private String openid; | ||
37 | |||
38 | // 状态 0-失效 1-有效 | ||
39 | private Integer status; | ||
40 | |||
41 | // 昵称 | ||
42 | private String nickname; | ||
43 | |||
44 | // 性别 | ||
45 | private Integer sex; | ||
46 | |||
47 | // 国家 | ||
48 | private String country; | ||
49 | |||
50 | // 省份 | ||
51 | private String province; | ||
52 | |||
53 | // 城市 | ||
54 | private String city; | ||
55 | |||
56 | // 头像地址 | ||
57 | private String headimgurl; | ||
58 | |||
59 | // 特权信息 | ||
60 | private String privilege; | ||
61 | |||
62 | // refresh_token | ||
63 | private String refreshToken; | ||
64 | |||
65 | // access_token | ||
66 | private String accessToken; | ||
67 | |||
68 | // expires_in | ||
69 | private Integer expiresIn; | ||
70 | |||
71 | // expires_time | ||
72 | private Timestamp expiresTime; | ||
73 | |||
74 | // 描述 | ||
75 | private String description; | ||
76 | |||
77 | // 创建时间 | ||
78 | private Timestamp createTime; | ||
79 | |||
80 | // 更新时间 | ||
81 | private Timestamp updateTime; | ||
82 | } |
1 | package com.topdraw.business.module.vis.hainan.weixin.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
4 | import com.topdraw.business.module.vis.hainan.weixin.repository.VisUserWeixinRepository; | ||
5 | import com.topdraw.business.module.vis.hainan.weixin.service.VisUserWeixinService; | ||
6 | import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO; | ||
7 | import com.topdraw.business.module.vis.hainan.weixin.service.mapper.VisUserWeixinMapper; | ||
8 | import com.topdraw.utils.ValidationUtil; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
11 | import org.springframework.stereotype.Service; | ||
12 | import org.springframework.transaction.annotation.Propagation; | ||
13 | import org.springframework.transaction.annotation.Transactional; | ||
14 | import org.springframework.util.Assert; | ||
15 | |||
16 | /** | ||
17 | * @author XiangHan | ||
18 | * @date 2022-07-14 | ||
19 | */ | ||
20 | @Service | ||
21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
22 | public class VisUserWeixinServiceImpl implements VisUserWeixinService { | ||
23 | |||
24 | @Autowired | ||
25 | private VisUserWeixinRepository visUserWeixinRepository; | ||
26 | |||
27 | @Autowired | ||
28 | private VisUserWeixinMapper visUserWeixinMapper; | ||
29 | |||
30 | @Override | ||
31 | public VisUserWeixinDTO findById(Long id) { | ||
32 | VisUserWeixin visUserWeixin = visUserWeixinRepository.findById(id).orElseGet(VisUserWeixin::new); | ||
33 | ValidationUtil.isNull(visUserWeixin.getId(),"VisUserWeixin","id",id); | ||
34 | return visUserWeixinMapper.toDto(visUserWeixin); | ||
35 | } | ||
36 | |||
37 | @Override | ||
38 | @Transactional(rollbackFor = Exception.class) | ||
39 | public void create(VisUserWeixin resources) { | ||
40 | visUserWeixinRepository.save(resources); | ||
41 | } | ||
42 | |||
43 | @Override | ||
44 | @Transactional(rollbackFor = Exception.class) | ||
45 | public void update(VisUserWeixin resources) { | ||
46 | VisUserWeixin visUserWeixin = visUserWeixinRepository.findById(resources.getId()).orElseGet(VisUserWeixin::new); | ||
47 | ValidationUtil.isNull( visUserWeixin.getId(),"VisUserWeixin","id",resources.getId()); | ||
48 | visUserWeixin.copy(resources); | ||
49 | visUserWeixinRepository.save(visUserWeixin); | ||
50 | } | ||
51 | |||
52 | @Override | ||
53 | @Transactional(rollbackFor = Exception.class) | ||
54 | public void delete(Long id) { | ||
55 | Assert.notNull(id, "The given id must not be null!"); | ||
56 | VisUserWeixin visUserWeixin = visUserWeixinRepository.findById(id).orElseThrow( | ||
57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserWeixin.class, id), 1)); | ||
58 | visUserWeixinRepository.delete(visUserWeixin); | ||
59 | } | ||
60 | |||
61 | @Override | ||
62 | public VisUserWeixinDTO findByOpenid(String account) { | ||
63 | VisUserWeixin visUserWeixin = visUserWeixinRepository.findByOpenid(account).orElseGet(VisUserWeixin::new); | ||
64 | return visUserWeixinMapper.toDto(visUserWeixin); | ||
65 | } | ||
66 | |||
67 | |||
68 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weixin/service/mapper/VisUserWeixinMapper.java
0 → 100644
1 | package com.topdraw.business.module.vis.hainan.weixin.service.mapper; | ||
2 | |||
3 | import com.topdraw.base.BaseMapper; | ||
4 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
5 | import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO; | ||
6 | import org.mapstruct.Mapper; | ||
7 | import org.mapstruct.ReportingPolicy; | ||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-14 | ||
12 | */ | ||
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
14 | public interface VisUserWeixinMapper extends BaseMapper<VisUserWeixinDTO, VisUserWeixin> { | ||
15 | |||
16 | } |
... | @@ -59,7 +59,7 @@ public class RestTemplateClient { | ... | @@ -59,7 +59,7 @@ public class RestTemplateClient { |
59 | return null; | 59 | return null; |
60 | } | 60 | } |
61 | 61 | ||
62 | public JSONObject unsubscribe(SubscribeBean subscribeBean) { | 62 | public Boolean unsubscribe(SubscribeBean subscribeBean) { |
63 | try { | 63 | try { |
64 | String url = BASE_URL + "/uce/userOperation/unsubscribe"; | 64 | String url = BASE_URL + "/uce/userOperation/unsubscribe"; |
65 | String content = JSON.toJSONString(subscribeBean); | 65 | String content = JSON.toJSONString(subscribeBean); |
... | @@ -71,7 +71,7 @@ public class RestTemplateClient { | ... | @@ -71,7 +71,7 @@ public class RestTemplateClient { |
71 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); | 71 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); |
72 | log.info("response ==>> {}", responseEntity); | 72 | log.info("response ==>> {}", responseEntity); |
73 | 73 | ||
74 | return getParseResponseResult(responseEntity); | 74 | return getParseResponseResultBoolean(responseEntity); |
75 | 75 | ||
76 | } catch (Exception e) { | 76 | } catch (Exception e) { |
77 | log.error("处理微信取关(ApiUti.unsubscribe)信息时出现异常,cause ==>> {}", e.getMessage()); | 77 | log.error("处理微信取关(ApiUti.unsubscribe)信息时出现异常,cause ==>> {}", e.getMessage()); |
... | @@ -80,7 +80,7 @@ public class RestTemplateClient { | ... | @@ -80,7 +80,7 @@ public class RestTemplateClient { |
80 | return null; | 80 | return null; |
81 | } | 81 | } |
82 | 82 | ||
83 | public JSONObject subscribe(SubscribeBean subscribeBean) { | 83 | public Boolean subscribe(SubscribeBean subscribeBean) { |
84 | try { | 84 | try { |
85 | String url = BASE_URL + "/uce/userOperation/subscribe"; | 85 | String url = BASE_URL + "/uce/userOperation/subscribe"; |
86 | String content = JSON.toJSONString(subscribeBean); | 86 | String content = JSON.toJSONString(subscribeBean); |
... | @@ -89,10 +89,10 @@ public class RestTemplateClient { | ... | @@ -89,10 +89,10 @@ public class RestTemplateClient { |
89 | objectObjectHashMap.put("content", content); | 89 | objectObjectHashMap.put("content", content); |
90 | 90 | ||
91 | log.info("request url is ==>> {} || param is ==>> {} ", url, objectObjectHashMap); | 91 | log.info("request url is ==>> {} || param is ==>> {} ", url, objectObjectHashMap); |
92 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, subscribeBean, String.class); | 92 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); |
93 | log.info("response ==>> {}", responseEntity); | 93 | log.info("response ==>> {}", responseEntity); |
94 | 94 | ||
95 | return getParseResponseResult(responseEntity); | 95 | return getParseResponseResultBoolean(responseEntity); |
96 | 96 | ||
97 | } catch (Exception e) { | 97 | } catch (Exception e) { |
98 | log.error("处理微信关注(ApiUti.subscribe)信息时出现异常,cause ==>> {}", e.getMessage()); | 98 | log.error("处理微信关注(ApiUti.subscribe)信息时出现异常,cause ==>> {}", e.getMessage()); | ... | ... |
1 | spring: | 1 | spring: |
2 | # 数据源 | 2 | # 数据源 |
3 | datasource: | 3 | datasource: |
4 | url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user_iptv?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | 4 | # url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user_iptv?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false |
5 | username: root | ||
6 | password: root | ||
7 | # url: jdbc:log4jdbc:mysql://139.196.145.150:3306/ucs_iptv_sichuan?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
8 | # username: root | 5 | # username: root |
9 | # password: Tjlh@2021 | 6 | # password: root |
7 | url: jdbc:log4jdbc:mysql://139.196.145.150:3306/ucs_stage_vis?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
8 | username: root | ||
9 | password: Tjlh@2021 | ||
10 | # 驱动程序 | 10 | # 驱动程序 |
11 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy | 11 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy |
12 | # Druid | 12 | # Druid |
... | @@ -48,6 +48,7 @@ spring: | ... | @@ -48,6 +48,7 @@ spring: |
48 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 | 48 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 |
49 | ddl-auto: none | 49 | ddl-auto: none |
50 | open-in-view: true | 50 | open-in-view: true |
51 | # 不打印sql语句 | ||
51 | show-sql: false | 52 | show-sql: false |
52 | 53 | ||
53 | # redis | 54 | # redis |
... | @@ -70,25 +71,3 @@ spring: | ... | @@ -70,25 +71,3 @@ spring: |
70 | listener: | 71 | listener: |
71 | direct: | 72 | direct: |
72 | auto-startup: false | 73 | auto-startup: false |
... | \ No newline at end of file | ... | \ No newline at end of file |
73 | uce: | ||
74 | queue: uce.queue | ||
75 | memberInfo: | ||
76 | queue: queue.MemberInfoSync | ||
77 | event: | ||
78 | queue: event.queue | ||
79 | collection: | ||
80 | queue: collection.queue | ||
81 | addCollection: | ||
82 | queue: collection.queue | ||
83 | deleteCollection: | ||
84 | queue: collection.queue | ||
85 | deleteAllCollection: | ||
86 | queue: collection.queue | ||
87 | viewRecord: | ||
88 | queue: viewRecord.queue | ||
89 | eventBus: | ||
90 | queue: uc.eventbus | ||
91 | wechat: | ||
92 | queue: weixin.subOrUnSub.queue | ||
93 | growthReport: | ||
94 | queue: growthReport.queue | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment