1.修改绑定的逻辑实现
Showing
8 changed files
with
73 additions
and
7 deletions
| ... | @@ -3,7 +3,10 @@ package com.topdraw.business.module.member.repository; | ... | @@ -3,7 +3,10 @@ package com.topdraw.business.module.member.repository; |
| 3 | import com.topdraw.business.module.member.domain.Member; | 3 | import com.topdraw.business.module.member.domain.Member; |
| 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.List; | 10 | import java.util.List; |
| 8 | import java.util.Optional; | 11 | import java.util.Optional; |
| 9 | 12 | ||
| ... | @@ -18,4 +21,8 @@ public interface MemberRepository extends JpaRepository<Member, Long>, JpaSpecif | ... | @@ -18,4 +21,8 @@ public interface MemberRepository extends JpaRepository<Member, Long>, JpaSpecif |
| 18 | List<Member> findByUserIptvId(Long id); | 21 | List<Member> findByUserIptvId(Long id); |
| 19 | 22 | ||
| 20 | Optional<Member> findByIdOrCode(Long id, String code); | 23 | Optional<Member> findByIdOrCode(Long id, String code); |
| 24 | |||
| 25 | @Modifying | ||
| 26 | @Query(value = "UPDATE `uc_user_tv` SET `user_iptv_id` = ?2, `update_time` = ?3 WHERE `id` = ?1", nativeQuery = true) | ||
| 27 | void updateUserIptvIdById(Long id, Long userIptvId, LocalDateTime now); | ||
| 21 | } | 28 | } | ... | ... |
| ... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.member.service; | ... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.member.service; |
| 3 | import com.topdraw.business.module.member.domain.Member; | 3 | import com.topdraw.business.module.member.domain.Member; |
| 4 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 4 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 5 | 5 | ||
| 6 | import java.time.LocalDateTime; | ||
| 6 | import java.util.List; | 7 | import java.util.List; |
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| ... | @@ -83,4 +84,6 @@ public interface MemberService { | ... | @@ -83,4 +84,6 @@ public interface MemberService { |
| 83 | 84 | ||
| 84 | 85 | ||
| 85 | void unbind(Member resources); | 86 | void unbind(Member resources); |
| 87 | |||
| 88 | void updateUserIptvIdById(Long id, Long userIptvId, LocalDateTime now); | ||
| 86 | } | 89 | } | ... | ... |
| ... | @@ -22,6 +22,7 @@ import org.springframework.stereotype.Service; | ... | @@ -22,6 +22,7 @@ import org.springframework.stereotype.Service; |
| 22 | import org.springframework.transaction.annotation.Propagation; | 22 | import org.springframework.transaction.annotation.Propagation; |
| 23 | import org.springframework.transaction.annotation.Transactional; | 23 | import org.springframework.transaction.annotation.Transactional; |
| 24 | 24 | ||
| 25 | import java.time.LocalDateTime; | ||
| 25 | import java.util.List; | 26 | import java.util.List; |
| 26 | import java.util.Objects; | 27 | import java.util.Objects; |
| 27 | 28 | ||
| ... | @@ -171,6 +172,12 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -171,6 +172,12 @@ public class MemberServiceImpl implements MemberService { |
| 171 | 172 | ||
| 172 | @Override | 173 | @Override |
| 173 | @Transactional(rollbackFor = Exception.class) | 174 | @Transactional(rollbackFor = Exception.class) |
| 175 | public void updateUserIptvIdById(Long id, Long userIptvId, LocalDateTime now) { | ||
| 176 | this.memberRepository.updateUserIptvIdById(id, userIptvId, now); | ||
| 177 | } | ||
| 178 | |||
| 179 | @Override | ||
| 180 | @Transactional(rollbackFor = Exception.class) | ||
| 174 | public MemberDTO update(Member resources) { | 181 | public MemberDTO update(Member resources) { |
| 175 | 182 | ||
| 176 | log.info("MemberServiceImpl ==>> update ==>> resources ==>> [{}]" , resources); | 183 | log.info("MemberServiceImpl ==>> update ==>> resources ==>> [{}]" , resources); | ... | ... |
| ... | @@ -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 | /** |
| ... | @@ -18,4 +21,7 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif | ... | @@ -18,4 +21,7 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif |
| 18 | 21 | ||
| 19 | Optional<UserTv> findByMemberId(Long memberId); | 22 | Optional<UserTv> findByMemberId(Long memberId); |
| 20 | 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); | ||
| 21 | } | 27 | } | ... | ... |
| ... | @@ -80,4 +80,12 @@ public interface UserTvService { | ... | @@ -80,4 +80,12 @@ public interface UserTvService { |
| 80 | */ | 80 | */ |
| 81 | MemberDTO findMemberByPlatformAccount(String platformAccount); | 81 | MemberDTO findMemberByPlatformAccount(String platformAccount); |
| 82 | 82 | ||
| 83 | |||
| 84 | /** | ||
| 85 | * | ||
| 86 | * @param resources | ||
| 87 | * @return | ||
| 88 | */ | ||
| 89 | UserTvDTO asyncUpdateUserTvVisUserId(UserTv resources); | ||
| 90 | |||
| 83 | } | 91 | } | ... | ... |
| ... | @@ -7,10 +7,13 @@ import com.topdraw.business.module.user.iptv.repository.UserTvRepository; | ... | @@ -7,10 +7,13 @@ import com.topdraw.business.module.user.iptv.repository.UserTvRepository; |
| 7 | import com.topdraw.business.module.user.iptv.service.UserTvService; | 7 | import com.topdraw.business.module.user.iptv.service.UserTvService; |
| 8 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 8 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 9 | import com.topdraw.business.module.user.iptv.service.mapper.UserTvMapper; | 9 | import com.topdraw.business.module.user.iptv.service.mapper.UserTvMapper; |
| 10 | import com.topdraw.exception.BadRequestException; | ||
| 10 | import com.topdraw.exception.EntityNotFoundException; | 11 | import com.topdraw.exception.EntityNotFoundException; |
| 11 | import com.topdraw.exception.GlobeExceptionMsg; | 12 | import com.topdraw.exception.GlobeExceptionMsg; |
| 12 | import com.topdraw.utils.ValidationUtil; | 13 | import com.topdraw.utils.ValidationUtil; |
| 14 | import lombok.extern.slf4j.Slf4j; | ||
| 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.BeanUtils; | 17 | import org.springframework.beans.BeanUtils; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | import org.springframework.dao.EmptyResultDataAccessException; | 19 | import org.springframework.dao.EmptyResultDataAccessException; |
| ... | @@ -20,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional; | ... | @@ -20,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional; |
| 20 | import org.springframework.util.Assert; | 23 | import org.springframework.util.Assert; |
| 21 | 24 | ||
| 22 | import javax.validation.constraints.NotNull; | 25 | import javax.validation.constraints.NotNull; |
| 26 | import java.time.LocalDateTime; | ||
| 23 | import java.util.Objects; | 27 | import java.util.Objects; |
| 24 | import java.util.Optional; | 28 | import java.util.Optional; |
| 25 | 29 | ||
| ... | @@ -29,6 +33,7 @@ import java.util.Optional; | ... | @@ -29,6 +33,7 @@ import java.util.Optional; |
| 29 | */ | 33 | */ |
| 30 | @Service | 34 | @Service |
| 31 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 35 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
| 36 | @Slf4j | ||
| 32 | public class UserTvServiceImpl implements UserTvService { | 37 | public class UserTvServiceImpl implements UserTvService { |
| 33 | 38 | ||
| 34 | 39 | ||
| ... | @@ -66,6 +71,34 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -66,6 +71,34 @@ public class UserTvServiceImpl implements UserTvService { |
| 66 | throw new EntityNotFoundException(UserTvDTO.class,"platformAccount", GlobeExceptionMsg.IPTV_IS_NULL); | 71 | throw new EntityNotFoundException(UserTvDTO.class,"platformAccount", GlobeExceptionMsg.IPTV_IS_NULL); |
| 67 | } | 72 | } |
| 68 | 73 | ||
| 74 | @Override | ||
| 75 | @Transactional(rollbackFor = Exception.class) | ||
| 76 | public UserTvDTO asyncUpdateUserTvVisUserId(UserTv resources) { | ||
| 77 | log.info("UserTvServiceImpl ==> updateUserTvVisUserId ==>> param ==> {}",resources); | ||
| 78 | |||
| 79 | if (StringUtils.isBlank(resources.getPlatformAccount())){ | ||
| 80 | throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL); | ||
| 81 | } | ||
| 82 | |||
| 83 | if (Objects.isNull(resources.getVisUserId())){ | ||
| 84 | throw new BadRequestException(GlobeExceptionMsg.VIS_USER_ID_IS_NULL); | ||
| 85 | } | ||
| 86 | |||
| 87 | UserTvDTO userTvDTO = this.findByPlatformAccount(resources.getPlatformAccount()); | ||
| 88 | |||
| 89 | if (Objects.nonNull(userTvDTO.getId())) { | ||
| 90 | |||
| 91 | this.userTvRepository.updateUserTvVisUserId(userTvDTO.getId(), resources.getVisUserId(), LocalDateTime.now()); | ||
| 92 | |||
| 93 | } else { | ||
| 94 | |||
| 95 | log.error("修改大屏账号vis_user_id字段异常,请检查"); | ||
| 96 | |||
| 97 | } | ||
| 98 | |||
| 99 | return null; | ||
| 100 | } | ||
| 101 | |||
| 69 | private MemberDTO findMemberByMemberCode(String memberCode) { | 102 | private MemberDTO findMemberByMemberCode(String memberCode) { |
| 70 | return this.memberService.findByCode(memberCode); | 103 | return this.memberService.findByCode(memberCode); |
| 71 | } | 104 | } | ... | ... |
| ... | @@ -23,6 +23,7 @@ import org.springframework.stereotype.Service; | ... | @@ -23,6 +23,7 @@ import org.springframework.stereotype.Service; |
| 23 | import org.springframework.transaction.annotation.Propagation; | 23 | import org.springframework.transaction.annotation.Propagation; |
| 24 | import org.springframework.transaction.annotation.Transactional; | 24 | import org.springframework.transaction.annotation.Transactional; |
| 25 | 25 | ||
| 26 | import java.time.LocalDateTime; | ||
| 26 | import java.util.Objects; | 27 | import java.util.Objects; |
| 27 | 28 | ||
| 28 | @Service | 29 | @Service |
| ... | @@ -184,7 +185,8 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -184,7 +185,8 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 184 | MemberDTO _memberDTO = this.memberService.findByCode(code); | 185 | MemberDTO _memberDTO = this.memberService.findByCode(code); |
| 185 | 186 | ||
| 186 | memberDTO.setUserIptvId(_userTvDTO.getId()); | 187 | memberDTO.setUserIptvId(_userTvDTO.getId()); |
| 187 | this.updateMember(_memberDTO, memberDTO); | 188 | this.memberService.updateUserIptvIdById(_memberDTO.getId(), _userTvDTO.getId(), LocalDateTime.now()); |
| 189 | //this.updateMember(_memberDTO, memberDTO); | ||
| 188 | 190 | ||
| 189 | } else { | 191 | } else { |
| 190 | 192 | ... | ... |
| ... | @@ -78,8 +78,8 @@ mutil-mq: | ... | @@ -78,8 +78,8 @@ mutil-mq: |
| 78 | password: guest | 78 | password: guest |
| 79 | # password: Topdraw1qaz | 79 | # password: Topdraw1qaz |
| 80 | # 虚拟空间 | 80 | # 虚拟空间 |
| 81 | # virtual-host: member_center_iptv_sichuan | 81 | virtual-host: member_center_iptv_sichuan |
| 82 | virtual-host: member_center_small_sichuan | 82 | # virtual-host: member_center_small_sichuan |
| 83 | publisher-confirms: true #如果对异步消息需要回调必须设置为true | 83 | publisher-confirms: true #如果对异步消息需要回调必须设置为true |
| 84 | 84 | ||
| 85 | # 管理侧 | 85 | # 管理侧 |
| ... | @@ -143,17 +143,17 @@ service: | ... | @@ -143,17 +143,17 @@ service: |
| 143 | # routing-key: uc.eventbus.*.topic | 143 | # routing-key: uc.eventbus.*.topic |
| 144 | # active: service | 144 | # active: service |
| 145 | - source: uce | 145 | - source: uce |
| 146 | exchange: uc.direct | 146 | exchange: uce.exchange |
| 147 | queue: uc.route.key.direct.event.bbb | 147 | queue: uce.queue |
| 148 | exchange-type: direct | 148 | exchange-type: direct |
| 149 | routing-key: | 149 | routing-key: |
| 150 | active: service | 150 | active: management |
| 151 | - source: uce | 151 | - source: uce |
| 152 | exchange: exchange.MemberInfoSync | 152 | exchange: exchange.MemberInfoSync |
| 153 | queue: queue.MemberInfoSync | 153 | queue: queue.MemberInfoSync |
| 154 | exchange-type: direct | 154 | exchange-type: direct |
| 155 | routing-key: | 155 | routing-key: |
| 156 | active: service | 156 | active: management |
| 157 | # - source: wechat | 157 | # - source: wechat |
| 158 | # exchange: weixin.subOrUnSub.direct | 158 | # exchange: weixin.subOrUnSub.direct |
| 159 | # queue: weixin.subOrUnSub.queue | 159 | # queue: weixin.subOrUnSub.queue | ... | ... |
-
Please register or sign in to post a comment