1.添加H5保存redis日志
Showing
4 changed files
with
45 additions
and
7 deletions
1 | package com.topdraw; | 1 | package com.topdraw; |
2 | 2 | ||
3 | import com.topdraw.config.RedisKeyUtil; | 3 | |
4 | import com.topdraw.utils.RedisUtils; | ||
5 | import com.topdraw.utils.SpringContextHolder; | 4 | import com.topdraw.utils.SpringContextHolder; |
6 | import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.boot.SpringApplication; | 5 | import org.springframework.boot.SpringApplication; |
8 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
9 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
10 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; | 7 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; |
11 | import org.springframework.boot.builder.SpringApplicationBuilder; | 8 | import org.springframework.boot.builder.SpringApplicationBuilder; |
... | @@ -16,7 +13,6 @@ import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ... | @@ -16,7 +13,6 @@ import org.springframework.data.jpa.repository.config.EnableJpaAuditing; |
16 | import org.springframework.retry.annotation.EnableRetry; | 13 | import org.springframework.retry.annotation.EnableRetry; |
17 | import org.springframework.scheduling.annotation.EnableAsync; | 14 | import org.springframework.scheduling.annotation.EnableAsync; |
18 | import org.springframework.transaction.annotation.EnableTransactionManagement; | 15 | import org.springframework.transaction.annotation.EnableTransactionManagement; |
19 | import org.springframework.web.bind.annotation.CrossOrigin; | ||
20 | 16 | ||
21 | /** | 17 | /** |
22 | * @author XiangHan | 18 | * @author XiangHan |
... | @@ -43,6 +39,7 @@ public class MemberServiceApplication extends SpringBootServletInitializer { | ... | @@ -43,6 +39,7 @@ public class MemberServiceApplication extends SpringBootServletInitializer { |
43 | public SpringContextHolder springContextHolder() { | 39 | public SpringContextHolder springContextHolder() { |
44 | return new SpringContextHolder(); | 40 | return new SpringContextHolder(); |
45 | } | 41 | } |
42 | |||
46 | } | 43 | } |
47 | 44 | ||
48 | 45 | ... | ... |
... | @@ -2,6 +2,7 @@ package com.topdraw.business.process.rest; | ... | @@ -2,6 +2,7 @@ package com.topdraw.business.process.rest; |
2 | 2 | ||
3 | import cn.hutool.core.util.ObjectUtil; | 3 | import cn.hutool.core.util.ObjectUtil; |
4 | import cn.hutool.core.util.StrUtil; | 4 | import cn.hutool.core.util.StrUtil; |
5 | import com.alibaba.fastjson.JSON; | ||
5 | import com.alibaba.fastjson.JSONObject; | 6 | import com.alibaba.fastjson.JSONObject; |
6 | import com.topdraw.annotation.AnonymousAccess; | 7 | import com.topdraw.annotation.AnonymousAccess; |
7 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 8 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
... | @@ -34,6 +35,8 @@ import io.swagger.annotations.ApiOperation; | ... | @@ -34,6 +35,8 @@ import io.swagger.annotations.ApiOperation; |
34 | import lombok.extern.slf4j.Slf4j; | 35 | import lombok.extern.slf4j.Slf4j; |
35 | import org.springframework.beans.BeanUtils; | 36 | import org.springframework.beans.BeanUtils; |
36 | import org.springframework.beans.factory.annotation.Autowired; | 37 | import org.springframework.beans.factory.annotation.Autowired; |
38 | import org.springframework.cache.annotation.CacheEvict; | ||
39 | import org.springframework.cache.annotation.Cacheable; | ||
37 | import org.springframework.util.Assert; | 40 | import org.springframework.util.Assert; |
38 | import org.springframework.validation.annotation.Validated; | 41 | import org.springframework.validation.annotation.Validated; |
39 | import org.springframework.web.bind.annotation.*; | 42 | import org.springframework.web.bind.annotation.*; |
... | @@ -235,6 +238,9 @@ public class UserOperationController { | ... | @@ -235,6 +238,9 @@ public class UserOperationController { |
235 | @AnonymousAccess | 238 | @AnonymousAccess |
236 | public ResultInfo subscribe(@Validated @RequestBody SubscribeBeanEvent data) throws IOException { | 239 | public ResultInfo subscribe(@Validated @RequestBody SubscribeBeanEvent data) throws IOException { |
237 | String content = data.getContent(); | 240 | String content = data.getContent(); |
241 | |||
242 | log.info("subscribe content ==>> [{}]",content); | ||
243 | |||
238 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(content, SubscribeBean.class); | 244 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(content, SubscribeBean.class); |
239 | this.parseSubscribe(subscribeBean); | 245 | this.parseSubscribe(subscribeBean); |
240 | boolean result = this.userTvOperationService.subscribe(subscribeBean); | 246 | boolean result = this.userTvOperationService.subscribe(subscribeBean); |
... | @@ -323,7 +329,7 @@ public class UserOperationController { | ... | @@ -323,7 +329,7 @@ public class UserOperationController { |
323 | @AnonymousAccess | 329 | @AnonymousAccess |
324 | public ResultInfo unsubscribe(@Validated @RequestBody SubscribeBeanEvent data) { | 330 | public ResultInfo unsubscribe(@Validated @RequestBody SubscribeBeanEvent data) { |
325 | String content = data.getContent(); | 331 | String content = data.getContent(); |
326 | log.info("content ==>> [{}]",content); | 332 | log.info("unsubscribe content ==>> [{}]",content); |
327 | 333 | ||
328 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(content, SubscribeBean.class); | 334 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(content, SubscribeBean.class); |
329 | boolean result = this.userTvOperationService.unsubscribe(subscribeBean); | 335 | boolean result = this.userTvOperationService.unsubscribe(subscribeBean); |
... | @@ -346,6 +352,7 @@ public class UserOperationController { | ... | @@ -346,6 +352,7 @@ public class UserOperationController { |
346 | @AnonymousAccess | 352 | @AnonymousAccess |
347 | public ResultInfo saveUserInfo(@RequestBody String data) { | 353 | public ResultInfo saveUserInfo(@RequestBody String data) { |
348 | 354 | ||
355 | log.info("保存大屏侧信息 ===>>> content ==>> [{}]",data); | ||
349 | Assert.notNull(data, "用户数据不可为空"); | 356 | Assert.notNull(data, "用户数据不可为空"); |
350 | 357 | ||
351 | JSONObject json = JSONObject.parseObject(data); | 358 | JSONObject json = JSONObject.parseObject(data); |
... | @@ -367,7 +374,6 @@ public class UserOperationController { | ... | @@ -367,7 +374,6 @@ public class UserOperationController { |
367 | } | 374 | } |
368 | 375 | ||
369 | 376 | ||
370 | |||
371 | } | 377 | } |
372 | 378 | ||
373 | 379 | ... | ... |
... | @@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil; | ... | @@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil; |
5 | import cn.hutool.core.util.ObjectUtil; | 5 | import cn.hutool.core.util.ObjectUtil; |
6 | import cn.hutool.core.util.StrUtil; | 6 | import cn.hutool.core.util.StrUtil; |
7 | import cn.hutool.http.HttpUtil; | 7 | import cn.hutool.http.HttpUtil; |
8 | import com.alibaba.fastjson.JSON; | ||
8 | import com.alibaba.fastjson.JSONObject; | 9 | import com.alibaba.fastjson.JSONObject; |
9 | import com.topdraw.aspect.AsyncMqSend; | 10 | import com.topdraw.aspect.AsyncMqSend; |
10 | import com.topdraw.business.module.member.domain.Member; | 11 | import com.topdraw.business.module.member.domain.Member; |
... | @@ -351,6 +352,8 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -351,6 +352,8 @@ public class UserOperationServiceImpl implements UserOperationService { |
351 | @Override | 352 | @Override |
352 | public String saveUserInfo(String data) { | 353 | public String saveUserInfo(String data) { |
353 | 354 | ||
355 | log.info("result ====>> [{}]",data); | ||
356 | |||
354 | JSONObject json = JSONObject.parseObject(data); | 357 | JSONObject json = JSONObject.parseObject(data); |
355 | String unionId = json.getString("unionid"); | 358 | String unionId = json.getString("unionid"); |
356 | String result = ""; | 359 | String result = ""; |
... | @@ -361,6 +364,9 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -361,6 +364,9 @@ public class UserOperationServiceImpl implements UserOperationService { |
361 | 364 | ||
362 | // 过期时间300S | 365 | // 过期时间300S |
363 | this.redisUtils.set(RedisKeyUtil.genSeSuSubscribeKey(unionId), data, 300); | 366 | this.redisUtils.set(RedisKeyUtil.genSeSuSubscribeKey(unionId), data, 300); |
367 | Object o = this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId)); | ||
368 | String contentJsonStr = JSON.toJSONString(o); | ||
369 | log.info("H5 save in redis contentJsonStr ====>> [{}]",contentJsonStr); | ||
364 | 370 | ||
365 | // 若未传dyAppId。不走下面的流程 | 371 | // 若未传dyAppId。不走下面的流程 |
366 | if (StrUtil.isNotBlank(appId)) | 372 | if (StrUtil.isNotBlank(appId)) |
... | @@ -684,6 +690,14 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -684,6 +690,14 @@ public class UserOperationServiceImpl implements UserOperationService { |
684 | userWeixin.setAuthTime(TimestampUtil.now()); | 690 | userWeixin.setAuthTime(TimestampUtil.now()); |
685 | userWeixin.setMemberCode(memberDTO.getCode()); | 691 | userWeixin.setMemberCode(memberDTO.getCode()); |
686 | userWeixin = this.userWeixinService.create(userWeixin); | 692 | userWeixin = this.userWeixinService.create(userWeixin); |
693 | |||
694 | } | ||
695 | |||
696 | // 避免账户存在但会员不存在的情况 | ||
697 | if(Objects.nonNull(userWeixin.getId()) && Objects.isNull(userWeixin.getMemberId()) && Objects.nonNull(userWeixin.getUnionid())) { | ||
698 | |||
699 | userWeixin.setMemberId(memberId); | ||
700 | this.userWeixinService.update(userWeixin); | ||
687 | } | 701 | } |
688 | 702 | ||
689 | BeanUtils.copyProperties(userWeixin,userWeixinDTO); | 703 | BeanUtils.copyProperties(userWeixin,userWeixinDTO); |
... | @@ -1406,6 +1420,15 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1406,6 +1420,15 @@ public class UserOperationServiceImpl implements UserOperationService { |
1406 | String appId = resources.getAppid(); | 1420 | String appId = resources.getAppid(); |
1407 | String openId = resources.getOpenid(); | 1421 | String openId = resources.getOpenid(); |
1408 | 1422 | ||
1423 | // if (org.apache.commons.lang3.StringUtils.isBlank(unionId)) { | ||
1424 | |||
1425 | // TODO 需要商量是否需要创建微信账户 | ||
1426 | /*UserWeixinDTO userWeixinDTO = this.findUserWeiXinByOpenIdAndAppId(appId, openId); | ||
1427 | if (ObjectUtil.isNotEmpty(userWeixinDTO)) | ||
1428 | return userWeixinDTO;*/ | ||
1429 | |||
1430 | // } | ||
1431 | |||
1409 | // 小屏账户 | 1432 | // 小屏账户 |
1410 | UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId); | 1433 | UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId); |
1411 | 1434 | ... | ... |
member-service.iml
0 → 100644
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | ||
3 | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> | ||
4 | <output url="file://$MODULE_DIR$/target/classes" /> | ||
5 | <output-test url="file://$MODULE_DIR$/target/test-classes" /> | ||
6 | <content url="file://$MODULE_DIR$"> | ||
7 | <excludeFolder url="file://$MODULE_DIR$/target" /> | ||
8 | </content> | ||
9 | <orderEntry type="inheritedJdk" /> | ||
10 | <orderEntry type="sourceFolder" forTests="false" /> | ||
11 | </component> | ||
12 | </module> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment