1.优化
Showing
5 changed files
with
99 additions
and
1 deletions
... | @@ -138,7 +138,7 @@ public class UserWeixinBuilder { | ... | @@ -138,7 +138,7 @@ public class UserWeixinBuilder { |
138 | userWeixin.setSourceDesc(StringUtils.isNotBlank(sourceDesc)?sourceId:""); | 138 | userWeixin.setSourceDesc(StringUtils.isNotBlank(sourceDesc)?sourceId:""); |
139 | userWeixin.setSourceUser(Objects.nonNull(sourceUser)?sourceUser:0L); | 139 | userWeixin.setSourceUser(Objects.nonNull(sourceUser)?sourceUser:0L); |
140 | userWeixin.setSourceEntity(StringUtils.isNotBlank(sourceEntity)?sourceEntity:""); | 140 | userWeixin.setSourceEntity(StringUtils.isNotBlank(sourceEntity)?sourceEntity:""); |
141 | userWeixin.setAuthTime(TimestampUtil.now()); | 141 | // userWeixin.setAuthTime(TimestampUtil.now()); |
142 | userWeixin.setCountry(StringUtils.isNotBlank(country)?country:""); | 142 | userWeixin.setCountry(StringUtils.isNotBlank(country)?country:""); |
143 | userWeixin.setProvince(StringUtils.isNotBlank(province)?province:""); | 143 | userWeixin.setProvince(StringUtils.isNotBlank(province)?province:""); |
144 | userWeixin.setCity(StringUtils.isNotBlank(city)?city:""); | 144 | userWeixin.setCity(StringUtils.isNotBlank(city)?city:""); | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/UserOperationBean.java
0 → 100644
1 | package com.topdraw.business.process.domian.weixin; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | import java.sql.Timestamp; | ||
6 | |||
7 | /** | ||
8 | * @author : | ||
9 | * @description: | ||
10 | * @function : | ||
11 | * @date :Created in 2022/4/7 12:48 | ||
12 | * @version: : | ||
13 | * @modified By: | ||
14 | * @since : modified in 2022/4/7 12:48 | ||
15 | */ | ||
16 | @Data | ||
17 | public class UserOperationBean { | ||
18 | |||
19 | private Long userId; | ||
20 | |||
21 | private Integer vip; | ||
22 | |||
23 | private Timestamp vipExpireTime; | ||
24 | } |
... | @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject; | ... | @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject; |
7 | import com.topdraw.annotation.AnonymousAccess; | 7 | import com.topdraw.annotation.AnonymousAccess; |
8 | import com.topdraw.business.module.common.validated.CreateGroup; | 8 | import com.topdraw.business.module.common.validated.CreateGroup; |
9 | import com.topdraw.business.module.common.validated.UpdateGroup; | 9 | import com.topdraw.business.module.common.validated.UpdateGroup; |
10 | import com.topdraw.business.module.member.domain.Member; | ||
10 | import com.topdraw.business.module.member.service.MemberService; | 11 | import com.topdraw.business.module.member.service.MemberService; |
11 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 12 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
12 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 13 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
... | @@ -15,6 +16,7 @@ import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ... | @@ -15,6 +16,7 @@ import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
15 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 16 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
16 | import com.topdraw.business.process.domian.weixin.*; | 17 | import com.topdraw.business.process.domian.weixin.*; |
17 | import com.topdraw.business.process.service.UserOperationService; | 18 | import com.topdraw.business.process.service.UserOperationService; |
19 | import com.topdraw.business.process.service.member.MemberOperationService; | ||
18 | import com.topdraw.common.ResultInfo; | 20 | import com.topdraw.common.ResultInfo; |
19 | import com.topdraw.config.RedisKeyUtil; | 21 | import com.topdraw.config.RedisKeyUtil; |
20 | import com.topdraw.exception.BadRequestException; | 22 | import com.topdraw.exception.BadRequestException; |
... | @@ -30,6 +32,7 @@ import io.swagger.annotations.Api; | ... | @@ -30,6 +32,7 @@ import io.swagger.annotations.Api; |
30 | import io.swagger.annotations.ApiOperation; | 32 | import io.swagger.annotations.ApiOperation; |
31 | import lombok.extern.slf4j.Slf4j; | 33 | import lombok.extern.slf4j.Slf4j; |
32 | import org.apache.commons.lang3.StringUtils; | 34 | import org.apache.commons.lang3.StringUtils; |
35 | import org.springframework.beans.BeanUtils; | ||
33 | import org.springframework.beans.factory.annotation.Autowired; | 36 | import org.springframework.beans.factory.annotation.Autowired; |
34 | import org.springframework.util.Assert; | 37 | import org.springframework.util.Assert; |
35 | import org.springframework.validation.annotation.Validated; | 38 | import org.springframework.validation.annotation.Validated; |
... | @@ -37,18 +40,22 @@ import org.springframework.web.bind.annotation.*; | ... | @@ -37,18 +40,22 @@ import org.springframework.web.bind.annotation.*; |
37 | 40 | ||
38 | import java.io.IOException; | 41 | import java.io.IOException; |
39 | import java.net.URLDecoder; | 42 | import java.net.URLDecoder; |
43 | import java.sql.Timestamp; | ||
40 | import java.util.*; | 44 | import java.util.*; |
41 | 45 | ||
42 | @Api("账户处理") | 46 | @Api("账户处理") |
43 | @RestController | 47 | @RestController |
44 | @RequestMapping(value = "/uce/userOperation") | 48 | @RequestMapping(value = "/uce/userOperation") |
45 | @Slf4j | 49 | @Slf4j |
50 | @CrossOrigin | ||
46 | public class UserOperationController { | 51 | public class UserOperationController { |
47 | 52 | ||
48 | @Autowired | 53 | @Autowired |
49 | private MemberService memberService; | 54 | private MemberService memberService; |
50 | @Autowired | 55 | @Autowired |
51 | private UserOperationService userOperationService; | 56 | private UserOperationService userOperationService; |
57 | @Autowired | ||
58 | private MemberOperationService memberOperationService; | ||
52 | 59 | ||
53 | @Autowired | 60 | @Autowired |
54 | private RedisUtils redisUtils; | 61 | private RedisUtils redisUtils; |
... | @@ -57,6 +64,43 @@ public class UserOperationController { | ... | @@ -57,6 +64,43 @@ public class UserOperationController { |
57 | private static final String UNSUBSCRIBE = "unsubscribe"; | 64 | private static final String UNSUBSCRIBE = "unsubscribe"; |
58 | private static final Integer SUBSCRIBE_STATUS = 1; | 65 | private static final Integer SUBSCRIBE_STATUS = 1; |
59 | 66 | ||
67 | @PutMapping(value = "/updateWeixin") | ||
68 | @ApiOperation("修改UserWeixin") | ||
69 | @AnonymousAccess | ||
70 | public ResultInfo updateWeixin(@Validated @RequestBody UserWeixin resources) { | ||
71 | userOperationService.updateWeixin(resources); | ||
72 | return ResultInfo.success(); | ||
73 | } | ||
74 | |||
75 | @RequestMapping(value = "/updateVipByUserId") | ||
76 | @ApiOperation("通过账号id修改vip") | ||
77 | @AnonymousAccess | ||
78 | public ResultInfo updateVipByUserId(@Validated(value = {UpdateGroup.class}) @RequestBody | ||
79 | UserOperationBean resources) { | ||
80 | log.info("userOperation ==>> updateVipByUserId ==>> param ==>> [{}]",resources); | ||
81 | |||
82 | Integer vip = resources.getVip(); | ||
83 | Timestamp vipExpireTime = resources.getVipExpireTime(); | ||
84 | Long userId = resources.getUserId(); | ||
85 | UserWeixinDTO userWeixinDTO = this.userOperationService.findById(userId); | ||
86 | |||
87 | Long memberId = userWeixinDTO.getMemberId(); | ||
88 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
89 | |||
90 | Member member = new Member(); | ||
91 | BeanUtils.copyProperties(memberDTO, member); | ||
92 | if (Objects.nonNull(vip)) { | ||
93 | member.setVip(vip); | ||
94 | } | ||
95 | if (Objects.nonNull(vipExpireTime)) { | ||
96 | member.setVipExpireTime(vipExpireTime); | ||
97 | } | ||
98 | |||
99 | this.memberOperationService.update(member); | ||
100 | |||
101 | return ResultInfo.success(); | ||
102 | } | ||
103 | |||
60 | @PostMapping(value = "/createWeixinUserAndCreateMember") | 104 | @PostMapping(value = "/createWeixinUserAndCreateMember") |
61 | @ApiOperation("新增小屏账户同时创建会员信息") | 105 | @ApiOperation("新增小屏账户同时创建会员信息") |
62 | @AnonymousAccess | 106 | @AnonymousAccess | ... | ... |
... | @@ -146,4 +146,17 @@ public interface UserOperationService { | ... | @@ -146,4 +146,17 @@ public interface UserOperationService { |
146 | * @param weixinUnBindBean | 146 | * @param weixinUnBindBean |
147 | */ | 147 | */ |
148 | void minaUnbind(WeixinUnBindBean weixinUnBindBean); | 148 | void minaUnbind(WeixinUnBindBean weixinUnBindBean); |
149 | |||
150 | /** | ||
151 | * | ||
152 | * @param userId | ||
153 | * @return | ||
154 | */ | ||
155 | UserWeixinDTO findById(Long userId); | ||
156 | |||
157 | /** | ||
158 | * | ||
159 | * @param resources | ||
160 | */ | ||
161 | UserWeixinDTO updateWeixin(UserWeixin resources); | ||
149 | } | 162 | } | ... | ... |
... | @@ -1199,4 +1199,21 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1199,4 +1199,21 @@ public class UserOperationServiceImpl implements UserOperationService { |
1199 | tvUnBindBean.setPlatformAccount(platformAccount); | 1199 | tvUnBindBean.setPlatformAccount(platformAccount); |
1200 | this.tvUnbind(tvUnBindBean); | 1200 | this.tvUnbind(tvUnBindBean); |
1201 | } | 1201 | } |
1202 | |||
1203 | @Override | ||
1204 | public UserWeixinDTO findById(Long userId) { | ||
1205 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(userId); | ||
1206 | return userWeixinDTO; | ||
1207 | } | ||
1208 | |||
1209 | @Override | ||
1210 | public UserWeixinDTO updateWeixin(UserWeixin resources) { | ||
1211 | |||
1212 | UserWeixinDTO userWeixinDTO = this.userWeixinService.update(resources); | ||
1213 | |||
1214 | // 同步至iptv | ||
1215 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncWeixin(userWeixinDTO); | ||
1216 | |||
1217 | return userWeixinDTO; | ||
1218 | } | ||
1202 | } | 1219 | } | ... | ... |
-
Please register or sign in to post a comment