1.忽略member-service.iml文件
Showing
8 changed files
with
130 additions
and
2 deletions
... | @@ -3,7 +3,10 @@ package com.topdraw.business.module.user.iptv.repository; | ... | @@ -3,7 +3,10 @@ package com.topdraw.business.module.user.iptv.repository; |
3 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 3 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
4 | import org.springframework.data.jpa.repository.JpaRepository; | 4 | import org.springframework.data.jpa.repository.JpaRepository; |
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
6 | import org.springframework.data.jpa.repository.Modifying; | ||
7 | import org.springframework.data.jpa.repository.Query; | ||
6 | 8 | ||
9 | import java.time.LocalDateTime; | ||
7 | import java.util.Optional; | 10 | import java.util.Optional; |
8 | 11 | ||
9 | /** | 12 | /** |
... | @@ -17,4 +20,8 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif | ... | @@ -17,4 +20,8 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif |
17 | Optional<UserTv> findByPriorityMemberCode(String memberCode); | 20 | Optional<UserTv> findByPriorityMemberCode(String memberCode); |
18 | 21 | ||
19 | Optional<UserTv> findByMemberId(Long memberId); | 22 | Optional<UserTv> findByMemberId(Long memberId); |
23 | |||
24 | @Modifying | ||
25 | @Query(value = "UPDATE `uc_user_tv` SET `vis_user_id` = ?2, `update_time` = ?3 WHERE `id` = ?1", nativeQuery = true) | ||
26 | Integer updateUserTvVisUserId(Long id, Long visUserId, LocalDateTime now); | ||
20 | } | 27 | } | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/module/user/iptv/rest/UserTvController.java
0 → 100644
1 | package com.topdraw.business.module.user.iptv.rest; | ||
2 | |||
3 | import com.topdraw.annotation.AnonymousAccess; | ||
4 | import com.topdraw.business.module.user.iptv.domain.UserTv; | ||
5 | import com.topdraw.business.module.user.iptv.service.UserTvService; | ||
6 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | ||
7 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ||
8 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | ||
9 | import com.topdraw.common.ResultInfo; | ||
10 | import com.topdraw.exception.BadRequestException; | ||
11 | import com.topdraw.exception.GlobeExceptionMsg; | ||
12 | import io.swagger.annotations.Api; | ||
13 | import io.swagger.annotations.ApiOperation; | ||
14 | import lombok.extern.slf4j.Slf4j; | ||
15 | import org.apache.commons.lang3.StringUtils; | ||
16 | import org.springframework.beans.factory.annotation.Autowired; | ||
17 | import org.springframework.validation.annotation.Validated; | ||
18 | import org.springframework.web.bind.annotation.*; | ||
19 | |||
20 | import java.util.Objects; | ||
21 | |||
22 | /** | ||
23 | * @author XiangHan | ||
24 | * @date 2021-12-16 | ||
25 | */ | ||
26 | @Api(tags = "微信管理") | ||
27 | @RestController | ||
28 | @RequestMapping("/uce/userTv") | ||
29 | @Slf4j | ||
30 | public class UserTvController { | ||
31 | |||
32 | @Autowired | ||
33 | private UserTvService userTvService; | ||
34 | |||
35 | @PostMapping(value = "/updateUserTvVisUserId") | ||
36 | @ApiOperation("新增UserWeixin") | ||
37 | @AnonymousAccess | ||
38 | public ResultInfo updateUserTvVisUserId(@Validated @RequestBody UserTv resources) { | ||
39 | |||
40 | log.info("UserOperationController ==> updateUserTvVisUserId ==>> param ==> {}",resources); | ||
41 | |||
42 | if (StringUtils.isBlank(resources.getPlatformAccount())){ | ||
43 | throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL); | ||
44 | } | ||
45 | |||
46 | if (Objects.isNull(resources.getVisUserId())){ | ||
47 | throw new BadRequestException(GlobeExceptionMsg.VIS_USER_ID_IS_NULL); | ||
48 | } | ||
49 | |||
50 | UserTvDTO userTvDTO = this.userTvService.updateUserTvVisUserId(resources); | ||
51 | if (Objects.nonNull(userTvDTO.getId())) | ||
52 | return ResultInfo.success(userTvDTO); | ||
53 | else return ResultInfo.failure("操作失败,请检查 ==>> /uce/userTv/updateUserTvVisUserId"); | ||
54 | } | ||
55 | |||
56 | } |
... | @@ -77,4 +77,11 @@ public interface UserTvService { | ... | @@ -77,4 +77,11 @@ public interface UserTvService { |
77 | * @return | 77 | * @return |
78 | */ | 78 | */ |
79 | MemberDTO findMemberByPlatformAccount(String platformAccount); | 79 | MemberDTO findMemberByPlatformAccount(String platformAccount); |
80 | |||
81 | /** | ||
82 | * | ||
83 | * @param resources | ||
84 | * @return | ||
85 | */ | ||
86 | UserTvDTO updateUserTvVisUserId(UserTv resources); | ||
80 | } | 87 | } | ... | ... |
1 | package com.topdraw.business.module.user.iptv.service.impl; | 1 | package com.topdraw.business.module.user.iptv.service.impl; |
2 | 2 | ||
3 | import com.topdraw.aspect.AsyncMqSend; | ||
3 | import com.topdraw.business.module.member.service.MemberService; | 4 | import com.topdraw.business.module.member.service.MemberService; |
4 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
5 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 6 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
7 | import com.topdraw.business.process.service.impl.UserOperationServiceImpl; | ||
6 | import com.topdraw.exception.EntityNotFoundException; | 8 | import com.topdraw.exception.EntityNotFoundException; |
7 | import com.topdraw.exception.GlobeExceptionMsg; | 9 | import com.topdraw.exception.GlobeExceptionMsg; |
8 | import com.topdraw.utils.ValidationUtil; | 10 | import com.topdraw.utils.ValidationUtil; |
... | @@ -11,6 +13,7 @@ import com.topdraw.business.module.user.iptv.service.UserTvService; | ... | @@ -11,6 +13,7 @@ import com.topdraw.business.module.user.iptv.service.UserTvService; |
11 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 13 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
12 | import com.topdraw.business.module.user.iptv.service.mapper.UserTvMapper; | 14 | import com.topdraw.business.module.user.iptv.service.mapper.UserTvMapper; |
13 | import org.apache.commons.lang3.StringUtils; | 15 | import org.apache.commons.lang3.StringUtils; |
16 | import org.springframework.aop.framework.AopContext; | ||
14 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
15 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
16 | import org.springframework.transaction.annotation.Propagation; | 19 | import org.springframework.transaction.annotation.Propagation; |
... | @@ -18,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional; | ... | @@ -18,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional; |
18 | import org.springframework.dao.EmptyResultDataAccessException; | 21 | import org.springframework.dao.EmptyResultDataAccessException; |
19 | import org.springframework.util.Assert; | 22 | import org.springframework.util.Assert; |
20 | 23 | ||
24 | import java.time.LocalDateTime; | ||
21 | import java.util.Objects; | 25 | import java.util.Objects; |
22 | import java.util.Optional; | 26 | import java.util.Optional; |
23 | 27 | ||
... | @@ -37,6 +41,9 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -37,6 +41,9 @@ public class UserTvServiceImpl implements UserTvService { |
37 | @Autowired | 41 | @Autowired |
38 | private UserTvRepository userTvRepository; | 42 | private UserTvRepository userTvRepository; |
39 | 43 | ||
44 | @AsyncMqSend | ||
45 | public void asyncUpdateUserTvVisUserId(UserTvDTO userTvDTO) {} | ||
46 | |||
40 | /** | 47 | /** |
41 | * 获取大屏账户对应的会员 | 48 | * 获取大屏账户对应的会员 |
42 | * <Waring> | 49 | * <Waring> |
... | @@ -64,6 +71,30 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -64,6 +71,30 @@ public class UserTvServiceImpl implements UserTvService { |
64 | throw new EntityNotFoundException(UserTvDTO.class,"platformAccount", GlobeExceptionMsg.IPTV_IS_NULL); | 71 | throw new EntityNotFoundException(UserTvDTO.class,"platformAccount", GlobeExceptionMsg.IPTV_IS_NULL); |
65 | } | 72 | } |
66 | 73 | ||
74 | @Override | ||
75 | @Transactional(rollbackFor = Exception.class) | ||
76 | public UserTvDTO updateUserTvVisUserId(UserTv resources) { | ||
77 | |||
78 | String platformAccount = resources.getPlatformAccount(); | ||
79 | |||
80 | UserTvDTO userTvDTO = this.findByPlatformAccount(platformAccount); | ||
81 | |||
82 | if (Objects.nonNull(userTvDTO.getId())) { | ||
83 | |||
84 | Integer integer = this.userTvRepository.updateUserTvVisUserId(userTvDTO.getId(), resources.getVisUserId(), LocalDateTime.now()); | ||
85 | |||
86 | if (integer == 1) { | ||
87 | ((UserTvServiceImpl) AopContext.currentProxy()).asyncUpdateUserTvVisUserId(userTvDTO); | ||
88 | } | ||
89 | |||
90 | return this.findById(userTvDTO.getId()); | ||
91 | } | ||
92 | |||
93 | return null; | ||
94 | } | ||
95 | |||
96 | |||
97 | |||
67 | private MemberDTO findMemberByMemberCode(String memberCode) { | 98 | private MemberDTO findMemberByMemberCode(String memberCode) { |
68 | return this.memberService.findByCode(memberCode); | 99 | return this.memberService.findByCode(memberCode); |
69 | } | 100 | } | ... | ... |
... | @@ -173,4 +173,11 @@ public interface UserOperationService { | ... | @@ -173,4 +173,11 @@ public interface UserOperationService { |
173 | * @return | 173 | * @return |
174 | */ | 174 | */ |
175 | UserTvDTO updateUserTv(UserTv resources); | 175 | UserTvDTO updateUserTv(UserTv resources); |
176 | |||
177 | /** | ||
178 | * 修改大屏账号vis_user_id | ||
179 | * @param resources | ||
180 | * @return | ||
181 | */ | ||
182 | UserTvDTO updateUserTvVisUserId(UserTv resources); | ||
176 | } | 183 | } | ... | ... |
... | @@ -1549,12 +1549,32 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1549,12 +1549,32 @@ public class UserOperationServiceImpl implements UserOperationService { |
1549 | 1549 | ||
1550 | @Override | 1550 | @Override |
1551 | public UserTvDTO updateUserTv(UserTv resources) { | 1551 | public UserTvDTO updateUserTv(UserTv resources) { |
1552 | |||
1552 | UserTvDTO userTvDTO = this.userTvService.update(resources); | 1553 | UserTvDTO userTvDTO = this.userTvService.update(resources); |
1553 | Long memberId = userTvDTO.getMemberId(); | 1554 | Long memberId = userTvDTO.getMemberId(); |
1555 | |||
1554 | if (Objects.nonNull(memberId)) { | 1556 | if (Objects.nonNull(memberId)) { |
1555 | MemberDTO memberDTO = this.memberService.findById(memberId); | 1557 | MemberDTO memberDTO = this.memberService.findById(memberId); |
1556 | resources.setMemberCode(memberDTO.getCode()); | 1558 | resources.setMemberCode(memberDTO.getCode()); |
1557 | } | 1559 | } |
1560 | |||
1561 | // 同步至iptv | ||
1562 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUserTv(userTvDTO); | ||
1563 | return userTvDTO; | ||
1564 | } | ||
1565 | |||
1566 | |||
1567 | @Override | ||
1568 | public UserTvDTO updateUserTvVisUserId(UserTv resources) { | ||
1569 | |||
1570 | UserTvDTO userTvDTO = this.userTvService.update(resources); | ||
1571 | Long memberId = userTvDTO.getMemberId(); | ||
1572 | |||
1573 | if (Objects.nonNull(memberId)) { | ||
1574 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
1575 | resources.setMemberCode(memberDTO.getCode()); | ||
1576 | } | ||
1577 | |||
1558 | // 同步至iptv | 1578 | // 同步至iptv |
1559 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUserTv(userTvDTO); | 1579 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUserTv(userTvDTO); |
1560 | return userTvDTO; | 1580 | return userTvDTO; | ... | ... |
... | @@ -45,7 +45,7 @@ spring: | ... | @@ -45,7 +45,7 @@ spring: |
45 | hibernate: | 45 | hibernate: |
46 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 | 46 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 |
47 | ddl-auto: none | 47 | ddl-auto: none |
48 | show-sql: false | 48 | show-sql: true |
49 | servlet: | 49 | servlet: |
50 | multipart: | 50 | multipart: |
51 | file-size-threshold: 2KB | 51 | file-size-threshold: 2KB | ... | ... |
... | @@ -64,7 +64,7 @@ | ... | @@ -64,7 +64,7 @@ |
64 | 64 | ||
65 | 65 | ||
66 | <!--监控sql日志输出 --> | 66 | <!--监控sql日志输出 --> |
67 | <logger name="jdbc.sqlonly" level="OFF" additivity="false"> | 67 | <logger name="jdbc.sqlonly" level="INFO" additivity="false"> |
68 | <appender-ref ref="console" /> | 68 | <appender-ref ref="console" /> |
69 | <appender-ref ref="info" /> | 69 | <appender-ref ref="info" /> |
70 | </logger> | 70 | </logger> | ... | ... |
-
Please register or sign in to post a comment