Commit a5d2e0d5 a5d2e0d5d69e91b1d927c3b9734baee35c71d596 by xianghan

1.优化部分接口的返回值

2.添加全局密码解密方法
1 parent f5ab3240
...@@ -49,11 +49,13 @@ public interface RedisKeyConstants { ...@@ -49,11 +49,13 @@ public interface RedisKeyConstants {
49 // 历史完成的任务数量 49 // 历史完成的任务数量
50 String cacheTotalFinishTaskCount = "uce::totalCount::memberId"; 50 String cacheTotalFinishTaskCount = "uce::totalCount::memberId";
51 51
52 52 // app账号信息
53 String cacheAppById = "uce:appInfo:id";
53 54
54 String CACHE_PLATFROMACCOUNT_PLAYDURATION = "uce::eventPlay::playduration"; 55 String CACHE_PLATFROMACCOUNT_PLAYDURATION = "uce::eventPlay::playduration";
55 56
56 57
57 String CACHE_TODAY_FINISH_COUNT = "todayFinishCount"; 58 String CACHE_TODAY_FINISH_COUNT = "todayFinishCount";
58 String CACHE_TOTAL_FINISH_COUNT = "totalFinishCount"; 59 String CACHE_TOTAL_FINISH_COUNT = "totalFinishCount";
60
59 } 61 }
......
...@@ -194,7 +194,7 @@ public class UserAppController { ...@@ -194,7 +194,7 @@ public class UserAppController {
194 resources.setUserAppId(id); 194 resources.setUserAppId(id);
195 } 195 }
196 196
197 return ResultInfo.success(this.userAppBindService.create(resources)); 197 return this.userAppBindService.create(resources);
198 } 198 }
199 199
200 @PostMapping(value = "/updateValidStatusAndUserAppIdAndNickname") 200 @PostMapping(value = "/updateValidStatusAndUserAppIdAndNickname")
......
1 package com.topdraw.business.module.user.app.service; 1 package com.topdraw.business.module.user.app.service;
2 2
3 import com.topdraw.base.modules.common.ResultInfo;
3 import com.topdraw.business.module.user.app.domain.UserAppBind; 4 import com.topdraw.business.module.user.app.domain.UserAppBind;
4 import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; 5 import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO;
5 6
...@@ -22,7 +23,7 @@ public interface UserAppBindService { ...@@ -22,7 +23,7 @@ public interface UserAppBindService {
22 * 23 *
23 * @param resources 24 * @param resources
24 */ 25 */
25 UserAppBindDTO create(UserAppBind resources); 26 ResultInfo create(UserAppBind resources);
26 27
27 /** 28 /**
28 * 29 *
......
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.base.modules.common.ResultInfo;
3 import com.topdraw.base.modules.utils.ValidationUtil; 4 import com.topdraw.base.modules.utils.ValidationUtil;
4 import com.topdraw.business.module.user.app.domain.UserAppBind; 5 import com.topdraw.business.module.user.app.domain.UserAppBind;
5 import com.topdraw.business.module.user.app.repository.UserAppBindRepository; 6 import com.topdraw.business.module.user.app.repository.UserAppBindRepository;
6 import com.topdraw.business.module.user.app.service.UserAppBindService; 7 import com.topdraw.business.module.user.app.service.UserAppBindService;
7 import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; 8 import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO;
8 import com.topdraw.business.module.user.app.service.mapper.UserAppBindMapper; 9 import com.topdraw.business.module.user.app.service.mapper.UserAppBindMapper;
10 import lombok.extern.slf4j.Slf4j;
9 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
11 import org.springframework.transaction.annotation.Propagation; 13 import org.springframework.transaction.annotation.Propagation;
...@@ -14,6 +16,7 @@ import org.springframework.dao.EmptyResultDataAccessException; ...@@ -14,6 +16,7 @@ import org.springframework.dao.EmptyResultDataAccessException;
14 import org.springframework.util.Assert; 16 import org.springframework.util.Assert;
15 17
16 import java.util.List; 18 import java.util.List;
19 import java.util.Objects;
17 20
18 /** 21 /**
19 * @author XiangHan 22 * @author XiangHan
...@@ -21,6 +24,7 @@ import java.util.List; ...@@ -21,6 +24,7 @@ import java.util.List;
21 */ 24 */
22 @Service 25 @Service
23 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) 26 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
27 @Slf4j
24 public class UserAppBindServiceImpl implements UserAppBindService { 28 public class UserAppBindServiceImpl implements UserAppBindService {
25 29
26 @Autowired 30 @Autowired
...@@ -38,9 +42,15 @@ public class UserAppBindServiceImpl implements UserAppBindService { ...@@ -38,9 +42,15 @@ public class UserAppBindServiceImpl implements UserAppBindService {
38 42
39 @Override 43 @Override
40 @Transactional(rollbackFor = Exception.class) 44 @Transactional(rollbackFor = Exception.class)
41 public UserAppBindDTO create(UserAppBind resources) { 45 public ResultInfo create(UserAppBind resources) {
46 UserAppBindDTO userAppBindDTO =
47 this.findFirstByAccountAndAccountType(resources.getAccount(), resources.getAccountType());
48 if (Objects.nonNull(userAppBindDTO.getId())) {
49 log.warn("保存第三方账号失败, saveThirdAccount# messgage ==>> 第三方账号已存在 | appBind ==>> {}", resources);
50 return ResultInfo.failure("保存第三方账号失败, 第三方账号已存在");
51 }
42 UserAppBind userAppBind = this.userAppBindRepository.save(resources); 52 UserAppBind userAppBind = this.userAppBindRepository.save(resources);
43 return this.userAppBindMapper.toDto(userAppBind); 53 return ResultInfo.success(this.userAppBindMapper.toDto(userAppBind));
44 } 54 }
45 55
46 @Override 56 @Override
......
...@@ -7,7 +7,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -7,7 +7,6 @@ import com.alibaba.fastjson.JSONObject;
7 import com.topdraw.base.modules.annotation.AnonymousAccess; 7 import com.topdraw.base.modules.annotation.AnonymousAccess;
8 import com.topdraw.base.modules.common.ResultInfo; 8 import com.topdraw.base.modules.common.ResultInfo;
9 import com.topdraw.base.modules.exception.BadRequestException; 9 import com.topdraw.base.modules.exception.BadRequestException;
10 import com.topdraw.base.modules.exception.EntityNotFoundException;
11 import com.topdraw.base.modules.utils.RedisUtils; 10 import com.topdraw.base.modules.utils.RedisUtils;
12 import com.topdraw.business.module.common.validated.CreateGroup; 11 import com.topdraw.business.module.common.validated.CreateGroup;
13 import com.topdraw.business.module.common.validated.UpdateGroup; 12 import com.topdraw.business.module.common.validated.UpdateGroup;
...@@ -20,7 +19,6 @@ import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; ...@@ -20,7 +19,6 @@ import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO;
20 import com.topdraw.business.module.user.iptv.domain.UserTv; 19 import com.topdraw.business.module.user.iptv.domain.UserTv;
21 import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; 20 import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport;
22 import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportRequest; 21 import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportRequest;
23 import com.topdraw.business.module.user.iptv.service.UserTvService;
24 import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; 22 import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
25 import com.topdraw.business.module.user.weixin.domain.UserWeixin; 23 import com.topdraw.business.module.user.weixin.domain.UserWeixin;
26 import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; 24 import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
...@@ -28,12 +26,10 @@ import com.topdraw.business.process.domian.member.MemberOperationBean; ...@@ -28,12 +26,10 @@ import com.topdraw.business.process.domian.member.MemberOperationBean;
28 import com.topdraw.business.process.domian.weixin.*; 26 import com.topdraw.business.process.domian.weixin.*;
29 import com.topdraw.business.process.service.UserOperationService; 27 import com.topdraw.business.process.service.UserOperationService;
30 import com.topdraw.business.process.service.member.MemberOperationService; 28 import com.topdraw.business.process.service.member.MemberOperationService;
31 import com.topdraw.util.RedisKeyUtil; 29 import com.topdraw.util.*;
32 import com.topdraw.config.WechatConfig; 30 import com.topdraw.config.WechatConfig;
33 import com.topdraw.exception.GlobeExceptionMsg; 31 import com.topdraw.exception.GlobeExceptionMsg;
34 import com.topdraw.resttemplate.RestTemplateClient; 32 import com.topdraw.resttemplate.RestTemplateClient;
35 import com.topdraw.util.Base64Util;
36 import com.topdraw.util.JSONUtil;
37 import com.topdraw.weixin.service.WeChatConstants; 33 import com.topdraw.weixin.service.WeChatConstants;
38 import io.swagger.annotations.Api; 34 import io.swagger.annotations.Api;
39 import io.swagger.annotations.ApiOperation; 35 import io.swagger.annotations.ApiOperation;
...@@ -47,7 +43,6 @@ import org.springframework.validation.annotation.Validated; ...@@ -47,7 +43,6 @@ import org.springframework.validation.annotation.Validated;
47 import org.springframework.web.bind.annotation.*; 43 import org.springframework.web.bind.annotation.*;
48 44
49 import javax.naming.ConfigurationException; 45 import javax.naming.ConfigurationException;
50 import java.io.IOException;
51 import java.net.URLDecoder; 46 import java.net.URLDecoder;
52 import java.sql.Timestamp; 47 import java.sql.Timestamp;
53 import java.util.*; 48 import java.util.*;
...@@ -65,8 +60,6 @@ public class UserOperationController { ...@@ -65,8 +60,6 @@ public class UserOperationController {
65 private UserOperationService userOperationService; 60 private UserOperationService userOperationService;
66 @Autowired 61 @Autowired
67 private MemberOperationService memberOperationService; 62 private MemberOperationService memberOperationService;
68 @Autowired
69 private UserTvService userTvService;
70 63
71 @Autowired 64 @Autowired
72 private RedisUtils redisUtils; 65 private RedisUtils redisUtils;
...@@ -90,12 +83,14 @@ public class UserOperationController { ...@@ -90,12 +83,14 @@ public class UserOperationController {
90 @ApiOperation("app账号退出登录") 83 @ApiOperation("app账号退出登录")
91 @AnonymousAccess 84 @AnonymousAccess
92 public ResultInfo appSignOut(@Validated @RequestBody UserApp userApp) { 85 public ResultInfo appSignOut(@Validated @RequestBody UserApp userApp) {
93 log.info("app账号退出登录,参数 ==>> [appSignOut#{}]", userApp.getId()); 86 log.info("app账号退出登录,参数 appSignOut# userApp ==>> {} ", userApp);
94 if (Objects.isNull(userApp.getId())) { 87 if (Objects.isNull(userApp.getId())) {
95 log.error("app账号退出登录失败,参数错误,id不得为空,[appSignOut#]"); 88 log.error("app账号退出登录失败,参数错误,appSignOut# message ==>> id不得为空");
96 return ResultInfo.failure("app账号退出登录失败,参数错误,id不得为空"); 89 return ResultInfo.failure("app账号退出登录失败,参数错误,id不得为空");
97 } 90 }
98 91
92 // TODO 2.2.0 版本之前无具体业务,后续等业务方确定具体业务后在进行拓展
93
99 return ResultInfo.success(true); 94 return ResultInfo.success(true);
100 } 95 }
101 96
...@@ -108,23 +103,21 @@ public class UserOperationController { ...@@ -108,23 +103,21 @@ public class UserOperationController {
108 @ApiOperation("注销app账号") 103 @ApiOperation("注销app账号")
109 @AnonymousAccess 104 @AnonymousAccess
110 public ResultInfo appCancellation(@Validated @RequestBody UserApp userApp) { 105 public ResultInfo appCancellation(@Validated @RequestBody UserApp userApp) {
111 log.info("注销app账号,参数 ==>> [appCancellation#{}]", userApp.getId()); 106 log.info("注销app账号,参数 appCancellation# resources ==>> {}", userApp);
112 107
113 if (Objects.isNull(userApp.getId())) { 108 if (Objects.isNull(userApp.getId())) {
114 log.error("注销app账号失败,参数错误,id不得为空,[appCancellation#]"); 109 log.error("注销app账号异常,appCancellation# message ==>> app账号id不的为空");
115 return ResultInfo.failure(""); 110 return ResultInfo.failure("app账号id不的为空");
116 } 111 }
117 112
118 boolean result = this.userOperationService.appCancellation(userApp); 113 return ResultInfo.success(this.userOperationService.appCancellation(userApp));
119
120 return ResultInfo.success(result);
121 } 114 }
122 115
123 @PostMapping(value = "/updateAppInfo") 116 @PostMapping(value = "/updateAppInfo")
124 @ApiOperation("修改app账号信息") 117 @ApiOperation("修改app账号信息")
125 @AnonymousAccess 118 @AnonymousAccess
126 public ResultInfo updateAppInfo(@Validated @RequestBody UserApp resources) { 119 public ResultInfo updateAppInfo(@Validated @RequestBody UserApp resources) {
127 log.info("修改app账号信息,参数 ==>> [updateAppInfo#{}]", resources); 120 log.info("修改app账号信息,参数 updateAppInfo# resources ==>> {}", resources);
128 Long id = resources.getId(); 121 Long id = resources.getId();
129 if (Objects.isNull(id)) { 122 if (Objects.isNull(id)) {
130 log.error("修改app账号密码,参数错误,id不得为空,[updateAppInfo#{}]", resources); 123 log.error("修改app账号密码,参数错误,id不得为空,[updateAppInfo#{}]", resources);
...@@ -147,32 +140,48 @@ public class UserOperationController { ...@@ -147,32 +140,48 @@ public class UserOperationController {
147 @ApiOperation("app注册") 140 @ApiOperation("app注册")
148 @AnonymousAccess 141 @AnonymousAccess
149 public ResultInfo appRegister(@Validated @RequestBody UserApp resources) { 142 public ResultInfo appRegister(@Validated @RequestBody UserApp resources) {
150 log.info("app注册 ==>> param ==>> [appRegister#{}]", resources); 143 log.info("app注册, 参数 appRegister# resouces ==>> {}", resources);
151 144
152 String username = resources.getUsername(); 145 String username = resources.getUsername();
153 if (StringUtils.isBlank(username)) { 146 if (StringUtils.isBlank(username)) {
154 log.error("app注册,参数错误,账号不得为空 "); 147 log.error("app注册,参数错误,appRegister# message ==>> 账号不得为空 ");
155 return ResultInfo.failure("app注册,参数错误,账号不得为空"); 148 return ResultInfo.failure("app注册,参数错误,账号不得为空");
156 } 149 }
157 150
158 Integer type = resources.getType(); 151 Integer type = resources.getType();
159 if (Objects.isNull(type)) { 152 if (Objects.isNull(type)) {
160 log.error("app注册,参数错误,账号类型不得为空 "); 153 log.error("app注册,参数错误,appRegister# message ==>> 账号类型不得为空 ");
161 return ResultInfo.failure("app注册,参数错误,账号类型不得为空"); 154 return ResultInfo.failure("app注册,参数错误,账号类型不得为空");
162 } 155 }
163 156
164 String account = resources.getAccount(); 157 String account = resources.getAccount();
165 if (StringUtils.isNotBlank(account)) { 158 if (StringUtils.isNotBlank(account)) {
166 if (Objects.isNull(resources.getAccountType())) { 159 if (Objects.isNull(resources.getAccountType())) {
167 log.error("app注册,参数错误,第三方账号类型不得为空"); 160 log.error("app注册,参数错误,appRegister# message ==>> 第三方账号类型不得为空");
168 return ResultInfo.failure("app注册,参数错误,第三方账号类型不得为空"); 161 return ResultInfo.failure("app注册,参数错误,第三方账号类型不得为空");
169 } 162 }
170 } 163 }
171 164
172 if (StringUtils.isBlank(resources.getNickname())) { 165 if (StringUtils.isBlank(resources.getNickname())) {
166 // 昵称不存在时,默认使用手机号作为昵称
173 resources.setNickname(Base64Utils.encodeToString(username.getBytes())); 167 resources.setNickname(Base64Utils.encodeToString(username.getBytes()));
174 } 168 }
175 169
170 if (StringUtils.isNotBlank(resources.getPassword())) {
171 String clientPassword = AESUtil.decrypt(resources.getPassword(), "f8681b9ce7c8fb6b");
172 if (clientPassword == null || clientPassword.length() <= 16) {
173 log.error("修改app账号密码失败,参数错误,密码格式不正确,[updateAppPasswordByOldPassword# clientPassword ==>> {}]", clientPassword);
174 return ResultInfo.failure("密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-25 之间");
175 }
176 String resultClientPassword = clientPassword.substring(16);
177
178 if (!RegexUtil.appPasswordRegex(resultClientPassword)) {
179 log.error("app注册异常,appRegister# {} message ==>> 密码格式不正确", resultClientPassword);
180 return ResultInfo.failure("密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-25 之间");
181 }
182 resources.setPassword(AESUtil.decodePassword(resources.getPassword()));
183 }
184
176 UserAppDTO userAppDTO = this.userOperationService.appRegister(resources); 185 UserAppDTO userAppDTO = this.userOperationService.appRegister(resources);
177 return ResultInfo.success(userAppDTO); 186 return ResultInfo.success(userAppDTO);
178 } 187 }
...@@ -181,18 +190,18 @@ public class UserOperationController { ...@@ -181,18 +190,18 @@ public class UserOperationController {
181 @ApiOperation("app账号绑定第三方账号") 190 @ApiOperation("app账号绑定第三方账号")
182 @AnonymousAccess 191 @AnonymousAccess
183 public ResultInfo appBindThirdAccount(@Validated @RequestBody UserAppBind resources) { 192 public ResultInfo appBindThirdAccount(@Validated @RequestBody UserAppBind resources) {
184 log.info("app账号绑定第三方账号,参数 ==>> [appBindThirdAccount#{}]", resources); 193 log.info("app账号绑定第三方账号,参数 appBindThirdAccount# message ==>> {}", resources);
185 194
186 String username = resources.getUsername(); 195 String username = resources.getUsername();
187 if (StringUtils.isBlank(username)) { 196 if (StringUtils.isBlank(username)) {
188 log.error("app账号绑定第三方账号,参数错误,账号不得为空 "); 197 log.error("app账号绑定第三方账号,参数错误,appBindThirdAccount# message ==>> 账号不得为空 ");
189 return ResultInfo.failure("app账号绑定第三方账号,参数错误,账号不得为空"); 198 return ResultInfo.failure("app账号绑定第三方账号,参数错误,账号不得为空");
190 } 199 }
191 200
192 String account = resources.getAccount(); 201 String account = resources.getAccount();
193 if (StringUtils.isNotBlank(account)) { 202 if (StringUtils.isNotBlank(account)) {
194 if (Objects.isNull(resources.getAccountType())) { 203 if (Objects.isNull(resources.getAccountType())) {
195 log.error("app账号绑定第三方账号,参数错误,第三方账号不得为空"); 204 log.error("app账号绑定第三方账号,参数错误,appBindThirdAccount# message ==>> 第三方账号不得为空");
196 return ResultInfo.failure("app账号绑定第三方账号,参数错误,第三方账号不得为空"); 205 return ResultInfo.failure("app账号绑定第三方账号,参数错误,第三方账号不得为空");
197 } 206 }
198 } 207 }
...@@ -200,7 +209,7 @@ public class UserOperationController { ...@@ -200,7 +209,7 @@ public class UserOperationController {
200 // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号 209 // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号
201 Integer accountType = resources.getAccountType(); 210 Integer accountType = resources.getAccountType();
202 if (Objects.isNull(accountType)) { 211 if (Objects.isNull(accountType)) {
203 log.error("app账号绑定第三方账号,参数错误,第三方账号类型不得为空"); 212 log.error("app账号绑定第三方账号,参数错误,appBindThirdAccount# message ==>> 第三方账号类型不得为空");
204 return ResultInfo.failure("app账号绑定第三方账号,参数错误,第三方账号类型不得为空"); 213 return ResultInfo.failure("app账号绑定第三方账号,参数错误,第三方账号类型不得为空");
205 } 214 }
206 215
...@@ -211,7 +220,7 @@ public class UserOperationController { ...@@ -211,7 +220,7 @@ public class UserOperationController {
211 @ApiOperation("取消关联第三方账号") 220 @ApiOperation("取消关联第三方账号")
212 @AnonymousAccess 221 @AnonymousAccess
213 public ResultInfo cancelUserAppBind(@Validated @RequestBody UserAppBind resources) { 222 public ResultInfo cancelUserAppBind(@Validated @RequestBody UserAppBind resources) {
214 log.info("取消关联第三方账号, 参数 ==>> [cancelUserAppBind#{}]", resources); 223 log.info("取消关联第三方账号, 参数 cancelUserAppBind# resource ==>> {}", resources);
215 224
216 String account = resources.getAccount(); 225 String account = resources.getAccount();
217 if (StringUtils.isBlank(account)) { 226 if (StringUtils.isBlank(account)) {
...@@ -287,11 +296,11 @@ public class UserOperationController { ...@@ -287,11 +296,11 @@ public class UserOperationController {
287 } 296 }
288 297
289 @PutMapping(value = "/updateWeixin") 298 @PutMapping(value = "/updateWeixin")
290 @ApiOperation("修改UserWeixin") 299 @ApiOperation("修改微信信息")
291 @AnonymousAccess 300 @AnonymousAccess
292 public ResultInfo updateWeixin(@Validated @RequestBody UserWeixin resources) { 301 public ResultInfo updateWeixin(@Validated @RequestBody UserWeixin resources) {
293 userOperationService.updateWeixin(resources); 302 log.info("修改微信信息, 参数 updateWeixin# resources ==>> {}", resources);
294 return ResultInfo.success(); 303 return ResultInfo.success(this.userOperationService.updateWeixin(resources));
295 } 304 }
296 305
297 @RequestMapping(value = "/updateVipByUserId") 306 @RequestMapping(value = "/updateVipByUserId")
...@@ -299,23 +308,30 @@ public class UserOperationController { ...@@ -299,23 +308,30 @@ public class UserOperationController {
299 @AnonymousAccess 308 @AnonymousAccess
300 public ResultInfo updateVipByUserId(@Validated(value = {UpdateGroup.class}) @RequestBody 309 public ResultInfo updateVipByUserId(@Validated(value = {UpdateGroup.class}) @RequestBody
301 UserOperationBean resources) { 310 UserOperationBean resources) {
302 log.info("userOperation ==>> updateVipByUserId ==>> param ==>> [{}]",resources); 311 log.info("通过账号id修改vip, 参数 updateVipByUserId# resources ==>> {}",resources);
303 312
304 Integer vip = resources.getVip(); 313 Integer vip = resources.getVip();
305 if (Objects.isNull(vip) || vip < 1) { 314 if (Objects.isNull(vip) || vip < 1) {
306 return ResultInfo.failure("手动修改vip异常,参数错误,vip为空或者小于1"); 315 return ResultInfo.failure("手动修改vip异常,参数错误,vip为空或者小于1");
307 } 316 }
317
308 Timestamp vipExpireTime = resources.getVipExpireTime(); 318 Timestamp vipExpireTime = resources.getVipExpireTime();
309 // 微信账号id 319 // 微信账号id
310 Long userId = resources.getUserId(); 320 Long userId = resources.getUserId();
311 if (Objects.isNull(userId)) { 321 if (Objects.isNull(userId)) {
312 return ResultInfo.failure("手动修改vip异常,参数错误,小屏账号id为空"); 322 log.error("通过账号id修改vip异常,updateVipByUserId# message ==>> 小屏账号id不的为空");
323 return ResultInfo.failure("小屏账号id不的为空");
313 } 324 }
314 UserWeixinDTO userWeixinDTO = this.userOperationService.findById(userId); 325 UserWeixinDTO userWeixinDTO = this.userOperationService.findById(userId);
315 326
316 Long memberId = userWeixinDTO.getMemberId(); 327 Long memberId = userWeixinDTO.getMemberId();
317 MemberDTO memberDTO = this.memberService.findById(memberId); 328 MemberDTO memberDTO = this.memberService.findById(memberId);
318 329
330 if (Objects.isNull(memberDTO.getId())) {
331 log.error("通过账号id修改vip异常,updateVipByUserId# message ==>> 会员信息不存在");
332 return ResultInfo.failure("会员信息不存在");
333 }
334
319 MemberOperationBean memberOperationBean = new MemberOperationBean(); 335 MemberOperationBean memberOperationBean = new MemberOperationBean();
320 memberOperationBean.setMemberCode(memberDTO.getCode()); 336 memberOperationBean.setMemberCode(memberDTO.getCode());
321 if (vip < memberDTO.getVip()) { 337 if (vip < memberDTO.getVip()) {
...@@ -325,68 +341,58 @@ public class UserOperationController { ...@@ -325,68 +341,58 @@ public class UserOperationController {
325 } 341 }
326 memberOperationBean.setVip(vip); 342 memberOperationBean.setVip(vip);
327 343
328 MemberDTO memberDTO1 = this.memberOperationService.doUpdateVipByMemberCode(memberOperationBean); 344 return ResultInfo.success(this.memberOperationService.doUpdateVipByMemberCode(memberOperationBean));
329
330 return ResultInfo.success(memberDTO1);
331 } 345 }
332 346
333 @PostMapping(value = "/createWeixinUserAndCreateMember") 347 @PostMapping(value = "/createWeixinUserAndCreateMember")
334 @ApiOperation("新增小屏账户同时创建会员信息") 348 @ApiOperation("新增小屏账户同时创建会员信息")
335 @AnonymousAccess 349 @AnonymousAccess
336 public ResultInfo createWeixinUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) { 350 public ResultInfo createWeixinUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) {
337 log.info("UserOperationController ==> createWeixinUserAndMember ==> param ==> [{}]",resources); 351 log.info("新增小屏账户同时创建会员信息, 参数 createWeixinUserAndMember# resources ==>> {}",resources);
338 352 return this.userOperationService.createWeixinUserAndMember(resources);
339 UserWeixinDTO result = this.userOperationService.createWeixinUserAndMember(resources);
340 return ResultInfo.success(result);
341 } 353 }
342 354
343 @PostMapping("/serviceLogin") 355 @PostMapping("/serviceLogin")
344 @ApiOperation("微信服务号(H5)登录") 356 @ApiOperation("微信服务号(H5)登录")
345 @AnonymousAccess 357 @AnonymousAccess
346 public ResultInfo serviceLogin(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) { 358 public ResultInfo serviceLogin(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) {
347 log.info("UserOperationController ==> serviceLogin ==>> param ==> [{}]",resources); 359 log.info("微信服务号(H5)登录, 参数 serviceLogin# resources ==>> {}",resources);
348 360 return ResultInfo.success(this.userOperationService.serviceLogin(resources));
349 UserWeixinDTO result = this.userOperationService.serviceLogin(resources);
350 return ResultInfo.success(result);
351 } 361 }
352 362
353 @PostMapping("/appletLogin") 363 @PostMapping("/appletLogin")
354 @ApiOperation("微信小程序登录") 364 @ApiOperation("微信小程序登录")
355 @AnonymousAccess 365 @AnonymousAccess
356 public ResultInfo appletLogin(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) { 366 public ResultInfo appletLogin(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) {
357 log.info("UserOperationController ==> appletLogin ==>> param ==> [{}]",resources); 367 log.info("微信小程序登录, 参数 appletLogin# resource ==>> {}", resources);
358 368 return ResultInfo.success(this.userOperationService.appletLogin(resources));
359 UserWeixinDTO result = this.userOperationService.appletLogin(resources);
360 return ResultInfo.success(result);
361 } 369 }
362 370
363 @PostMapping("/subscribe") 371 @PostMapping("/subscribe")
364 @ApiOperation("微信公众号关注") 372 @ApiOperation("微信公众号关注")
365 @AnonymousAccess 373 @AnonymousAccess
366 public ResultInfo subscribe(@Validated @RequestBody SubscribeBeanEvent data) throws Exception { 374 public ResultInfo subscribe(@Validated @RequestBody SubscribeBeanEvent resource) throws Exception {
367 log.info("UserOperationController ==> subscribe ==>> param ==> [{}]",data); 375 log.info("微信公众号关注, 参数 subscribe# resource ==> {}", resource);
368 376
369 SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class); 377 SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(resource.getContent(), SubscribeBean.class);
370 // 解析参数 378 // 解析参数
371 this.parseSubscribe(subscribeBean); 379 this.parseSubscribe(subscribeBean);
372 boolean subscribe = this.userOperationService.subscribe(subscribeBean); 380
373 if (subscribe) { 381 if (this.userOperationService.subscribe(subscribeBean)) {
374 return ResultInfo.success("关注成功"); 382 return ResultInfo.success("关注成功");
375 } else {
376 return ResultInfo.failure("关注失败");
377 } 383 }
384
385 return ResultInfo.failure("关注失败");
386
378 } 387 }
379 388
380 /** 389 /**
381 * 390 *
382 * @param subscribeBean
383 * @throws IOException
384 */ 391 */
385 private void parseSubscribe(SubscribeBean subscribeBean) throws Exception { 392 private void parseSubscribe(SubscribeBean subscribeBean) throws Exception {
386 393
387 // appId 394 // appId
388 String appId = subscribeBean.getAppid(); 395 String appId = subscribeBean.getAppid();
389 // Assert.notNull(appId, GlobeExceptionMsg.APP_ID_IS_NULL);
390 // openId 396 // openId
391 String openId = subscribeBean.getOpenid(); 397 String openId = subscribeBean.getOpenid();
392 Assert.notNull(openId, GlobeExceptionMsg.OPEN_ID_IS_NULL); 398 Assert.notNull(openId, GlobeExceptionMsg.OPEN_ID_IS_NULL);
...@@ -400,15 +406,15 @@ public class UserOperationController { ...@@ -400,15 +406,15 @@ public class UserOperationController {
400 // 程序类型 406 // 程序类型
401 String appType = wxInfoMap.get("appType"); 407 String appType = wxInfoMap.get("appType");
402 // 非订阅号,暂不处理。返回暂不支持 408 // 非订阅号,暂不处理。返回暂不支持
403 if (ObjectUtil.notEqual(appType, WeChatConstants.WX_SUBSCRIPTION)) 409 if (ObjectUtil.notEqual(appType, WeChatConstants.WX_SUBSCRIPTION)) {
404 throw new BadRequestException("非订阅号"); 410 throw new BadRequestException("非订阅号");
411 }
405 412
406 413
407 // 大屏账户信息 414 // 大屏账户信息
408 JSONObject redisInfo = null; 415 JSONObject redisInfo = null;
409 // 缓存的大屏信息,使用unionid即可 416 // 缓存的大屏信息,使用unionid即可
410 String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId)); 417 String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId));
411 log.info("获取redis中存储的数据,[subscribe#{}]", content);
412 if (StringUtils.isNotBlank(content)) { 418 if (StringUtils.isNotBlank(content)) {
413 // 大屏信息 419 // 大屏信息
414 redisInfo = JSONObject.parseObject(content); 420 redisInfo = JSONObject.parseObject(content);
...@@ -418,8 +424,6 @@ public class UserOperationController { ...@@ -418,8 +424,6 @@ public class UserOperationController {
418 if (Objects.nonNull(redisInfo)) { 424 if (Objects.nonNull(redisInfo)) {
419 425
420 subscribeBean.setIptvUserInfo(redisInfo); 426 subscribeBean.setIptvUserInfo(redisInfo);
421 // 关注来源信息
422 log.info("关注来源信息,[subscribe#{}]", redisInfo);
423 subscribeBean.setSourceInfo(redisInfo); 427 subscribeBean.setSourceInfo(redisInfo);
424 428
425 String nickname = redisInfo.get("nickname").toString(); 429 String nickname = redisInfo.get("nickname").toString();
...@@ -430,7 +434,6 @@ public class UserOperationController { ...@@ -430,7 +434,6 @@ public class UserOperationController {
430 } 434 }
431 435
432 String headimgurl = redisInfo.get("headimgurl").toString(); 436 String headimgurl = redisInfo.get("headimgurl").toString();
433 log.info("parseSubscribe ==>> headimgurl ==>> {}", headimgurl);
434 if (StringUtils.isNotBlank(headimgurl)) { 437 if (StringUtils.isNotBlank(headimgurl)) {
435 String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); 438 String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8");
436 if (StringUtils.isNotBlank(headimgurlDecode)) { 439 if (StringUtils.isNotBlank(headimgurlDecode)) {
...@@ -459,7 +462,6 @@ public class UserOperationController { ...@@ -459,7 +462,6 @@ public class UserOperationController {
459 /** 462 /**
460 * 获取配置的微信应用列表 463 * 获取配置的微信应用列表
461 * @param appid 应用Id 464 * @param appid 应用Id
462 * @return
463 * @throws ConfigurationException 465 * @throws ConfigurationException
464 */ 466 */
465 private Map<String, String> getWeixinInfoByAppid(String appid) throws ConfigurationException { 467 private Map<String, String> getWeixinInfoByAppid(String appid) throws ConfigurationException {
...@@ -477,10 +479,10 @@ public class UserOperationController { ...@@ -477,10 +479,10 @@ public class UserOperationController {
477 @PostMapping("/unsubscribe") 479 @PostMapping("/unsubscribe")
478 @ApiOperation("微信公众号取关") 480 @ApiOperation("微信公众号取关")
479 @AnonymousAccess 481 @AnonymousAccess
480 public ResultInfo unsubscribe(@Validated @RequestBody SubscribeBeanEvent data) { 482 public ResultInfo unsubscribe(@Validated @RequestBody SubscribeBeanEvent resource) {
481 log.info("UserOperationController ==> unsubscribe ==>> param ==> [{}]",data); 483 log.info("微信公众号取关, 参数 unsubscribe# resource ==> {}", resource);
482 484
483 SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class); 485 SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(resource.getContent(), SubscribeBean.class);
484 486
485 String appId = subscribeBean.getAppid(); 487 String appId = subscribeBean.getAppid();
486 Assert.notNull(appId, GlobeExceptionMsg.APP_ID_IS_NULL); 488 Assert.notNull(appId, GlobeExceptionMsg.APP_ID_IS_NULL);
...@@ -491,40 +493,40 @@ public class UserOperationController { ...@@ -491,40 +493,40 @@ public class UserOperationController {
491 subscribeBean.setAppid(appId); 493 subscribeBean.setAppid(appId);
492 subscribeBean.setOpenid(openId); 494 subscribeBean.setOpenid(openId);
493 495
494 boolean result = this.userOperationService.unsubscribe(subscribeBean); 496 return ResultInfo.success(this.userOperationService.unsubscribe(subscribeBean));
495 return ResultInfo.success(result);
496 } 497 }
497 498
498 @PostMapping("/minaBind") 499 @PostMapping("/minaBind")
499 @ApiOperation("微信小程序绑定大屏") 500 @ApiOperation("微信小程序绑定大屏")
500 @AnonymousAccess 501 @AnonymousAccess
501 public ResultInfo minaBind(@Validated(value = {BindGroup.class}) @RequestBody BindBean resources) { 502 public ResultInfo minaBind(@Validated(value = {BindGroup.class}) @RequestBody BindBean resources) {
502 log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources); 503 log.info("微信小程序绑定大屏, 参数 minaBind# resources ==>> {}", resources);
503 504
504 Long memberId = resources.getMemberId(); 505 Long memberId = resources.getMemberId();
505 if (Objects.isNull(memberId)) { 506 if (Objects.isNull(memberId)) {
506 return ResultInfo.failure("参数错误,memberId 不存在"); 507 log.error("微信小程序绑定大屏异常,参数错误,minaBind# message ==>> memberId不的为空");
508 return ResultInfo.failure("参数错误,会员id不的为空");
507 } 509 }
508 510
509 String platformAccount = resources.getPlatformAccount(); 511 String platformAccount = resources.getPlatformAccount();
510 if (StringUtils.isBlank(platformAccount)) { 512 if (StringUtils.isBlank(platformAccount)) {
511 return ResultInfo.failure("参数错误,大屏账号不存在"); 513 log.error("微信小程序绑定大屏异常,参数错误,minaBind# message ==>> 大屏账号不的为空");
514 return ResultInfo.failure("参数错误,大屏账号不的为空");
512 } 515 }
513 516
514 boolean result = this.userOperationService.minaBind(resources); 517 return ResultInfo.success(this.userOperationService.minaBind(resources));
515 return ResultInfo.success(result);
516 } 518 }
517 519
518 @PostMapping("/minaUnbind") 520 @PostMapping("/minaUnbind")
519 @ApiOperation("小屏解绑") 521 @ApiOperation("小屏解绑")
520 @AnonymousAccess 522 @AnonymousAccess
521 public ResultInfo minaUnbind(@Validated(value = {UnbindGroup.class}) @RequestBody WeixinUnBindBean weixinUnBindBean) { 523 public ResultInfo minaUnbind(@Validated(value = {UnbindGroup.class}) @RequestBody WeixinUnBindBean weixinUnBindBean) {
522 log.info("小屏解绑,参数 ==> [minaUnbind#{}]", weixinUnBindBean); 524 log.info("小屏解绑,参数 minaUnbind# resource ==>> {}", weixinUnBindBean);
523 525
524 Long memberId = weixinUnBindBean.getMemberId(); 526 Long memberId = weixinUnBindBean.getMemberId();
525 if (Objects.isNull(memberId)) { 527 if (Objects.isNull(memberId)) {
526 log.error("小屏解绑失败,参数错误,memberId不存在"); 528 log.error("小屏解绑失败,参数错误,minaUnbind# message ==>> memberId不存在");
527 return ResultInfo.failure("参数错误,无会员id"); 529 return ResultInfo.failure("参数错误,会员id不的为空");
528 } 530 }
529 531
530 return this.userOperationService.minaUnbind(weixinUnBindBean); 532 return this.userOperationService.minaUnbind(weixinUnBindBean);
...@@ -535,29 +537,25 @@ public class UserOperationController { ...@@ -535,29 +537,25 @@ public class UserOperationController {
535 * 1.未关注、未绑定 537 * 1.未关注、未绑定
536 * 2.已绑定、未关注 538 * 2.已绑定、未关注
537 * 3.已关注、未绑定 539 * 3.已关注、未绑定
538 * @param data
539 * @return
540 */ 540 */
541 @PostMapping(value = "/memberPreprocess") 541 @PostMapping(value = "/memberPreprocess")
542 @ApiOperation("暂存大小屏信息并检查关注与绑定状态") 542 @ApiOperation("暂存大小屏信息并检查关注与绑定状态")
543 @AnonymousAccess 543 @AnonymousAccess
544 public ResultInfo memberPreprocess(@RequestBody String data) { 544 public ResultInfo memberPreprocess(@RequestBody String data) {
545 log.info("暂存大小屏信息并检查关注与绑定状态,参数 memberPreprocess# resource ==>> {}", data);
545 546
546 log.info("UserOperationController ==> saveUserInfo ==>> param ==>> [{}]",data);
547 if (StringUtils.isBlank(data)) { 547 if (StringUtils.isBlank(data)) {
548 log.error("预存大小屏账号信息失败,无参数"); 548 log.error("预存大小屏账号信息异常,memberPreprocess# message ==>> 无参数");
549 return ResultInfo.failure("参数错误"); 549 return ResultInfo.failure("参数错误,无参数");
550 } 550 }
551 551
552 JSONObject json = JSONObject.parseObject(data); 552 JSONObject json = JSONObject.parseObject(data);
553
554 String unionid = json.getString("unionid"); 553 String unionid = json.getString("unionid");
555 if (StringUtils.isBlank(unionid)) { 554 if (StringUtils.isBlank(unionid)) {
556 log.error("预存大小屏账号信息失败,参数错误,unionid不存在"); 555 log.error("预存大小屏账号信息异常,memberPreprocess# message ==>> unionid不的为空");
557 return ResultInfo.failure("参数错误,unionid不存在"); 556 return ResultInfo.failure("参数错误,unionid不的为空");
558 } 557 }
559 558
560
561 List<Object> resultList = new ArrayList<>(); 559 List<Object> resultList = new ArrayList<>();
562 // 大屏侧通过返回值来展示对应的小程序页面 560 // 大屏侧通过返回值来展示对应的小程序页面
563 String result = SUBSCRIBE; 561 String result = SUBSCRIBE;
...@@ -572,7 +570,6 @@ public class UserOperationController { ...@@ -572,7 +570,6 @@ public class UserOperationController {
572 result = UNSUBSCRIBE; 570 result = UNSUBSCRIBE;
573 resultList.add(result); 571 resultList.add(result);
574 resultList.add(platformAccount1); 572 resultList.add(platformAccount1);
575 log.info("saveUserInfo ==>> result ==>> [{}]",resultList);
576 return ResultInfo.success(resultList); 573 return ResultInfo.success(resultList);
577 574
578 } else { 575 } else {
...@@ -597,8 +594,8 @@ public class UserOperationController { ...@@ -597,8 +594,8 @@ public class UserOperationController {
597 } else { 594 } else {
598 595
599 // 数据异常,没有会员 596 // 数据异常,没有会员
600 log.info("userWeixinDTO ==>> [{}]",userWeixinDTO); 597 log.error("预存大小屏账号信息异常,memberPreprocess# message ==>> 会员不存在");
601 throw new EntityNotFoundException(MemberDTO.class,"code","member is null !!"); 598 return ResultInfo.failure("会员不存在");
602 599
603 } 600 }
604 601
...@@ -612,23 +609,21 @@ public class UserOperationController { ...@@ -612,23 +609,21 @@ public class UserOperationController {
612 String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionid)); 609 String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionid));
613 JSONObject iptvUserInfo = JSONObject.parseObject(content); 610 JSONObject iptvUserInfo = JSONObject.parseObject(content);
614 // redis中的大小屏信息 611 // redis中的大小屏信息
615 log.info("saveUserInfo ==> redis content iptvUserInfo ==> [{}]",iptvUserInfo); 612 log.info("预存大小屏账号信息,保存在redis中的信息,memberPreprocess# message ==> {}", iptvUserInfo);
616 613
617 // 大屏账户 614 // 大屏账户
618 String platformAccount = iptvUserInfo.getString("platformAccount"); 615 String platformAccount = iptvUserInfo.getString("platformAccount");
619 616
620 if (StringUtils.isBlank(platformAccount)) { 617 if (StringUtils.isBlank(platformAccount)) {
621 log.warn("绑定失败,platformAccount is null "); 618 log.error("预存大小屏账号信息警告,memberPreprocess# message ==> 大屏账号不存在 ");
622 return ResultInfo.failure("绑定失败"); 619 return ResultInfo.failure("绑定失败");
623 } 620 }
624 621
625 622 // 保存昵称和头像,头像需要进行本地化
626 try { 623 try {
627 String headimgurl = iptvUserInfo.get("headimgurl").toString(); 624 String headimgurl = iptvUserInfo.get("headimgurl").toString();
628
629 log.info("headimgurl ==>> {}", headimgurl);
630
631 String nickname = iptvUserInfo.get("nickname").toString(); 625 String nickname = iptvUserInfo.get("nickname").toString();
626
632 if (StringUtils.isNotBlank(nickname)) { 627 if (StringUtils.isNotBlank(nickname)) {
633 String nicknameDecode = URLDecoder.decode(nickname, "UTF-8"); 628 String nicknameDecode = URLDecoder.decode(nickname, "UTF-8");
634 String nicknameEncode = Base64Util.encode(nicknameDecode); 629 String nicknameEncode = Base64Util.encode(nicknameDecode);
...@@ -636,14 +631,11 @@ public class UserOperationController { ...@@ -636,14 +631,11 @@ public class UserOperationController {
636 } 631 }
637 632
638 if (StringUtils.isNotBlank(headimgurl)) { 633 if (StringUtils.isNotBlank(headimgurl)) {
639
640 if(headimgurl.contains("https")||headimgurl.contains("http")) { 634 if(headimgurl.contains("https")||headimgurl.contains("http")) {
641 String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); 635 String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8");
642 // String imageEncode = Base64Util.encode(headimgurlDecode);
643 String image = RestTemplateClient.netImage(headimgurlDecode); 636 String image = RestTemplateClient.netImage(headimgurlDecode);
644 memberDTO.setAvatarUrl(StringUtils.isNotBlank(image) ? image:headimgurlDecode); 637 memberDTO.setAvatarUrl(StringUtils.isNotBlank(image) ? image:headimgurlDecode);
645 } 638 }
646
647 } 639 }
648 640
649 } catch (Exception e) { 641 } catch (Exception e) {
...@@ -665,12 +657,7 @@ public class UserOperationController { ...@@ -665,12 +657,7 @@ public class UserOperationController {
665 657
666 resultList.add(result); 658 resultList.add(result);
667 resultList.add(platformAccount1); 659 resultList.add(platformAccount1);
668 660 return ResultInfo.success(resultList);
669 // return ["subscribe","platform_account"]
670 ResultInfo<Object> success = ResultInfo.success(resultList);
671
672 log.info("saveUserInfo ==> ResultInfo ==> [{}]",success);
673 return success;
674 } 661 }
675 662
676 private String downloadWeixinImge(String headimgurl){ 663 private String downloadWeixinImge(String headimgurl){
...@@ -693,20 +680,18 @@ public class UserOperationController { ...@@ -693,20 +680,18 @@ public class UserOperationController {
693 @ApiOperation("修改大屏账号") 680 @ApiOperation("修改大屏账号")
694 @AnonymousAccess 681 @AnonymousAccess
695 public ResultInfo updateUserTv(@Validated(value = {UpdateGroup.class}) @RequestBody UserTv resources) { 682 public ResultInfo updateUserTv(@Validated(value = {UpdateGroup.class}) @RequestBody UserTv resources) {
696 log.info("UserOperationController ==> updateUserTv ==>> param ==> [{}]",resources); 683 log.info("修改大屏账号,参数 updateUserTv# resources ==>> {}",resources);
697 684 return ResultInfo.success(this.userOperationService.updateUserTv(resources));
698 UserTvDTO result = this.userOperationService.updateUserTv(resources);
699 return ResultInfo.success(result);
700 } 685 }
701 686
702 @PostMapping(value = "/createTvUserAndMember") 687 @PostMapping(value = "/createTvUserAndMember")
703 @ApiOperation("保存大屏账户同时创建会员信息") 688 @ApiOperation("保存大屏账户同时创建会员信息")
704 @AnonymousAccess 689 @AnonymousAccess
705 public ResultInfo createTvUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) { 690 public ResultInfo createTvUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) {
706 log.info("保存大屏账户同时创建会员信息, 参数 createTvUserAndMember# resources ==> {}",resources); 691 log.info("保存大屏账户同时创建会员信息, 参数 createTvUserAndMember# resources ==> {}",resources);
707 String platformAccount = resources.getPlatformAccount(); 692 String platformAccount = resources.getPlatformAccount();
708 if (StringUtils.isBlank(platformAccount)) { 693 if (StringUtils.isBlank(platformAccount)) {
709 log.error("保存大屏账户同时创建会员信息异常,参数错误,大屏账号不存在"); 694 log.error("保存大屏账户同时创建会员信息异常,createTvUserAndMember# message ==>> 大屏账号不存在");
710 return ResultInfo.failure("参数错误,大屏账号不存在"); 695 return ResultInfo.failure("参数错误,大屏账号不存在");
711 } 696 }
712 return this.userOperationService.createTvUserAndMember(resources); 697 return this.userOperationService.createTvUserAndMember(resources);
...@@ -716,94 +701,84 @@ public class UserOperationController { ...@@ -716,94 +701,84 @@ public class UserOperationController {
716 @ApiOperation("大屏解绑") 701 @ApiOperation("大屏解绑")
717 @AnonymousAccess 702 @AnonymousAccess
718 public ResultInfo tvUnbind(@Validated(value = {UpdateGroup.class}) @RequestBody TvUnBindBean resources) { 703 public ResultInfo tvUnbind(@Validated(value = {UpdateGroup.class}) @RequestBody TvUnBindBean resources) {
719 log.info("UserOperationController ==> unbind ==>> param ==> [{}]",resources); 704 log.info("大屏解绑, 参数 tvUnbind# resources ==> {}", resources);
720 705
721 String memberCode = resources.getMemberCode(); 706 String memberCode = resources.getMemberCode();
722 log.info("大屏解绑,前端参数,需要解绑的会员code,memberCode ==>> {}", memberCode);
723 if (StringUtils.isBlank(memberCode)) { 707 if (StringUtils.isBlank(memberCode)) {
724 throw new BadRequestException(GlobeExceptionMsg.MEMBER_CODE_IS_NULL); 708 log.error("大屏解绑异常,tvUnbind# message ==>> 会员code不的为空");
709 return ResultInfo.failure("会员code不的为空");
725 } 710 }
726 711
727 String platformAccount = resources.getPlatformAccount(); 712 String platformAccount = resources.getPlatformAccount();
728 log.info("大屏解绑,前端参数,大屏账号,platformAccount ==>> {}", platformAccount);
729 if (StringUtils.isBlank(platformAccount)) { 713 if (StringUtils.isBlank(platformAccount)) {
730 throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL); 714 log.error("大屏解绑异常,tvUnbind# message ==>> 大屏账号不得为空");
715 return ResultInfo.failure("大屏账号不的为空");
731 } 716 }
732 717
733 boolean b = this.userOperationService.tvUnbind(resources); 718 if (this.userOperationService.tvUnbind(resources)) {
734 if (b) {
735 return ResultInfo.success("解绑成功"); 719 return ResultInfo.success("解绑成功");
736 } else return ResultInfo.failure("解绑失败"); 720 }
721
722 return ResultInfo.failure("解绑失败");
737 } 723 }
738 724
739 @RequestMapping(value = "/changeMainAccount") 725 @RequestMapping(value = "/changeMainAccount")
740 @ApiOperation("大屏更换主账号") 726 @ApiOperation("大屏更换主账号")
741 @AnonymousAccess 727 @AnonymousAccess
742 public ResultInfo changeMainAccount(@Validated(value = {UpdateGroup.class}) @RequestBody BindBean resources) { 728 public ResultInfo changeMainAccount(@Validated(value = {UpdateGroup.class}) @RequestBody BindBean resources) {
743 log.info("大屏更换主账号,参数 [changeMainAccount# ==> {}]",resources); 729 log.info("大屏更换主账号,参数 changeMainAccount# resources ==>> {}", resources);
744 730
745 // Long memberId = resources.getMemberId();
746 String memberCode = resources.getMemberCode(); 731 String memberCode = resources.getMemberCode();
747 /* if (StringUtils.isBlank(memberCode) && Objects.nonNull(memberId)) { 732 if (StringUtils.isBlank(memberCode)) {
748 memberCode = this.memberService.findCodeById(memberId); 733 log.error("大屏更换主账号异常,changeMainAccount# message ==>> 会员code不的为空");
749 } else if (StringUtils.isNotBlank(memberCode) && Objects.isNull(memberId)) { 734 return ResultInfo.failure("会员code不的为空");
750 MemberDTO memberDTO = this.memberService.findByCode(memberCode); 735 }
751 memberCode = memberDTO.getCode();
752 }*/
753
754 if (StringUtils.isBlank(memberCode))
755 return ResultInfo.failure("会员code不得为空");
756 736
757 MemberDTO memberDTO = this.memberService.findByCode(memberCode); 737 MemberDTO memberDTO = this.memberService.findByCode(memberCode);
758 if (Objects.isNull(memberDTO.getId())) { 738 if (Objects.isNull(memberDTO.getId())) {
759 log.error("大屏更换主账号失败,会员信息不存在, changeMainAccount# ==> {}", memberCode); 739 log.error("大屏更换主账号异常,changeMainAccount# message ==>> 会员信息不存在 | memberCode ==>> {}", memberCode);
760 return ResultInfo.failure("会员信息不存在"); 740 return ResultInfo.failure("会员信息不存在");
761 } 741 }
762 742
763 String platformAccount = resources.getPlatformAccount(); 743 String platformAccount = resources.getPlatformAccount();
764 if (StringUtils.isBlank(platformAccount)) 744 if (StringUtils.isBlank(platformAccount)) {
765 throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL); 745 log.error("大屏更换主账号异常,changeMainAccount# message ==>> 大屏账号不存在 | platformAccount ==>> {}", memberCode);
746 return ResultInfo.failure("大屏账号不存在");
747 }
766 748
767 UserTv userTv = new UserTv(); 749 UserTv userTv = new UserTv();
768 userTv.setMemberCode(memberCode); 750 userTv.setMemberCode(memberCode);
769 userTv.setPlatformAccount(platformAccount); 751 userTv.setPlatformAccount(platformAccount);
770 boolean b = this.userOperationService.changeMainAccount(userTv); 752 return ResultInfo.success(this.userOperationService.changeMainAccount(userTv));
771
772 return ResultInfo.success(b);
773 } 753 }
774 754
775 @PostMapping(value = "/deleteAllCollection") 755 @PostMapping(value = "/deleteAllCollection")
776 @ApiOperation("删除全部收藏") 756 @ApiOperation("删除全部收藏")
777 @AnonymousAccess 757 @AnonymousAccess
778 public ResultInfo deleteAllCollection(@RequestBody String content) { 758 public ResultInfo deleteAllCollection(@RequestBody String content) {
779 log.info("UserOperationController ==> deleteAllCollection ==> param ==> [{}]",content); 759 log.info("删除全部收藏,参数 deleteAllCollection# resources ==> {}", content);
780 760 return ResultInfo.success(this.userOperationService.deleteAllCollection(content));
781 boolean result = this.userOperationService.deleteAllCollection(content);
782 return ResultInfo.success(result);
783 } 761 }
784 762
785 @PostMapping(value = "/deleteCollection") 763 @PostMapping(value = "/deleteCollection")
786 @ApiOperation("删除收藏") 764 @ApiOperation("删除收藏")
787 @AnonymousAccess 765 @AnonymousAccess
788 public ResultInfo deleteCollection(@RequestBody String content) { 766 public ResultInfo deleteCollection(@RequestBody String content) {
789 log.info("UserOperationController ==> deleteCollection ==> param ==> [{}]",content); 767 log.info("删除收藏,参数 deleteCollection# resources ==> {}", content);
790 768 return ResultInfo.success(this.userOperationService.deleteCollection(content));
791 boolean result = this.userOperationService.deleteCollection(content);
792 return ResultInfo.success(result);
793 } 769 }
794 770
795 @PostMapping(value = "/addCollection") 771 @PostMapping(value = "/addCollection")
796 @ApiOperation("添加收藏") 772 @ApiOperation("添加收藏")
797 @AnonymousAccess 773 @AnonymousAccess
798 public ResultInfo addCollection(@RequestBody String content) { 774 public ResultInfo addCollection(@RequestBody String content) {
799 log.info("UserOperationController ==> addCollection ==>> param ==> [{}]",content); 775 log.info("添加收藏,参数 addCollection# ==>> {}", content);
800 if (StringUtils.isNotBlank(content)) { 776 if (StringUtils.isNotBlank(content)) {
801 boolean result = this.userOperationService.addCollection(content); 777 return ResultInfo.success(this.userOperationService.addCollection(content));
802 return ResultInfo.success(result);
803 } 778 }
804 return ResultInfo.success();
805 }
806 779
780 return ResultInfo.failure("无参数");
781 }
807 782
808 } 783 }
809 784
......
...@@ -31,14 +31,14 @@ public interface UserOperationService { ...@@ -31,14 +31,14 @@ public interface UserOperationService {
31 * @param resources 31 * @param resources
32 * @return 32 * @return
33 */ 33 */
34 UserWeixinDTO createWeixinUserAndMember(UserWeixin resources); 34 ResultInfo createWeixinUserAndMember(UserWeixin resources);
35 35
36 /** 36 /**
37 * 保存小屏账户并创建会员 37 * 保存小屏账户并创建会员
38 * @param resources 38 * @param resources
39 * @return 39 * @return
40 */ 40 */
41 UserWeixinDTO createWeixinUserAndMember(UserWeixin resources, Integer vip); 41 ResultInfo createWeixinUserAndMember(UserWeixin resources, Integer vip);
42 42
43 /** 43 /**
44 * 服务号(H5)登录 44 * 服务号(H5)登录
...@@ -205,18 +205,15 @@ public interface UserOperationService { ...@@ -205,18 +205,15 @@ public interface UserOperationService {
205 205
206 /** 206 /**
207 * 207 *
208 * @param resources 208 * @param growthReport
209 * @return 209 * @return
210 */ 210 */
211 boolean updatePasswordById(UserApp resources); 211 ResultInfo saveGrowthReport(GrowthReport growthReport);
212 212
213 /** 213 /**
214 * 214 *
215 * @param growthReport 215 * @param userApp
216 * @return 216 * @return
217 */ 217 */
218 ResultInfo saveGrowthReport(GrowthReport growthReport);
219
220
221 boolean appCancellation(UserApp userApp); 218 boolean appCancellation(UserApp userApp);
222 } 219 }
......
...@@ -128,18 +128,16 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -128,18 +128,16 @@ public class UserOperationServiceImpl implements UserOperationService {
128 @Transactional(rollbackFor = Exception.class) 128 @Transactional(rollbackFor = Exception.class)
129 public UserAppDTO appRegister(UserApp resources) { 129 public UserAppDTO appRegister(UserApp resources) {
130 130
131 // 只查询有效或者禁止状态的
131 UserAppDTO userAppDTO = this.userAppService.findByUsername(resources.getUsername()); 132 UserAppDTO userAppDTO = this.userAppService.findByUsername(resources.getUsername());
132 if (Objects.isNull(userAppDTO.getId())) {
133
134 // 先创建会员
135 Member member = MemberBuilder.build(MemberTypeConstant.app, resources.getHeadimgurl(), resources.getNickname(), 0);
136 MemberDTO memberDTO = this.memberService.create(member);
137 133
134 // 无app账号
135 if (Objects.isNull(userAppDTO.getId())) {
136 // 先创建会员,缓存至redis
137 MemberDTO memberDTO = this.createMember(MemberBuilder.build(MemberTypeConstant.app, resources.getHeadimgurl(), resources.getNickname(), 0));
138 if (Objects.nonNull(memberDTO.getId())) { 138 if (Objects.nonNull(memberDTO.getId())) {
139
140 // 保存app账号 139 // 保存app账号
141 UserAppDTO _userAppDTO = this.userAppService.create(UserAppBuilder.build(memberDTO.getId(), resources)); 140 UserAppDTO _userAppDTO = this.userAppService.create(UserAppBuilder.build(memberDTO.getId(), resources));
142
143 if (Objects.nonNull(_userAppDTO.getId()) && StringUtils.isNotBlank(resources.getAccount())) { 141 if (Objects.nonNull(_userAppDTO.getId()) && StringUtils.isNotBlank(resources.getAccount())) {
144 UserAppBindDTO userAppBindDTO = this.userAppBindService.findFirstByAccount(resources.getAccount()); 142 UserAppBindDTO userAppBindDTO = this.userAppBindService.findFirstByAccount(resources.getAccount());
145 if (Objects.isNull(userAppBindDTO.getId())) { 143 if (Objects.isNull(userAppBindDTO.getId())) {
...@@ -152,18 +150,27 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -152,18 +150,27 @@ public class UserOperationServiceImpl implements UserOperationService {
152 } 150 }
153 } 151 }
154 152
155 153 // 同步至大屏侧
156 AppRegisterDTO appRegisterDTO = new AppRegisterDTO(); 154 AppRegisterDTO appRegisterDTO = new AppRegisterDTO();
157 appRegisterDTO.setMemberDTO(memberDTO); 155 appRegisterDTO.setMemberDTO(memberDTO);
158 appRegisterDTO.setUserAppDTO(_userAppDTO); 156 appRegisterDTO.setUserAppDTO(_userAppDTO);
159 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncAppRegister(appRegisterDTO); 157 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncAppRegister(appRegisterDTO);
160 158
161 return _userAppDTO; 159 try {
160 Map<Object, Object> appCache = new HashMap<>();
161 appCache.put("id", _userAppDTO.getId());
162 appCache.put("memberId", _userAppDTO.getMemberId());
163 boolean appCacheResult = this.redisUtils.set(RedisKeyConstants.cacheAppById + ":" + _userAppDTO.getId(), appCache);
164 log.info("app注册时,缓存app账号信息,appRegister# appCacheResult ==>> "+ appCacheResult);
165 } catch (Exception e) {
166 log.error("app注册时,缓存app账号信息异常,appRegister# message ==>> {}", e.getMessage());
167 }
162 168
169 return _userAppDTO;
163 } 170 }
164
165 } 171 }
166 172
173 // app账号存在的话直接返回
167 return userAppDTO; 174 return userAppDTO;
168 } 175 }
169 176
...@@ -176,16 +183,18 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -176,16 +183,18 @@ public class UserOperationServiceImpl implements UserOperationService {
176 if (Objects.nonNull(userAppBindDTO.getUserAppId())) { 183 if (Objects.nonNull(userAppBindDTO.getUserAppId())) {
177 UserAppDTO userAppDTO = this.userAppService.findById(userAppBindDTO.getUserAppId()); 184 UserAppDTO userAppDTO = this.userAppService.findById(userAppBindDTO.getUserAppId());
178 if (Objects.isNull(userAppDTO.getId())) { 185 if (Objects.isNull(userAppDTO.getId())) {
186 log.error("解绑第三方账号失败异常,cancelUserAppBind# message ==>> app账号不存在");
179 return ResultInfo.failure("app账号不存在"); 187 return ResultInfo.failure("app账号不存在");
180 } 188 }
181 } 189 }
182 boolean b = this.userAppBindService.cancelUserAppBind(account, accountType); 190
183 if (b) { 191 if (this.userAppBindService.cancelUserAppBind(account, accountType)) {
184 return ResultInfo.success(true); 192 return ResultInfo.success(true);
185 } 193 }
186 } 194 }
187 195
188 return ResultInfo.failure("取消绑定失败"); 196 log.error("解绑第三方账号失败异常,cancelUserAppBind# message ==>> 无第三方账号");
197 return ResultInfo.failure("解绑第三方账号失败,无第三方账号");
189 } 198 }
190 199
191 200
...@@ -197,7 +206,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -197,7 +206,7 @@ public class UserOperationServiceImpl implements UserOperationService {
197 String nickname = resources.getNickname(); 206 String nickname = resources.getNickname();
198 207
199 UserAppDTO userAppDTO = this.userAppService.findByUsername(username); 208 UserAppDTO userAppDTO = this.userAppService.findByUsername(username);
200 log.info("通过app账号查询app信息是否存在,[appBindThirdAccount#{}]", userAppDTO); 209 log.info("查询app信息,appBindThirdAccount# userAppDTO ==>> {}", userAppDTO);
201 if (Objects.isNull(userAppDTO.getId())) { 210 if (Objects.isNull(userAppDTO.getId())) {
202 return ResultInfo.failure("app账号不存在"); 211 return ResultInfo.failure("app账号不存在");
203 } 212 }
...@@ -236,7 +245,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -236,7 +245,7 @@ public class UserOperationServiceImpl implements UserOperationService {
236 } 245 }
237 } 246 }
238 userApp.setNickname(nickname); 247 userApp.setNickname(nickname);
239 log.info("同步app账号的昵称、头像,[appBindThirdAccount#{}]", userAppDTO); 248 log.info("修改数据库,修改app账号的昵称、头像,appBindThirdAccount# userApp ==>> {}", userApp);
240 boolean result = this.userAppService.updateAppLastActiveTimeAndNicknameAndHeadImg(userApp); 249 boolean result = this.userAppService.updateAppLastActiveTimeAndNicknameAndHeadImg(userApp);
241 if (result) { 250 if (result) {
242 UserAppDTO userAppDTO1 = new UserAppDTO(); 251 UserAppDTO userAppDTO1 = new UserAppDTO();
...@@ -247,6 +256,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -247,6 +256,7 @@ public class UserOperationServiceImpl implements UserOperationService {
247 256
248 if (Objects.nonNull(userAppBindDTO.getId())) { 257 if (Objects.nonNull(userAppBindDTO.getId())) {
249 resources.setUserAppId(userAppDTO.getId()); 258 resources.setUserAppId(userAppDTO.getId());
259 log.info("修改数据库,修改绑定关系的昵称、头像,updateValidStatusAndUserAppIdAndNickname# resources ==>> {}", resources);
250 boolean result = this.userAppBindService.updateValidStatusAndUserAppIdAndNickname(resources); 260 boolean result = this.userAppBindService.updateValidStatusAndUserAppIdAndNickname(resources);
251 if (result) { 261 if (result) {
252 UserAppDTO userAppDTO1 = new UserAppDTO(); 262 UserAppDTO userAppDTO1 = new UserAppDTO();
...@@ -259,7 +269,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -259,7 +269,7 @@ public class UserOperationServiceImpl implements UserOperationService {
259 } else { 269 } else {
260 resources.setUserAppId(userAppDTO.getId()); 270 resources.setUserAppId(userAppDTO.getId());
261 resources.setStatus(1); 271 resources.setStatus(1);
262 log.info("第三方账号不存在,新增关联关系[appBindThirdAccount#{}]", resources); 272 log.info("保存关联关系,updateValidStatusAndUserAppIdAndNickname# resources ==>> {}", resources);
263 this.userAppBindService.create(resources); 273 this.userAppBindService.create(resources);
264 274
265 UserAppDTO userAppDTO1 = new UserAppDTO(); 275 UserAppDTO userAppDTO1 = new UserAppDTO();
...@@ -273,7 +283,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -273,7 +283,7 @@ public class UserOperationServiceImpl implements UserOperationService {
273 283
274 @Override 284 @Override
275 public UserAppSimpleDTO updateAppInfo(UserApp resources) { 285 public UserAppSimpleDTO updateAppInfo(UserApp resources) {
276 286 log.info("修改app信息,updateValidStatusAndUserAppIdAndNickname# resources ==>> {}", resources);
277 UserAppSimpleDTO userAppSimpleDTO = this.userAppService.updateAppInfo(resources); 287 UserAppSimpleDTO userAppSimpleDTO = this.userAppService.updateAppInfo(resources);
278 if (Objects.nonNull(userAppSimpleDTO.getId())) { 288 if (Objects.nonNull(userAppSimpleDTO.getId())) {
279 UserAppDTO userAppDTO = new UserAppDTO(); 289 UserAppDTO userAppDTO = new UserAppDTO();
...@@ -281,26 +291,10 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -281,26 +291,10 @@ public class UserOperationServiceImpl implements UserOperationService {
281 userAppDTO.setUsername(userAppSimpleDTO.getUsername()); 291 userAppDTO.setUsername(userAppSimpleDTO.getUsername());
282 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUpdateAppInfo(userAppDTO); 292 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUpdateAppInfo(userAppDTO);
283 } 293 }
284 return userAppSimpleDTO;
285 }
286
287
288 294
289 @Override 295 return userAppSimpleDTO;
290 public boolean updatePasswordById(UserApp resources) {
291 UserAppDTO userAppDTO = this.userAppService.findById(resources.getId());
292 if (Objects.nonNull(userAppDTO.getId())) {
293 if (this.userAppService.updatePasswordById(resources)) {
294 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUpdatePasswordByUsername(userAppDTO);
295 return true;
296 }
297
298 }
299 return false;
300 } 296 }
301 297
302
303
304 @Override 298 @Override
305 @Transactional(rollbackFor = Exception.class) 299 @Transactional(rollbackFor = Exception.class)
306 public ResultInfo saveGrowthReport(GrowthReport growthReport) { 300 public ResultInfo saveGrowthReport(GrowthReport growthReport) {
...@@ -308,7 +302,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -308,7 +302,7 @@ public class UserOperationServiceImpl implements UserOperationService {
308 302
309 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); 303 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
310 if (Objects.isNull(userTvDTO.getId())) { 304 if (Objects.isNull(userTvDTO.getId())) {
311 log.error("保存成长报告失败,大屏信息不存在[saveGrowthReport#]"); 305 log.error("保存成长报告异常,saveGrowthReport# message ==>> 大屏信息不存在 | platformAccount ==>> {}", platformAccount);
312 return ResultInfo.failure("保存成长报告失败,大屏信息不存在"); 306 return ResultInfo.failure("保存成长报告失败,大屏信息不存在");
313 } 307 }
314 308
...@@ -322,10 +316,10 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -322,10 +316,10 @@ public class UserOperationServiceImpl implements UserOperationService {
322 growthReport.setMemberId(memberId); 316 growthReport.setMemberId(memberId);
323 growthReport.setStartDate(weekFirstDay); 317 growthReport.setStartDate(weekFirstDay);
324 growthReport.setEndDate(weekLastDay); 318 growthReport.setEndDate(weekLastDay);
325 log.info("保存成长报告,参数[saveGrowthReport#{}]", growthReport); 319 log.info("保存成长报告,saveGrowthReport# message ==>> {}", growthReport);
326 this.growthReportService.create(growthReport); 320 this.growthReportService.create(growthReport);
327 } else { 321 } else {
328 log.info("修改成长报告,参数[saveGrowthReport#{}]", growthReport); 322 log.info("修改成长报告,saveGrowthReport# message ==>> {}", growthReport);
329 this.growthReportService.updateGrowthReportData(growthReportDTO.getId(), growthReport.getData()); 323 this.growthReportService.updateGrowthReportData(growthReportDTO.getId(), growthReport.getData());
330 } 324 }
331 325
...@@ -338,12 +332,11 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -338,12 +332,11 @@ public class UserOperationServiceImpl implements UserOperationService {
338 public boolean appCancellation(UserApp userApp) { 332 public boolean appCancellation(UserApp userApp) {
339 UserAppDTO userAppDTO = this.userAppService.findById(userApp.getId()); 333 UserAppDTO userAppDTO = this.userAppService.findById(userApp.getId());
340 if (Objects.nonNull(userAppDTO.getId())){ 334 if (Objects.nonNull(userAppDTO.getId())){
341 boolean b = this.userAppService.appCancellation(userApp.getId()); 335 if (this.userAppService.appCancellation(userApp.getId())) {
342 if (b) {
343 List<UserAppBindDTO> userAppBindDTOS = this.userAppBindService.findByUserAppId(userAppDTO.getId()); 336 List<UserAppBindDTO> userAppBindDTOS = this.userAppBindService.findByUserAppId(userAppDTO.getId());
344 if (!CollectionUtils.isEmpty(userAppBindDTOS)) { 337 if (!CollectionUtils.isEmpty(userAppBindDTOS)) {
345 List<Long> ids = userAppBindDTOS.stream().map(UserAppBindDTO::getId).collect(Collectors.toList()); 338 List<Long> ids = userAppBindDTOS.stream().map(UserAppBindDTO::getId).collect(Collectors.toList());
346 this.userAppBindService.appCancellation(ids); 339 return this.userAppBindService.appCancellation(ids);
347 } 340 }
348 341
349 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncAppCancellation(userAppDTO); 342 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncAppCancellation(userAppDTO);
...@@ -351,7 +344,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -351,7 +344,7 @@ public class UserOperationServiceImpl implements UserOperationService {
351 344
352 } 345 }
353 346
354 return true; 347 return false;
355 } 348 }
356 349
357 /** 350 /**
...@@ -368,30 +361,22 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -368,30 +361,22 @@ public class UserOperationServiceImpl implements UserOperationService {
368 String platformAccount = resources.getPlatformAccount(); 361 String platformAccount = resources.getPlatformAccount();
369 362
370 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); 363 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
371
372 // 无账号 364 // 无账号
373 if (Objects.isNull(userTvDTO.getId())) { 365 if (Objects.isNull(userTvDTO.getId())) {
374
375 // 会员昵称默认采用大屏账号,昵称通过base64加密与小屏保持一致 366 // 会员昵称默认采用大屏账号,昵称通过base64加密与小屏保持一致
376 String platformAccountEncode = Base64Utils.encodeToString(platformAccount.getBytes()); 367 String platformAccountEncode = Base64Utils.encodeToString(platformAccount.getBytes());
377
378 // x_member 368 // x_member
379 MemberDTO memberDTO = this.createMember(MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_VIS, 369 MemberDTO memberDTO = this.createMember(MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_VIS,
380 null, platformAccountEncode, 0)); 370 null, platformAccountEncode, 0));
381
382 if (Objects.nonNull(memberDTO)) { 371 if (Objects.nonNull(memberDTO)) {
383
384 UserTv userTv = UserTvBuilder.build(memberDTO.getId(), memberDTO.getCode(), resources); 372 UserTv userTv = UserTvBuilder.build(memberDTO.getId(), memberDTO.getCode(), resources);
385 // 创建大屏账户 373 // 创建大屏账户
386 UserTvDTO _tvUserDTO = this.createTvUser(userTv, memberDTO.getId(), memberDTO.getCode()); 374 UserTvDTO _tvUserDTO = this.createTvUser(userTv, memberDTO.getId(), memberDTO.getCode());
387
388 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncMemberAndUserTv4Iptv(new MemberAndUserTvDTO(memberDTO, _tvUserDTO)); 375 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncMemberAndUserTv4Iptv(new MemberAndUserTvDTO(memberDTO, _tvUserDTO));
389
390 return ResultInfo.success(_tvUserDTO); 376 return ResultInfo.success(_tvUserDTO);
391
392 } 377 }
393 378
394 log.error("保存大屏账号信息异常,无法创建大屏账号对应的会员,createTvUserAndMember# ==> {}", platformAccount); 379 log.error("保存大屏账号信息异常,createTvUserAndMember# message ==> 会员创建失败");
395 return ResultInfo.failure(GlobeExceptionMsg.MEMBER_ID_IS_NULL); 380 return ResultInfo.failure(GlobeExceptionMsg.MEMBER_ID_IS_NULL);
396 381
397 // 有账号 382 // 有账号
...@@ -433,12 +418,17 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -433,12 +418,17 @@ public class UserOperationServiceImpl implements UserOperationService {
433 */ 418 */
434 @Override 419 @Override
435 @Transactional(rollbackFor = Exception.class) 420 @Transactional(rollbackFor = Exception.class)
436 public UserWeixinDTO createWeixinUserAndMember(UserWeixin resources) { 421 public ResultInfo createWeixinUserAndMember(UserWeixin resources) {
437 return this.createWeixinUserAndMember(resources, 0); 422 return this.createWeixinUserAndMember(resources, 0);
438 } 423 }
439 424
440 @Override 425 @Override
441 public UserWeixinDTO createWeixinUserAndMember(UserWeixin resources, Integer vip) { 426 public ResultInfo createWeixinUserAndMember(UserWeixin resources, Integer vip) {
427 UserWeixinDTO userWeixinDTO = this.createWeixinAndMember(resources, vip);
428 return ResultInfo.success(userWeixinDTO);
429 }
430
431 private UserWeixinDTO createWeixinAndMember(UserWeixin resources, Integer vip){
442 String appId = resources.getAppid(); 432 String appId = resources.getAppid();
443 String openId = resources.getOpenid(); 433 String openId = resources.getOpenid();
444 String unionId = resources.getUnionid(); 434 String unionId = resources.getUnionid();
...@@ -449,8 +439,8 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -449,8 +439,8 @@ public class UserOperationServiceImpl implements UserOperationService {
449 // 小屏账号 439 // 小屏账号
450 UserWeixinDTO userWeixinDTO = this.findFirstByAppIdAndOpenId(appId, openId); 440 UserWeixinDTO userWeixinDTO = this.findFirstByAppIdAndOpenId(appId, openId);
451 if (Objects.nonNull(userWeixinDTO.getId()) && Objects.nonNull(userWeixinDTO.getMemberId())) { 441 if (Objects.nonNull(userWeixinDTO.getId()) && Objects.nonNull(userWeixinDTO.getMemberId())) {
452 log.error("createWeixinUserAndMember ==>> result ==>> [{}]", userWeixinDTO); 442 log.warn("创建微信账号时异常,createWeixinUserAndMember# message ==>> 微信账号已存在 | userWeixinDTO ==>> {}", userWeixinDTO);
453 throw new BadRequestException(GlobeExceptionMsg.OPERATION_FORBID + "==>> " + GlobeExceptionMsg.ENTITY_ALREADY_EXISTS); 443 return userWeixinDTO;
454 } 444 }
455 445
456 // 账号存在但无会员 446 // 账号存在但无会员
...@@ -476,10 +466,8 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -476,10 +466,8 @@ public class UserOperationServiceImpl implements UserOperationService {
476 } else { 466 } else {
477 467
478 // 有其他账号但都无会员,新建会员并将此账号绑定新建的这个会员 468 // 有其他账号但都无会员,新建会员并将此账号绑定新建的这个会员
479 Member member = MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN, 469 MemberDTO memberDTO = this.createMember( MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
480 headimgurl, nickname, vip, sex); 470 headimgurl, nickname, vip, sex));
481
482 MemberDTO memberDTO = this.createMember(member);
483 471
484 if (Objects.nonNull(memberDTO)) { 472 if (Objects.nonNull(memberDTO)) {
485 userWeixinDTO.setMemberId(memberDTO.getId()); 473 userWeixinDTO.setMemberId(memberDTO.getId());
...@@ -493,16 +481,15 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -493,16 +481,15 @@ public class UserOperationServiceImpl implements UserOperationService {
493 481
494 } 482 }
495 483
484 throw new RuntimeException("系统错误,保存微信账号失败,创建会员信息失败");
485
496 } 486 }
497 487
498 } else { 488 } else {
499 489
500 // 该账号存在但无其他账号,新建会员 490 // 该账号存在但无其他账号,新建会员
501 Member member = 491 MemberDTO memberDTO = this.createMember(MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
502 MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN, 492 headimgurl, nickname, vip, sex));
503 headimgurl, nickname, vip, sex);
504
505 MemberDTO memberDTO = this.createMember(member);
506 493
507 if (Objects.nonNull(memberDTO)) { 494 if (Objects.nonNull(memberDTO)) {
508 userWeixinDTO.setMemberId(memberDTO.getId()); 495 userWeixinDTO.setMemberId(memberDTO.getId());
...@@ -516,6 +503,8 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -516,6 +503,8 @@ public class UserOperationServiceImpl implements UserOperationService {
516 503
517 } 504 }
518 505
506 throw new RuntimeException("系统错误,保存微信账号失败,创建会员信息失败");
507
519 } 508 }
520 509
521 } 510 }
...@@ -568,15 +557,11 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -568,15 +557,11 @@ public class UserOperationServiceImpl implements UserOperationService {
568 } else { 557 } else {
569 558
570 // 新建会员 559 // 新建会员
571 Member _member = 560 MemberDTO memberDTO = this.createMember(MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
572 MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN, 561 headimgurl, nickname, vip, sex));
573 headimgurl, nickname, vip, sex);
574
575 MemberDTO memberDTO = this.createMember(_member);
576 562
577 if (Objects.nonNull(memberDTO)) { 563 if (Objects.nonNull(memberDTO)) {
578 UserWeixin userWeixin = UserWeixinBuilder.build(memberDTO.getId(), resources); 564 UserWeixinDTO _userWeixinDTO1 = this.createWeixinUser(UserWeixinBuilder.build(memberDTO.getId(), resources), memberDTO.getId(), memberDTO.getCode());
579 UserWeixinDTO _userWeixinDTO1 = this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode());
580 565
581 // 同步至iptv 566 // 同步至iptv
582 ((UserOperationServiceImpl)AopContext.currentProxy()). 567 ((UserOperationServiceImpl)AopContext.currentProxy()).
...@@ -585,7 +570,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -585,7 +570,7 @@ public class UserOperationServiceImpl implements UserOperationService {
585 return _userWeixinDTO1; 570 return _userWeixinDTO1;
586 } 571 }
587 572
588 throw new EntityNotFoundException(MemberDTO.class, "code", GlobeExceptionMsg.MEMBER_CODE_IS_NULL); 573 throw new RuntimeException("系统错误,保存微信账号失败,创建会员信息失败");
589 574
590 } 575 }
591 576
...@@ -603,7 +588,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -603,7 +588,7 @@ public class UserOperationServiceImpl implements UserOperationService {
603 public UserWeixinDTO serviceLogin(UserWeixin resources) { 588 public UserWeixinDTO serviceLogin(UserWeixin resources) {
604 589
605 // 创建小屏账户同时创建会员 590 // 创建小屏账户同时创建会员
606 UserWeixinDTO userWeixinDTO = this.createWeixinUserAndMember(resources); 591 UserWeixinDTO userWeixinDTO = this.createWeixinAndMember(resources, 0);
607 592
608 // 为了保证返回的同一用户 593 // 为了保证返回的同一用户
609 return this.getFirstId(userWeixinDTO); 594 return this.getFirstId(userWeixinDTO);
...@@ -619,8 +604,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -619,8 +604,7 @@ public class UserOperationServiceImpl implements UserOperationService {
619 public UserWeixinDTO appletLogin(UserWeixin resources) { 604 public UserWeixinDTO appletLogin(UserWeixin resources) {
620 605
621 // 创建小屏账户同时创建会员 606 // 创建小屏账户同时创建会员
622 UserWeixinDTO userWeixinDTO = this.createWeixinUserAndMember(resources); 607 UserWeixinDTO userWeixinDTO = this.createWeixinAndMember(resources, 0);
623
624 // 为了保证返回的同一用户 608 // 为了保证返回的同一用户
625 return this.getFirstId(userWeixinDTO); 609 return this.getFirstId(userWeixinDTO);
626 } 610 }
...@@ -659,7 +643,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -659,7 +643,7 @@ public class UserOperationServiceImpl implements UserOperationService {
659 userWeixin.setHeadimgurl(headImgUrl); 643 userWeixin.setHeadimgurl(headImgUrl);
660 644
661 // 创建小屏账户同时创建会员 645 // 创建小屏账户同时创建会员
662 userWeixinDTO = this.createWeixinUserAndMember(userWeixin, 1); 646 userWeixinDTO = this.createWeixinAndMember(userWeixin, 1);
663 Long memberId = userWeixinDTO.getMemberId(); 647 Long memberId = userWeixinDTO.getMemberId();
664 memberDTO = this.memberService.findById(memberId); 648 memberDTO = this.memberService.findById(memberId);
665 649
...@@ -669,6 +653,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -669,6 +653,7 @@ public class UserOperationServiceImpl implements UserOperationService {
669 UserWeixin userWeixin = new UserWeixin(); 653 UserWeixin userWeixin = new UserWeixin();
670 userWeixin.setId(userWeixinDTO.getId()); 654 userWeixin.setId(userWeixinDTO.getId());
671 userWeixin.setStatus(SUBSCRIBE_STATUS); 655 userWeixin.setStatus(SUBSCRIBE_STATUS);
656 log.info("修改微信信息status状态应改为1, subscribe# userWeixin ==>> {}" , userWeixin);
672 userWeixinDTO = this.userWeixinService.doUpdateWeixinStatus(userWeixin); 657 userWeixinDTO = this.userWeixinService.doUpdateWeixinStatus(userWeixin);
673 // 小屏会员 658 // 小屏会员
674 memberDTO = this.memberService.findById(userWeixinDTO.getMemberId()); 659 memberDTO = this.memberService.findById(userWeixinDTO.getMemberId());
...@@ -688,14 +673,14 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -688,14 +673,14 @@ public class UserOperationServiceImpl implements UserOperationService {
688 } 673 }
689 } 674 }
690 // 修改会员信息 675 // 修改会员信息
676 log.info("修改会员信息vip以及vip过期时间, subscribe# member ==>> {}" , member);
691 memberDTO = this.memberService.doUpdateMemberVipAndVipExpireTime(member); 677 memberDTO = this.memberService.doUpdateMemberVipAndVipExpireTime(member);
692 log.info("发送关注消息至大屏侧,发送的账号信息 ==>> {} || 会员信息 ==>> {}", userWeixinDTO , memberDTO);
693 // 同步大屏侧 678 // 同步大屏侧
694 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncSubscribe(new MemberAndWeixinUserDTO(memberDTO, userWeixinDTO)); 679 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncSubscribe(new MemberAndWeixinUserDTO(memberDTO, userWeixinDTO));
695 680
696 // 大屏信息 681 // 大屏信息
697 JSONObject visUserInfo = resources.getIptvUserInfo(); 682 JSONObject visUserInfo = resources.getIptvUserInfo();
698 log.info("存储的大小屏账号信息 iptvUserInfo ==>> {}" , visUserInfo); 683 log.info("关注时大屏信息, subscribe# visUserInfo ==>> {}" , visUserInfo);
699 if (Objects.nonNull(visUserInfo)) { 684 if (Objects.nonNull(visUserInfo)) {
700 // 大屏账户 685 // 大屏账户
701 String platformAccount = visUserInfo.getString("platformAccount"); 686 String platformAccount = visUserInfo.getString("platformAccount");
...@@ -709,20 +694,19 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -709,20 +694,19 @@ public class UserOperationServiceImpl implements UserOperationService {
709 } 694 }
710 695
711 if (StringUtils.isBlank(platformAccount)) { 696 if (StringUtils.isBlank(platformAccount)) {
712 log.error("关注后绑定失败,platformAccount is null "); 697 log.error("关注后绑定异常,subscribe# message ==>> 无大屏账号");
713 return false; 698 return false;
714 } 699 }
715 } 700 }
716 701
717 log.info("存储的大屏账号信息 platformAccount ==>> {}" , platformAccount);
718 // 绑定 702 // 绑定
703 log.info("关注后绑定,绑定信息 subscribe# memberDTO ==>> {} | platformAccount ==>> {}", memberDTO, platformAccount);
719 this.bind(memberDTO, platformAccount); 704 this.bind(memberDTO, platformAccount);
720 log.info("绑定结束");
721 } 705 }
722 706
723 // 保存关注记录 707 // 保存关注记录
724 JSONObject sourceInfo = resources.getSourceInfo(); 708 JSONObject sourceInfo = resources.getSourceInfo();
725 log.info("保存关注记录,数据 [subscribe#{}]", sourceInfo); 709 log.info("保存关注记录,subscribe# sourceInfo ==>> {}", sourceInfo);
726 this.saveWechatSubscribeRecord(memberDTO, sourceInfo, 1); 710 this.saveWechatSubscribeRecord(memberDTO, sourceInfo, 1);
727 711
728 return true; 712 return true;
...@@ -797,12 +781,12 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -797,12 +781,12 @@ public class UserOperationServiceImpl implements UserOperationService {
797 UserWeixinDTO userWeixinDTO = this.userWeixinService.findFirstByAppIdAndOpenId(appId, openId); 781 UserWeixinDTO userWeixinDTO = this.userWeixinService.findFirstByAppIdAndOpenId(appId, openId);
798 782
799 if (Objects.isNull(userWeixinDTO.getId())) { 783 if (Objects.isNull(userWeixinDTO.getId())) {
800 log.error("取关失败,通过appid ==>> {} 和 openId ==>> {} 无法查询到指定的微信账号", appId, openId); 784 log.error("取关失败,unsubscribe# message ==>> 通过appid ==>> {} 和 openId ==>> {} 无法查询到指定的微信账号", appId, openId);
801 return false; 785 return false;
802 } 786 }
803 787
804 if (Objects.isNull(userWeixinDTO.getMemberId())) { 788 if (Objects.isNull(userWeixinDTO.getMemberId())) {
805 log.error("取关失败,该微信账号无会员id ==>> {}", userWeixinDTO); 789 log.error("取关失败,unsubscribe# message ==>> 该微信账号无会员 userWeixinDTO ==>> {}", userWeixinDTO);
806 return false; 790 return false;
807 } 791 }
808 792
...@@ -859,8 +843,6 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -859,8 +843,6 @@ public class UserOperationServiceImpl implements UserOperationService {
859 @Override 843 @Override
860 public UserWeixinDTO saveUserInfo(String data) { 844 public UserWeixinDTO saveUserInfo(String data) {
861 845
862 log.info("result ====>> [{}]",data);
863
864 JSONObject json = JSONObject.parseObject(data); 846 JSONObject json = JSONObject.parseObject(data);
865 String unionId = json.getString("unionid"); 847 String unionId = json.getString("unionid");
866 // 订阅号appid 848 // 订阅号appid
...@@ -889,7 +871,6 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -889,7 +871,6 @@ public class UserOperationServiceImpl implements UserOperationService {
889 this.redisUtils.set(RedisKeyUtil.genSeSuSubscribeKey(unionId), data, 300); 871 this.redisUtils.set(RedisKeyUtil.genSeSuSubscribeKey(unionId), data, 300);
890 Object o = this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId)); 872 Object o = this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId));
891 String contentJsonStr = JSON.toJSONString(o); 873 String contentJsonStr = JSON.toJSONString(o);
892 log.info("H5 save in redis contentJsonStr ====>> [{}]",contentJsonStr);
893 874
894 // 若未传dyAppId。不走下面的流程 875 // 若未传dyAppId。不走下面的流程
895 if (StrUtil.isNotBlank(appId)) { 876 if (StrUtil.isNotBlank(appId)) {
...@@ -917,8 +898,9 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -917,8 +898,9 @@ public class UserOperationServiceImpl implements UserOperationService {
917 String platformAccount = resources.getPlatformAccount(); 898 String platformAccount = resources.getPlatformAccount();
918 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); 899 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
919 if (Objects.nonNull(userTvDTO)) { 900 if (Objects.nonNull(userTvDTO)) {
920 if (StringUtils.isNotBlank(userTvDTO.getPriorityMemberCode()) && userTvDTO.getPriorityMemberCode().equalsIgnoreCase(memberCode)) 901 if (StringUtils.isNotBlank(userTvDTO.getPriorityMemberCode()) && userTvDTO.getPriorityMemberCode().equalsIgnoreCase(memberCode)) {
921 throw new BadRequestException("会员已是主账户"); 902 throw new BadRequestException("会员已是主账户");
903 }
922 } else { 904 } else {
923 throw new EntityNotFoundException(UserTvDTO.class , "platformAccount" , GlobeExceptionMsg.IPTV_IS_NULL); 905 throw new EntityNotFoundException(UserTvDTO.class , "platformAccount" , GlobeExceptionMsg.IPTV_IS_NULL);
924 } 906 }
...@@ -957,16 +939,16 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -957,16 +939,16 @@ public class UserOperationServiceImpl implements UserOperationService {
957 String memberCode = resources.getMemberCode(); 939 String memberCode = resources.getMemberCode();
958 940
959 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); 941 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
960 log.info("大屏解绑,通过大屏账号查询大屏账号信息,结果 userTvDTO ==>> {}", userTvDTO); 942 log.info("大屏解绑,通过大屏账号查询大屏账号信息,结果 tvUnbind# userTvDTO ==>> {}", userTvDTO);
961 if (Objects.isNull(userTvDTO.getId())) { 943 if (Objects.isNull(userTvDTO.getId())) {
962 log.error("大屏解绑失败,无对应的大屏账号信息, platformAccount ==>> {}", platformAccount); 944 log.error("大屏解绑异常,tvUnbind# message ==>>无对应的大屏账号信息 | platformAccount ==>> {}", platformAccount);
963 return false; 945 throw new EntityNotFoundException(UserTvDTO.class , "platformAccount" , GlobeExceptionMsg.IPTV_IS_NULL);
964 } 946 }
965 947
966 MemberDTO memberDTO = this.memberService.findByCode(memberCode); 948 MemberDTO memberDTO = this.memberService.findByCode(memberCode);
967 log.info("大屏解绑,通过会员code查询会员信息,结果memberDTO==>>{}", memberDTO); 949 log.info("大屏解绑,通过会员code查询会员信息,tvUnbind# memberDTO ==>> {}", memberDTO);
968 if (Objects.isNull(memberDTO.getId())) { 950 if (Objects.isNull(memberDTO.getId())) {
969 log.error("大屏解绑失败,无对应的会员信息, memberCode ==>> {}", memberCode); 951 log.error("大屏解绑异常,tvUnbind# message ==>> 无对应的会员信息");
970 return false; 952 return false;
971 } 953 }
972 954
...@@ -977,9 +959,8 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -977,9 +959,8 @@ public class UserOperationServiceImpl implements UserOperationService {
977 member.setBindIptvTime(null); 959 member.setBindIptvTime(null);
978 member.setUserIptvId(null); 960 member.setUserIptvId(null);
979 member.setBindIptvPlatformType(null); 961 member.setBindIptvPlatformType(null);
980 log.info("置空会员绑定的大屏信息, member ==>> {}", member); 962 log.info("置空会员绑定的大屏信息, 参数 tvUnbind# member ==>> {}", member);
981 memberDTO = this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member); 963 memberDTO = this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member);
982 log.info("会员信息置空大屏的结果,memberDTO ==>> {}", memberDTO);
983 memberDTO.setPlatformAccount(platformAccount); 964 memberDTO.setPlatformAccount(platformAccount);
984 965
985 if (StringUtils.isBlank(bindMemberCode)) { 966 if (StringUtils.isBlank(bindMemberCode)) {
...@@ -991,7 +972,6 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -991,7 +972,6 @@ public class UserOperationServiceImpl implements UserOperationService {
991 UserTvDTO _userTvDTO = new UserTvDTO(); 972 UserTvDTO _userTvDTO = new UserTvDTO();
992 _userTvDTO.setPlatformAccount(platformAccount); 973 _userTvDTO.setPlatformAccount(platformAccount);
993 _userTvDTO.setPriorityMemberCode(null); 974 _userTvDTO.setPriorityMemberCode(null);
994 log.info("大屏账号置空主会员的结果,userTvDTO ==>> {}", _userTvDTO);
995 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); 975 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO));
996 976
997 UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount); 977 UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount);
...@@ -1012,7 +992,6 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1012,7 +992,6 @@ public class UserOperationServiceImpl implements UserOperationService {
1012 UserTvDTO _userTvDTO = new UserTvDTO(); 992 UserTvDTO _userTvDTO = new UserTvDTO();
1013 _userTvDTO.setPlatformAccount(platformAccount); 993 _userTvDTO.setPlatformAccount(platformAccount);
1014 _userTvDTO.setPriorityMemberCode(bindMemberCode); 994 _userTvDTO.setPriorityMemberCode(bindMemberCode);
1015 log.info("大屏账号置空主会员的结果,userTvDTO ==>> {}", userTvDTO);
1016 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); 995 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO));
1017 996
1018 UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount); 997 UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount);
...@@ -1173,9 +1152,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1173,9 +1152,7 @@ public class UserOperationServiceImpl implements UserOperationService {
1173 } 1152 }
1174 1153
1175 for (UserCollectionMq collectionMq : value) { 1154 for (UserCollectionMq collectionMq : value) {
1176
1177 UserCollectionDetail userCollectionDetail = collectionMq2DetailMapper.toEntity(collectionMq); 1155 UserCollectionDetail userCollectionDetail = collectionMq2DetailMapper.toEntity(collectionMq);
1178
1179 List<UserCollectionDetail> userCollectionDetailOptional = userCollectionDetailRepository 1156 List<UserCollectionDetail> userCollectionDetailOptional = userCollectionDetailRepository
1180 .findByDetailIdAndDetailTypeAndUserCollectionId(userCollectionDetail.getDetailId(), 1157 .findByDetailIdAndDetailTypeAndUserCollectionId(userCollectionDetail.getDetailId(),
1181 userCollectionDetail.getDetailType(), userCollection.getId()); 1158 userCollectionDetail.getDetailType(), userCollection.getId());
...@@ -1220,39 +1197,38 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1220,39 +1197,38 @@ public class UserOperationServiceImpl implements UserOperationService {
1220 public boolean minaBind(BindBean resources) { 1197 public boolean minaBind(BindBean resources) {
1221 1198
1222 Long memberId = resources.getMemberId(); 1199 Long memberId = resources.getMemberId();
1223
1224 String platformAccount = resources.getPlatformAccount(); 1200 String platformAccount = resources.getPlatformAccount();
1225 1201
1226 // 大屏账户 1202 // 大屏账户
1227 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); 1203 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
1228 log.info("查询大屏账号信息, userTvDTO ==>> {}", userTvDTO); 1204 log.info("小程序绑定,查询大屏账号信息 minaBind# userTvDTO ==>> {}", userTvDTO);
1229 // 账户是否存在 1205 // 账户是否存在
1230 if (Objects.isNull(userTvDTO.getId())) { 1206 if (Objects.isNull(userTvDTO.getId())) {
1231 log.error("大屏账号信息不存在,platformAccount ==> {}",platformAccount); 1207 log.error("小程序绑定异常,minaBind# message ==>> 大屏账号信息不存在");
1232 return false; 1208 return false;
1233 } 1209 }
1234 1210
1235 // 微信账户 1211 // 微信账户
1236 if (Objects.nonNull(memberId)) { 1212 if (Objects.nonNull(memberId)) {
1237 UserWeixinDTO userWeixinDTO = this.userWeixinService.findFirstByMemberId(memberId); 1213 UserWeixinDTO userWeixinDTO = this.userWeixinService.findFirstByMemberId(memberId);
1238 log.info("检查小屏账号是否存在, userWeixinDTO ==>> {}", userWeixinDTO); 1214 log.info("检查小屏账号,minaBind# userWeixinDTO ==>> {}", userWeixinDTO);
1239 // 账户是否存在 1215 // 账户是否存在
1240 if (Objects.isNull(userWeixinDTO.getId())) { 1216 if (Objects.isNull(userWeixinDTO.getId())) {
1241 log.error("通过会员id无法找到对应的微信账号,memberId ==> {}", memberId); 1217 log.error("小程序绑定大屏异常,minaBind# message ==> 微信账号不存在 | memberId ==>> {}", memberId);
1242 return false; 1218 return false;
1243 } 1219 }
1244 } 1220 }
1245 1221
1246 MemberDTO memberDTO = this.memberService.findById(memberId); 1222 MemberDTO memberDTO = this.memberService.findById(memberId);
1247 log.info("检查会员是否存在, memberDTO ==>> {}", memberDTO); 1223 log.info("查询会员信息,minaBind# memberDTO ==>> {}", memberDTO);
1248 if (Objects.nonNull(memberDTO.getId())) { 1224 if (Objects.nonNull(memberDTO.getId())) {
1249 Long userIptvId = memberDTO.getUserIptvId(); 1225 Long userIptvId = memberDTO.getUserIptvId();
1250 if (Objects.nonNull(userIptvId)) { 1226 if (Objects.nonNull(userIptvId)) {
1251 log.error("该会员已绑定,大屏id ==> {}", userIptvId); 1227 log.error("小程序绑定大屏异常,minaBind# message ==> 当前账号信息绑定了其他大屏 | 绑定的大屏id ==>> {}", userIptvId);
1252 throw new BadRequestException(GlobeExceptionMsg.ALREADY_BIND); 1228 throw new BadRequestException(GlobeExceptionMsg.ALREADY_BIND);
1253 } 1229 }
1254 } else { 1230 } else {
1255 log.error("会员信息不存在,请检查数据, memberId ==>> {}", memberId); 1231 log.error("小程序绑定大屏异常,minaBind# message ==> 会员信息不存在 | memberId ==>> {}", memberId);
1256 return false; 1232 return false;
1257 } 1233 }
1258 1234
...@@ -1261,11 +1237,11 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1261,11 +1237,11 @@ public class UserOperationServiceImpl implements UserOperationService {
1261 1237
1262 if (StringUtils.isBlank(priorityMemberCode)) { 1238 if (StringUtils.isBlank(priorityMemberCode)) {
1263 priorityMemberCode = memberDTO.getCode(); 1239 priorityMemberCode = memberDTO.getCode();
1264 log.info("大屏账号为绑定主账号,开始设置主会员 priorityMemberCode ==>> {}", priorityMemberCode);
1265 UserTv userTv = new UserTv(); 1240 UserTv userTv = new UserTv();
1266 userTv.setId(userTvDTO.getId()); 1241 userTv.setId(userTvDTO.getId());
1267 userTv.setPriorityMemberCode(priorityMemberCode); 1242 userTv.setPriorityMemberCode(priorityMemberCode);
1268 // 更新大屏账户 1243 // 更新大屏账户
1244 log.info("设置主会员,minaBind# userTv ==>> {}", userTv);
1269 this.userTvService.doUpdatePriorityMemberCode(userTv); 1245 this.userTvService.doUpdatePriorityMemberCode(userTv);
1270 1246
1271 userTvDTO.setPriorityMemberCode(memberDTO.getCode()); 1247 userTvDTO.setPriorityMemberCode(memberDTO.getCode());
...@@ -1292,12 +1268,13 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1292,12 +1268,13 @@ public class UserOperationServiceImpl implements UserOperationService {
1292 member.setUserIptvId(userTvDTO.getId()); 1268 member.setUserIptvId(userTvDTO.getId());
1293 member.setBindIptvTime(TimestampUtil.now()); 1269 member.setBindIptvTime(TimestampUtil.now());
1294 member.setBindIptvPlatformType(bindIptvPlatformType); 1270 member.setBindIptvPlatformType(bindIptvPlatformType);
1295 log.info("修改小屏会员对应的绑定关系,member ==>> {}", member); 1271
1272 log.info("修改小屏会员对应的绑定关系,minaBind# member ==>> {}", member);
1296 // 修改会员信息 1273 // 修改会员信息
1297 this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member); 1274 this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member);
1298 1275
1299 memberDTO.setPlatformAccount(platformAccount); 1276 memberDTO.setPlatformAccount(platformAccount);
1300 log.info("发送绑定消息至大屏,memberDTO ==>> {} || userTvDTO ==>> {}", memberDTO, userTvDTO); 1277 log.info("发送绑定消息至大屏,minaBind# memberDTO ==>> {} || userTvDTO ==>> {}", memberDTO, userTvDTO);
1301 // 同步至iptv 1278 // 同步至iptv
1302 ((UserOperationServiceImpl)AopContext.currentProxy()) 1279 ((UserOperationServiceImpl)AopContext.currentProxy())
1303 .asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO)); 1280 .asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO));
...@@ -1315,7 +1292,6 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1315,7 +1292,6 @@ public class UserOperationServiceImpl implements UserOperationService {
1315 @Override 1292 @Override
1316 public ResultInfo appBind(BindBean resources) { 1293 public ResultInfo appBind(BindBean resources) {
1317 Long memberId = resources.getMemberId(); 1294 Long memberId = resources.getMemberId();
1318
1319 String platformAccount = resources.getPlatformAccount(); 1295 String platformAccount = resources.getPlatformAccount();
1320 1296
1321 // 大屏账户 1297 // 大屏账户
...@@ -1343,7 +1319,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1343,7 +1319,7 @@ public class UserOperationServiceImpl implements UserOperationService {
1343 if (Objects.nonNull(memberDTO.getId())) { 1319 if (Objects.nonNull(memberDTO.getId())) {
1344 Long userIptvId = memberDTO.getUserIptvId(); 1320 Long userIptvId = memberDTO.getUserIptvId();
1345 if (Objects.nonNull(userIptvId)) { 1321 if (Objects.nonNull(userIptvId)) {
1346 log.error("该会员已绑定,appBind# 会员id ==> {} | 绑定的大屏账号id ==>> ", memberDTO.getId(), userIptvId); 1322 log.error("该会员已绑定,appBind# 会员id ==> {} | 绑定的大屏账号id ==>> {}", memberDTO.getId(), userIptvId);
1347 return ResultInfo.failure(GlobeExceptionMsg.ALREADY_BIND); 1323 return ResultInfo.failure(GlobeExceptionMsg.ALREADY_BIND);
1348 } 1324 }
1349 } else { 1325 } else {
...@@ -1356,11 +1332,11 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1356,11 +1332,11 @@ public class UserOperationServiceImpl implements UserOperationService {
1356 1332
1357 if (StringUtils.isBlank(priorityMemberCode)) { 1333 if (StringUtils.isBlank(priorityMemberCode)) {
1358 priorityMemberCode = memberDTO.getCode(); 1334 priorityMemberCode = memberDTO.getCode();
1359 log.info("大屏账号为绑定主账号,开始设置主会员 priorityMemberCode ==>> {}", priorityMemberCode);
1360 UserTv userTv = new UserTv(); 1335 UserTv userTv = new UserTv();
1361 userTv.setId(userTvDTO.getId()); 1336 userTv.setId(userTvDTO.getId());
1362 userTv.setPriorityMemberCode(priorityMemberCode); 1337 userTv.setPriorityMemberCode(priorityMemberCode);
1363 // 更新大屏账户 1338
1339 log.info("设置主会员,appBind# userTv ==>> {}", userTv);
1364 this.userTvService.doUpdatePriorityMemberCode(userTv); 1340 this.userTvService.doUpdatePriorityMemberCode(userTv);
1365 1341
1366 userTvDTO.setPriorityMemberCode(memberDTO.getCode()); 1342 userTvDTO.setPriorityMemberCode(memberDTO.getCode());
...@@ -1387,12 +1363,12 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1387,12 +1363,12 @@ public class UserOperationServiceImpl implements UserOperationService {
1387 member.setUserIptvId(userTvDTO.getId()); 1363 member.setUserIptvId(userTvDTO.getId());
1388 member.setBindIptvTime(TimestampUtil.now()); 1364 member.setBindIptvTime(TimestampUtil.now());
1389 member.setBindIptvPlatformType(bindIptvPlatformType); 1365 member.setBindIptvPlatformType(bindIptvPlatformType);
1390 log.info("修改小屏会员对应的绑定关系,member ==>> {}", member); 1366 log.info("修改小屏会员对应的绑定关系,appBind# member ==>> {}", member);
1391 // 修改会员信息 1367 // 修改会员信息
1392 this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member); 1368 this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member);
1393 1369
1394 memberDTO.setPlatformAccount(platformAccount); 1370 memberDTO.setPlatformAccount(platformAccount);
1395 log.info("发送绑定消息至大屏,memberDTO ==>> {} || userTvDTO ==>> {}", memberDTO, userTvDTO); 1371 log.info("发送绑定消息至大屏,appBind# memberDTO ==>> {} || userTvDTO ==>> {}", memberDTO, userTvDTO);
1396 // 同步至iptv 1372 // 同步至iptv
1397 ((UserOperationServiceImpl)AopContext.currentProxy()) 1373 ((UserOperationServiceImpl)AopContext.currentProxy())
1398 .asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO)); 1374 .asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO));
...@@ -1415,16 +1391,15 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1415,16 +1391,15 @@ public class UserOperationServiceImpl implements UserOperationService {
1415 */ 1391 */
1416 @Override 1392 @Override
1417 public UserTvDTO bind(MemberDTO resource, String platformAccount) { 1393 public UserTvDTO bind(MemberDTO resource, String platformAccount) {
1418 log.info("bind start");
1419 MemberDTO memberDTO = this.memberService.findByCode(resource.getCode()); 1394 MemberDTO memberDTO = this.memberService.findByCode(resource.getCode());
1420 log.info("查询会员信息 ==>> {}", memberDTO); 1395 log.info("查询会员信息,bind# memberDTO ==>> {}", memberDTO);
1421 if (Objects.nonNull(memberDTO.getUserIptvId())) { 1396 if (Objects.nonNull(memberDTO.getUserIptvId())) {
1422 return this.userTvService.findById(memberDTO.getUserIptvId()); 1397 return this.userTvService.findById(memberDTO.getUserIptvId());
1423 } 1398 }
1424 1399
1425 // 大屏账户 1400 // 大屏账户
1426 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); 1401 UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
1427 log.info("查询大屏账号信息 ==>> {}", userTvDTO); 1402 log.info("查询大屏账号信息,bind# userTvDTO ==>> {}", userTvDTO);
1428 if (Objects.isNull(userTvDTO)) { 1403 if (Objects.isNull(userTvDTO)) {
1429 throw new BadRequestException(GlobeExceptionMsg.IPTV_IS_NULL); 1404 throw new BadRequestException(GlobeExceptionMsg.IPTV_IS_NULL);
1430 } 1405 }
...@@ -1436,6 +1411,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1436,6 +1411,7 @@ public class UserOperationServiceImpl implements UserOperationService {
1436 userTv.setId(userTvDTO.getId()); 1411 userTv.setId(userTvDTO.getId());
1437 userTv.setPriorityMemberCode(memberDTO.getCode()); 1412 userTv.setPriorityMemberCode(memberDTO.getCode());
1438 1413
1414 log.info("修改大屏对应的主会员,bind# userTv ==>> {}", userTv);
1439 this.userTvService.doUpdatePriorityMemberCode(userTv); 1415 this.userTvService.doUpdatePriorityMemberCode(userTv);
1440 1416
1441 userTvDTO.setPriorityMemberCode(memberDTO.getCode()); 1417 userTvDTO.setPriorityMemberCode(memberDTO.getCode());
...@@ -1465,11 +1441,12 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1465,11 +1441,12 @@ public class UserOperationServiceImpl implements UserOperationService {
1465 member.setPlatformAccount(platformAccount); 1441 member.setPlatformAccount(platformAccount);
1466 1442
1467 // 修改会员 1443 // 修改会员
1444 log.info("修改会员对应的绑定关系,bind# member ==>> {}", member);
1468 this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member); 1445 this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member);
1469 1446
1470 memberDTO.setPlatformAccount(platformAccount); 1447 memberDTO.setPlatformAccount(platformAccount);
1471 1448
1472 log.info("发送绑定消息至大屏侧, 会员信息 ==>> {} || 账号信息 ==>> {}", memberDTO , userTvDTO); 1449 log.info("发送绑定消息至大屏侧, bind# memberDTO ==>> {} || userTvDTO ==>> {}", memberDTO , userTvDTO);
1473 // 同步至大屏侧 1450 // 同步至大屏侧
1474 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO)); 1451 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO));
1475 1452
...@@ -1502,7 +1479,6 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1502,7 +1479,6 @@ public class UserOperationServiceImpl implements UserOperationService {
1502 return this.memberService.findById(memberId); 1479 return this.memberService.findById(memberId);
1503 } 1480 }
1504 1481
1505
1506 /** 1482 /**
1507 * 1483 *
1508 * @param unionId 身份标识 1484 * @param unionId 身份标识
...@@ -1580,7 +1556,11 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1580,7 +1556,11 @@ public class UserOperationServiceImpl implements UserOperationService {
1580 if (Objects.nonNull(memberDTO.getId())) { 1556 if (Objects.nonNull(memberDTO.getId())) {
1581 MemberSimpleDTO memberSimpleDTO = new MemberSimpleDTO(); 1557 MemberSimpleDTO memberSimpleDTO = new MemberSimpleDTO();
1582 BeanUtils.copyProperties(memberDTO, memberSimpleDTO); 1558 BeanUtils.copyProperties(memberDTO, memberSimpleDTO);
1583 this.redisUtils.set(RedisKeyConstants.cacheMemberSimpleById+"::"+memberDTO.getId(), memberSimpleDTO); 1559 try {
1560 this.redisUtils.set(RedisKeyConstants.cacheMemberSimpleById + "::" + memberDTO.getId(), memberSimpleDTO);
1561 } catch (Exception e) {
1562 log.error("创建会员时,缓存会员信息异常, createMember# message ==>> {}", e.getMessage());
1563 }
1584 } 1564 }
1585 return memberDTO; 1565 return memberDTO;
1586 } 1566 }
...@@ -1601,7 +1581,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1601,7 +1581,7 @@ public class UserOperationServiceImpl implements UserOperationService {
1601 map.put("platformAccount", resources.getPlatformAccount()); 1581 map.put("platformAccount", resources.getPlatformAccount());
1602 map.put("id", resources.getId()); 1582 map.put("id", resources.getId());
1603 boolean redisResult = this.redisUtils.set("uus::visUser::" + userTvDTO.getPlatformAccount(), map); 1583 boolean redisResult = this.redisUtils.set("uus::visUser::" + userTvDTO.getPlatformAccount(), map);
1604 log.info("保存大屏账号redis结果 createTvUser# ==>> {}", redisResult); 1584 log.info("保存大屏账号redis结果 createTvUser# redisResult ==>> {}", redisResult);
1605 } 1585 }
1606 return userTvDTO; 1586 return userTvDTO;
1607 } 1587 }
...@@ -1651,19 +1631,19 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1651,19 +1631,19 @@ public class UserOperationServiceImpl implements UserOperationService {
1651 1631
1652 MemberDTO memberDTO = this.memberService.findById(memberId); 1632 MemberDTO memberDTO = this.memberService.findById(memberId);
1653 if (Objects.isNull(memberDTO.getId())) { 1633 if (Objects.isNull(memberDTO.getId())) {
1654 log.error("小屏解绑失败,会员信息不存在, minaUnbind# ==>> {}", memberId); 1634 log.error("小屏解绑异常,minaUnbind# message ==>> 当前会员信息不存在 | memberId ==>> {}", memberId);
1655 return ResultInfo.failure("小屏解绑失败,当前会员信息不存在"); 1635 return ResultInfo.failure("小屏解绑失败,当前会员信息不存在");
1656 } 1636 }
1657 1637
1658 if (Objects.isNull(memberDTO.getUserIptvId())) { 1638 if (Objects.isNull(memberDTO.getUserIptvId())) {
1659 log.error("小屏解绑失败,无绑定的大屏, memberId ==>> {}", memberId); 1639 log.error("小屏解绑异常,minaUnbind# message ==>> 无绑定的大屏 | memberId ==>> {}", memberId);
1660 return ResultInfo.failure("小屏解绑失败,无绑定的大屏"); 1640 return ResultInfo.failure("小屏解绑失败,无绑定的大屏");
1661 } 1641 }
1662 1642
1663 UserTvDTO userTvDTO = this.userTvService.findById(memberDTO.getUserIptvId()); 1643 UserTvDTO userTvDTO = this.userTvService.findById(memberDTO.getUserIptvId());
1664 if (Objects.isNull(userTvDTO.getPlatformAccount())) { 1644 if (Objects.isNull(userTvDTO.getPlatformAccount())) {
1665 log.info("小屏解绑失败,绑定的大屏账号不存在 minaUnbind# ==>> userIptvId ==>> {}", memberDTO.getUserIptvId()); 1645 log.info("小屏解绑异常,minaUnbind# message ==>> 当前会员绑定的大屏账号不存在 | memberId ==>> {}", memberDTO.getId());
1666 return ResultInfo.failure("小屏解绑失败,大屏信息不存在请联系客服"); 1646 return ResultInfo.failure("小屏解绑失败,大屏信息不存在");
1667 } 1647 }
1668 1648
1669 // 解绑(置空大屏信息) 1649 // 解绑(置空大屏信息)
...@@ -1673,19 +1653,17 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1673,19 +1653,17 @@ public class UserOperationServiceImpl implements UserOperationService {
1673 member.setBindIptvTime(null); 1653 member.setBindIptvTime(null);
1674 member.setUserIptvId(null); 1654 member.setUserIptvId(null);
1675 member.setBindIptvPlatformType(null); 1655 member.setBindIptvPlatformType(null);
1676 log.info("置空会员绑定的大屏信息, member ==>> {}", member); 1656 log.info("置空会员绑定的大屏信息,minaUnbind# member ==>> {}", member);
1677 this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member); 1657 this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member);
1678 log.info("会员信息置空大屏的结果,memberDTO ==>> {}", memberDTO);
1679 1658
1680 // 有其他绑定的小程序会员,排除自己 1659 // 有其他绑定的小程序会员,排除自己
1681 List<MemberDTO> memberDTOS = this.memberService.findByUserIptvId(userTvDTO.getId()); 1660 List<MemberDTO> memberDTOS = this.memberService.findByUserIptvId(userTvDTO.getId());
1682 log.info("后台指定一个默认主会员,通过大屏id查询到的绑定的小屏会员memberDTOList ==>> {}", memberDTOS); 1661 log.info("通过大屏id查询到的绑定的小屏会员,minaUnbind# memberDTOList ==>> {}", memberDTOS);
1683 if (!CollectionUtils.isEmpty(memberDTOS)) { 1662 if (!CollectionUtils.isEmpty(memberDTOS)) {
1684 String oldMemberCode = memberDTO.getCode(); 1663 String oldMemberCode = memberDTO.getCode();
1685 List<MemberDTO> collect = 1664 List<MemberDTO> collect =
1686 memberDTOS.stream().filter(memberDTO_ -> 1665 memberDTOS.stream().filter(memberDTO_ ->
1687 !memberDTO_.getCode().equalsIgnoreCase(oldMemberCode)).collect(Collectors.toList()); 1666 !memberDTO_.getCode().equalsIgnoreCase(oldMemberCode)).collect(Collectors.toList());
1688 log.info("过滤掉当前会员 ==>> {}", collect);
1689 1667
1690 if (!CollectionUtils.isEmpty(collect)) { 1668 if (!CollectionUtils.isEmpty(collect)) {
1691 1669
...@@ -1696,12 +1674,14 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1696,12 +1674,14 @@ public class UserOperationServiceImpl implements UserOperationService {
1696 userTv.setId(userTvDTO.getId()); 1674 userTv.setId(userTvDTO.getId());
1697 userTv.setPlatform(userTvDTO.getPlatformAccount()); 1675 userTv.setPlatform(userTvDTO.getPlatformAccount());
1698 userTv.setPriorityMemberCode(collect.get(0).getCode()); 1676 userTv.setPriorityMemberCode(collect.get(0).getCode());
1677
1678 log.info("设置主会员,minaUnbind# userTv ==>> {}", userTv);
1699 this.userTvService.doUpdatePriorityMemberCode(userTv); 1679 this.userTvService.doUpdatePriorityMemberCode(userTv);
1700 1680
1701 UserTvDTO _userTvDTO = new UserTvDTO(); 1681 UserTvDTO _userTvDTO = new UserTvDTO();
1702 _userTvDTO.setPlatformAccount(userTvDTO.getPlatformAccount()); 1682 _userTvDTO.setPlatformAccount(userTvDTO.getPlatformAccount());
1703 _userTvDTO.setPriorityMemberCode(userTv.getPriorityMemberCode()); 1683 _userTvDTO.setPriorityMemberCode(userTv.getPriorityMemberCode());
1704 log.info("同步绑定信息至大屏侧, 参数 ==>> {}", new MemberAndUserTvDTO(memberDTO, _userTvDTO)); 1684 log.info("同步信息至大屏侧,minaUnbind# MemberAndUserTvDTO ==>> {} ", new MemberAndUserTvDTO(memberDTO, _userTvDTO));
1705 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); 1685 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO));
1706 1686
1707 UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(userTvDTO.getPlatformAccount()); 1687 UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(userTvDTO.getPlatformAccount());
...@@ -1713,17 +1693,18 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1713,17 +1693,18 @@ public class UserOperationServiceImpl implements UserOperationService {
1713 } 1693 }
1714 1694
1715 } else { 1695 } else {
1716 log.info("无其他绑定的小屏会员信息 "); 1696
1717 // 绑定新的主账号 1697 // 绑定新的主账号
1718 UserTv userTv = new UserTv(); 1698 UserTv userTv = new UserTv();
1719 userTv.setId(userTvDTO.getId()); 1699 userTv.setId(userTvDTO.getId());
1720 userTv.setPriorityMemberCode(null); 1700 userTv.setPriorityMemberCode(null);
1701 log.info("无其他绑定的小屏会员信息,置空主会员 minaUnbind# userTv ==>> {}", userTv);
1721 this.userTvService.doUpdatePriorityMemberCode(userTv); 1702 this.userTvService.doUpdatePriorityMemberCode(userTv);
1722 1703
1723 UserTvDTO _userTvDTO = new UserTvDTO(); 1704 UserTvDTO _userTvDTO = new UserTvDTO();
1724 _userTvDTO.setPlatformAccount(userTvDTO.getPlatformAccount()); 1705 _userTvDTO.setPlatformAccount(userTvDTO.getPlatformAccount());
1725 _userTvDTO.setPriorityMemberCode(null); 1706 _userTvDTO.setPriorityMemberCode(null);
1726 log.info("同步绑定信息至大屏侧, 参数 ==>> {}", new MemberAndUserTvDTO(memberDTO, _userTvDTO)); 1707 log.info("同步信息至大屏侧,minaUnbind# MemberAndUserTvDTO ==>> {}", new MemberAndUserTvDTO(memberDTO, _userTvDTO));
1727 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); 1708 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO));
1728 1709
1729 UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(userTvDTO.getPlatformAccount()); 1710 UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(userTvDTO.getPlatformAccount());
...@@ -1778,10 +1759,6 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -1778,10 +1759,6 @@ public class UserOperationServiceImpl implements UserOperationService {
1778 @AsyncMqSend 1759 @AsyncMqSend
1779 public void asyncUpdateAppLastActiveTimeAndNicknameAndHeadImg(UserAppDTO userAppDTO) { } 1760 public void asyncUpdateAppLastActiveTimeAndNicknameAndHeadImg(UserAppDTO userAppDTO) { }
1780 @AsyncMqSend 1761 @AsyncMqSend
1781 public void asyncCancelUserAppBind(UserAppBindDTO userAppBindDTO) {}
1782 @AsyncMqSend
1783 public void asyncUpdatePasswordByUsername(UserAppDTO userAppDTO) {}
1784 @AsyncMqSend
1785 public void asyncUpdateAppInfo(UserAppDTO userAppDTO) {} 1762 public void asyncUpdateAppInfo(UserAppDTO userAppDTO) {}
1786 @AsyncMqSend 1763 @AsyncMqSend
1787 public void asyncAppCancellation(UserAppDTO userAppDTO) {} 1764 public void asyncAppCancellation(UserAppDTO userAppDTO) {}
......
...@@ -42,23 +42,11 @@ public class MemberOperationServiceImpl implements MemberOperationService { ...@@ -42,23 +42,11 @@ public class MemberOperationServiceImpl implements MemberOperationService {
42 @Autowired 42 @Autowired
43 private MemberProfileService memberProfileService; 43 private MemberProfileService memberProfileService;
44 @Autowired 44 @Autowired
45 private MemberVipHistoryService memberVipHistoryService;
46 @Autowired
47 private MemberAddressService memberAddressService; 45 private MemberAddressService memberAddressService;
48 46 @Autowired
49 @AsyncMqSend 47 private MemberVipHistoryService memberVipHistoryService;
50 public void asyncUpdateMemberVipAndVipExpireTime(MemberDTO memberDTO) {}
51 @AsyncMqSend
52 public void asyncCreateMemberVipHistory(MemberVipHistoryDTO memberVipHistoryDTO) {}
53 @AsyncMqSend
54 public void asyncDoUpdateGroupsBatch(List<Member> resources) {}
55 48
56 49
57 @AsyncMqSend
58 @Override
59 public MemberDTO update(Member resources) {
60 return this.memberService.update(resources);
61 }
62 50
63 @Override 51 @Override
64 public MemberDTO findByCode(String code) { 52 public MemberDTO findByCode(String code) {
...@@ -285,4 +273,18 @@ public class MemberOperationServiceImpl implements MemberOperationService { ...@@ -285,4 +273,18 @@ public class MemberOperationServiceImpl implements MemberOperationService {
285 private MemberProfileDTO findMemberProfileByMemberId(Long memberId) { 273 private MemberProfileDTO findMemberProfileByMemberId(Long memberId) {
286 return this.memberProfileService.findByMemberId(memberId); 274 return this.memberProfileService.findByMemberId(memberId);
287 } 275 }
276
277
278
279 @AsyncMqSend
280 public void asyncUpdateMemberVipAndVipExpireTime(MemberDTO memberDTO) {}
281 @AsyncMqSend
282 public void asyncCreateMemberVipHistory(MemberVipHistoryDTO memberVipHistoryDTO) {}
283 @AsyncMqSend
284 public void asyncDoUpdateGroupsBatch(List<Member> resources) {}
285 @AsyncMqSend
286 @Override
287 public MemberDTO update(Member resources) {
288 return this.memberService.update(resources);
289 }
288 } 290 }
......
...@@ -4,9 +4,7 @@ import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; ...@@ -4,9 +4,7 @@ import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
4 import com.topdraw.business.module.member.domain.Member; 4 import com.topdraw.business.module.member.domain.Member;
5 import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; 5 import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
6 import com.topdraw.business.module.member.service.dto.MemberDTO; 6 import com.topdraw.business.module.member.service.dto.MemberDTO;
7 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
8 import com.topdraw.business.process.domian.member.MemberOperationBean; 7 import com.topdraw.business.process.domian.member.MemberOperationBean;
9 import com.topdraw.business.process.domian.weixin.BuyVipBean;
10 8
11 import java.util.List; 9 import java.util.List;
12 10
...@@ -76,8 +74,17 @@ public interface MemberOperationService { ...@@ -76,8 +74,17 @@ public interface MemberOperationService {
76 */ 74 */
77 MemberDTO doUpdateVipByMemberCode(MemberOperationBean resources); 75 MemberDTO doUpdateVipByMemberCode(MemberOperationBean resources);
78 76
79 77 /**
78 *
79 * @param resources
80 * @return
81 */
80 Integer doUpdateGroupsBatch(List<Member> resources); 82 Integer doUpdateGroupsBatch(List<Member> resources);
81 83
84 /**
85 *
86 * @param memberId
87 * @return
88 */
82 MemberAddressDTO updateDefaultMemberAddressById(Long memberId); 89 MemberAddressDTO updateDefaultMemberAddressById(Long memberId);
83 } 90 }
......
1 package com.topdraw.util; 1 package com.topdraw.util;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
4 import com.topdraw.base.modules.utils.MD5Util;
4 import lombok.extern.slf4j.Slf4j; 5 import lombok.extern.slf4j.Slf4j;
5 import org.bouncycastle.jce.provider.BouncyCastleProvider; 6 import org.bouncycastle.jce.provider.BouncyCastleProvider;
6 7
...@@ -17,6 +18,16 @@ import java.util.Arrays; ...@@ -17,6 +18,16 @@ import java.util.Arrays;
17 @Slf4j 18 @Slf4j
18 public class AESUtil { 19 public class AESUtil {
19 20
21 public static String decodePassword(String password) {
22 String decrypt = AESUtil.decrypt(password, "f8681b9ce7c8fb6b");
23
24 String substring = decrypt.substring(16);
25
26 String s = MD5Util.encodePassword(substring);
27 log.info("加密前的密码:==>> {} || 解密后的密码:==>> {} | md5之后的密码: ==>> {}", decrypt, substring, s);
28 return s;
29 }
30
20 public static String encrypt(String data, String key) { 31 public static String encrypt(String data, String key) {
21 String strResult = null; 32 String strResult = null;
22 try { 33 try {
......