Merge remote-tracking branch 'remotes/origin/2.2.0-release'
# Conflicts: # src/main/java/com/topdraw/business/module/member/repository/MemberRepository.java # src/main/java/com/topdraw/business/module/member/service/MemberService.java # src/main/java/com/topdraw/business/module/member/service/impl/MemberServiceImpl.java # src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java # src/main/java/com/topdraw/business/process/service/impl/member/MemberOperationServiceImpl.java # src/main/java/com/topdraw/mq/consumer/UcEventBusIptv2ManagementUcEngine.java # src/main/java/com/topdraw/mq/consumer/UcGatewayIptv2IptvConsumer.java # src/main/java/com/topdraw/mq/consumer/WeiXinEventConsumer.java # src/main/java/com/topdraw/mq/domain/DataSyncMsg.java # src/main/java/com/topdraw/resttemplate/RestTemplateClient.java # src/main/resources/config/application-dev.yml
Showing
109 changed files
with
4664 additions
and
1666 deletions
| ... | @@ -42,7 +42,8 @@ public class MemberBuilder { | ... | @@ -42,7 +42,8 @@ public class MemberBuilder { |
| 42 | member.setCouponAmount(DEFAULT_VALUE); | 42 | member.setCouponAmount(DEFAULT_VALUE); |
| 43 | member.setDueCouponAmount(DEFAULT_VALUE); | 43 | member.setDueCouponAmount(DEFAULT_VALUE); |
| 44 | member.setBlackStatus(DEFAULT_VALUE); | 44 | member.setBlackStatus(DEFAULT_VALUE); |
| 45 | member.setBirthday(StringUtils.isBlank(member.getBirthday())?"1900-01-01":member.getBirthday()); | 45 | // member.setBirthday(StringUtils.isBlank(member.getBirthday())?"1900-01-01":member.getBirthday()); |
| 46 | member.setBirthday(null); | ||
| 46 | String nickname = member.getNickname(); | 47 | String nickname = member.getNickname(); |
| 47 | if (StringUtils.isNotEmpty(nickname)) { | 48 | if (StringUtils.isNotEmpty(nickname)) { |
| 48 | // String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8))); | 49 | // String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8))); | ... | ... |
| 1 | package com.topdraw.business.module.member.domain; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/27 15:38 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/27 15:38 | ||
| 11 | */ | ||
| 12 | public interface MemberTypeConstant { | ||
| 13 | |||
| 14 | // 大屏 | ||
| 15 | Integer vis = 1; | ||
| 16 | // 微信 | ||
| 17 | Integer weixin = 2; | ||
| 18 | // app | ||
| 19 | Integer app = 3; | ||
| 20 | } |
| ... | @@ -10,6 +10,7 @@ import org.springframework.data.repository.query.Param; | ... | @@ -10,6 +10,7 @@ import org.springframework.data.repository.query.Param; |
| 10 | import java.time.LocalDateTime; | 10 | import java.time.LocalDateTime; |
| 11 | import java.util.List; | 11 | import java.util.List; |
| 12 | import java.util.Optional; | 12 | import java.util.Optional; |
| 13 | import java.util.Set; | ||
| 13 | 14 | ||
| 14 | /** | 15 | /** |
| 15 | * @author XiangHan | 16 | * @author XiangHan |
| ... | @@ -43,4 +44,26 @@ public interface MemberRepository extends JpaRepository<Member, Long>, JpaSpecif | ... | @@ -43,4 +44,26 @@ public interface MemberRepository extends JpaRepository<Member, Long>, JpaSpecif |
| 43 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | 44 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) |
| 44 | void doUpdateMemberCoupon(@Param("resources") Member member); | 45 | void doUpdateMemberCoupon(@Param("resources") Member member); |
| 45 | 46 | ||
| 47 | @Modifying | ||
| 48 | @Query(value = "UPDATE `uc_member` SET `avatar_url` = :#{#resources.avatarUrl}, `update_time` = now() , " + | ||
| 49 | " `nickname`= :#{#resources.nickname}, " + | ||
| 50 | " `gender`=:#{#resources.gender} WHERE `id` = :#{#resources.id}", nativeQuery = true) | ||
| 51 | Integer updateMemberAvatarUrlAndNicknameAndGender(@Param("resources") Member resources); | ||
| 52 | |||
| 53 | @Modifying | ||
| 54 | @Query(value = "UPDATE `uc_member` SET `vip` = :#{#resources.vip}, " + | ||
| 55 | "`vip_expire_time` = :#{#resources.vipExpireTime} , `update_time`= now() " + | ||
| 56 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | ||
| 57 | Integer updateMemberVipAndVipExpireTime(@Param("resources") Member member); | ||
| 58 | |||
| 59 | @Modifying | ||
| 60 | @Query(value = "UPDATE `uc_member` SET `user_iptv_id` = :#{#resources.userIptvId}, " + | ||
| 61 | "`bind_iptv_platform_type` = :#{#resources.bindIptvPlatformType} , `bind_iptv_time` = :#{#resources.bindIptvTime} , " + | ||
| 62 | " `update_time`= now() " + | ||
| 63 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | ||
| 64 | Integer doUpdateMemberUserIptvIdAndBindPlatformTypeAndBingTime(@Param("resources") Member member); | ||
| 65 | |||
| 66 | @Modifying | ||
| 67 | @Query(value = "UPDATE `uc_member` SET `groups` = ?1, `update_time` = now() WHERE `code` IN ?2 ", nativeQuery = true) | ||
| 68 | Integer doUpdateGroupsBatch(String groups, Set<String> codes); | ||
| 46 | } | 69 | } | ... | ... |
| ... | @@ -12,7 +12,12 @@ import java.util.List; | ... | @@ -12,7 +12,12 @@ import java.util.List; |
| 12 | */ | 12 | */ |
| 13 | public interface MemberService { | 13 | public interface MemberService { |
| 14 | 14 | ||
| 15 | 15 | /** | |
| 16 | * | ||
| 17 | * @param member | ||
| 18 | * @return | ||
| 19 | */ | ||
| 20 | MemberDTO doUpdateMemberVipAndVipExpireTime(Member member); | ||
| 16 | 21 | ||
| 17 | /** | 22 | /** |
| 18 | * 根据ID查询 | 23 | * 根据ID查询 |
| ... | @@ -36,30 +41,23 @@ public interface MemberService { | ... | @@ -36,30 +41,23 @@ public interface MemberService { |
| 36 | MemberDTO create(Member resources); | 41 | MemberDTO create(Member resources); |
| 37 | 42 | ||
| 38 | /** | 43 | /** |
| 39 | * 创建并返回会员 | ||
| 40 | * @param resources 会员 | ||
| 41 | * @return Member | ||
| 42 | */ | ||
| 43 | MemberDTO createAndReturnMember(Member resources); | ||
| 44 | |||
| 45 | /** | ||
| 46 | * 修改会员 | 44 | * 修改会员 |
| 47 | * @param resources | 45 | * @param resources |
| 48 | */ | 46 | */ |
| 49 | MemberDTO update(Member resources); | 47 | MemberDTO update(Member resources); |
| 50 | 48 | ||
| 51 | /** | 49 | /** |
| 52 | * 修改会员积分 | 50 | * |
| 53 | * @param member 会员 | 51 | * @param resources |
| 52 | * @return | ||
| 54 | */ | 53 | */ |
| 55 | MemberDTO doUpdateMemberPoints(Member member); | 54 | MemberDTO doUpdateMemberAvatarUrlAndNicknameAndGender(Member resources); |
| 56 | 55 | ||
| 57 | /** | 56 | /** |
| 58 | * 查询绑定了大屏会员列表 | 57 | * 修改会员积分 |
| 59 | * @param id 条件参数 | 58 | * @param resources 会员 |
| 60 | * @return Map<String,Object> | ||
| 61 | */ | 59 | */ |
| 62 | List<MemberDTO> findByUserIptvId(Long id); | 60 | MemberDTO doUpdateMemberPoints(Member resources); |
| 63 | 61 | ||
| 64 | /** | 62 | /** |
| 65 | * 检查会员信息 | 63 | * 检查会员信息 |
| ... | @@ -88,4 +86,8 @@ public interface MemberService { | ... | @@ -88,4 +86,8 @@ public interface MemberService { |
| 88 | void updateUserIptvIdById(Long id, Long userIptvId, LocalDateTime now); | 86 | void updateUserIptvIdById(Long id, Long userIptvId, LocalDateTime now); |
| 89 | 87 | ||
| 90 | void doUpdateMemberCoupon(Member member); | 88 | void doUpdateMemberCoupon(Member member); |
| 89 | |||
| 90 | Integer doUpdateMemberUserIptvIdAndBindPlatformTypeAndBingTime(Member member); | ||
| 91 | |||
| 92 | Integer asyncDoUpdateGroupsBatch(List<Member> resources); | ||
| 91 | } | 93 | } | ... | ... |
| ... | @@ -25,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional; | ... | @@ -25,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional; |
| 25 | import java.time.LocalDateTime; | 25 | import java.time.LocalDateTime; |
| 26 | import java.util.List; | 26 | import java.util.List; |
| 27 | import java.util.Objects; | 27 | import java.util.Objects; |
| 28 | import java.util.Set; | ||
| 29 | import java.util.stream.Collectors; | ||
| 28 | 30 | ||
| 29 | /** | 31 | /** |
| 30 | * @author XiangHan | 32 | * @author XiangHan |
| ... | @@ -46,38 +48,30 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -46,38 +48,30 @@ public class MemberServiceImpl implements MemberService { |
| 46 | 48 | ||
| 47 | 49 | ||
| 48 | @Override | 50 | @Override |
| 49 | public MemberDTO findById(Long id) { | 51 | @Transactional(rollbackFor = Exception.class) |
| 50 | Member member = this.memberRepository.findById(id).orElseGet(Member::new); | 52 | public MemberDTO doUpdateMemberVipAndVipExpireTime(Member resource) { |
| 51 | ValidationUtil.isNull(member.getId(),"Member","id",id); | 53 | log.info("修改会员vip和vip过期时间 ==>> {}", resource); |
| 52 | 54 | ||
| 53 | return this.memberMapper.toDto(member); | 55 | Integer count = this.memberRepository.updateMemberVipAndVipExpireTime(resource); |
| 56 | if (Objects.nonNull(count) && count > 0) { | ||
| 57 | Member member = this.memberRepository.findById(resource.getId()).orElseGet(Member::new); | ||
| 58 | return this.memberMapper.toDto(member); | ||
| 59 | } | ||
| 54 | 60 | ||
| 61 | return this.memberMapper.toDto(resource); | ||
| 55 | } | 62 | } |
| 56 | 63 | ||
| 57 | @Override | 64 | @Override |
| 58 | public MemberDTO findByCode(String code) { | 65 | public MemberDTO findById(Long id) { |
| 59 | 66 | Member member = this.memberRepository.findById(id).orElseGet(Member::new); | |
| 60 | Member member = this.memberRepository.findFirstByCode(code).orElseGet(Member::new); | ||
| 61 | |||
| 62 | return this.memberMapper.toDto(member); | ||
| 63 | } | ||
| 64 | |||
| 65 | private MemberDTO findByIdOrCode(Long id, String code) { | ||
| 66 | |||
| 67 | Member member = this.memberRepository.findByIdOrCode(id,code).orElseGet(Member::new); | ||
| 68 | ValidationUtil.isNull(member.getId(),"Member","param",code); | ||
| 69 | |||
| 70 | return this.memberMapper.toDto(member); | 67 | return this.memberMapper.toDto(member); |
| 71 | 68 | ||
| 72 | } | 69 | } |
| 73 | 70 | ||
| 74 | @Override | 71 | @Override |
| 75 | public List<MemberDTO> findByUserIptvId(Long id) { | 72 | public MemberDTO findByCode(String code) { |
| 76 | 73 | Member member = this.memberRepository.findFirstByCode(code).orElseGet(Member::new); | |
| 77 | List<Member> memberList = this.memberRepository.findByUserIptvId(id); | 74 | return this.memberMapper.toDto(member); |
| 78 | |||
| 79 | return this.memberMapper.toDto(memberList); | ||
| 80 | |||
| 81 | } | 75 | } |
| 82 | 76 | ||
| 83 | @Override | 77 | @Override |
| ... | @@ -151,16 +145,6 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -151,16 +145,6 @@ public class MemberServiceImpl implements MemberService { |
| 151 | 145 | ||
| 152 | @Override | 146 | @Override |
| 153 | @Transactional(rollbackFor = Exception.class) | 147 | @Transactional(rollbackFor = Exception.class) |
| 154 | public MemberDTO createAndReturnMember(Member resources) { | ||
| 155 | |||
| 156 | MemberDTO memberDTO = this.create(MemberBuilder.build(resources)); | ||
| 157 | |||
| 158 | return memberDTO; | ||
| 159 | |||
| 160 | } | ||
| 161 | |||
| 162 | @Override | ||
| 163 | @Transactional(rollbackFor = Exception.class) | ||
| 164 | public void unbind(Member resources) { | 148 | public void unbind(Member resources) { |
| 165 | try { | 149 | try { |
| 166 | String code = resources.getCode(); | 150 | String code = resources.getCode(); |
| ... | @@ -194,6 +178,18 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -194,6 +178,18 @@ public class MemberServiceImpl implements MemberService { |
| 194 | 178 | ||
| 195 | @Override | 179 | @Override |
| 196 | @Transactional(rollbackFor = Exception.class) | 180 | @Transactional(rollbackFor = Exception.class) |
| 181 | public Integer doUpdateMemberUserIptvIdAndBindPlatformTypeAndBingTime(Member member) { | ||
| 182 | return this.memberRepository.doUpdateMemberUserIptvIdAndBindPlatformTypeAndBingTime(member); | ||
| 183 | } | ||
| 184 | |||
| 185 | @Override | ||
| 186 | public Integer asyncDoUpdateGroupsBatch(List<Member> resources) { | ||
| 187 | Set<String> codes = resources.stream().map(t -> t.getCode()).collect(Collectors.toSet()); | ||
| 188 | return this.memberRepository.doUpdateGroupsBatch( resources.get(0).getGroups(), codes); | ||
| 189 | } | ||
| 190 | |||
| 191 | @Override | ||
| 192 | @Transactional(rollbackFor = Exception.class) | ||
| 197 | public MemberDTO update(Member resources) { | 193 | public MemberDTO update(Member resources) { |
| 198 | 194 | ||
| 199 | log.info("MemberServiceImpl ==>> update ==>> resources ==>> [{}]" , resources); | 195 | log.info("MemberServiceImpl ==>> update ==>> resources ==>> [{}]" , resources); |
| ... | @@ -224,6 +220,17 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -224,6 +220,17 @@ public class MemberServiceImpl implements MemberService { |
| 224 | 220 | ||
| 225 | } | 221 | } |
| 226 | 222 | ||
| 223 | @Override | ||
| 224 | @Transactional(rollbackFor = Exception.class) | ||
| 225 | public MemberDTO doUpdateMemberAvatarUrlAndNicknameAndGender(Member resources) { | ||
| 226 | Integer count = this.memberRepository.updateMemberAvatarUrlAndNicknameAndGender(resources); | ||
| 227 | if (Objects.nonNull(count) && count > 0) { | ||
| 228 | Member member = this.memberRepository.findById(resources.getId()).orElseGet(Member::new); | ||
| 229 | return this.memberMapper.toDto(member); | ||
| 230 | } | ||
| 231 | return this.memberMapper.toDto(resources); | ||
| 232 | } | ||
| 233 | |||
| 227 | public Member save(Member member){ | 234 | public Member save(Member member){ |
| 228 | return this.memberRepository.save(member); | 235 | return this.memberRepository.save(member); |
| 229 | } | 236 | } | ... | ... |
| ... | @@ -17,6 +17,9 @@ public class MemberVipHistoryDTO implements Serializable { | ... | @@ -17,6 +17,9 @@ public class MemberVipHistoryDTO implements Serializable { |
| 17 | // 主键 | 17 | // 主键 |
| 18 | private Long id; | 18 | private Long id; |
| 19 | 19 | ||
| 20 | // | ||
| 21 | private String memberCode; | ||
| 22 | |||
| 20 | // 会员id | 23 | // 会员id |
| 21 | private Long memberId; | 24 | private Long memberId; |
| 22 | 25 | ... | ... |
| ... | @@ -5,7 +5,6 @@ import com.topdraw.business.module.points.available.repository.PointsAvailableRe | ... | @@ -5,7 +5,6 @@ import com.topdraw.business.module.points.available.repository.PointsAvailableRe |
| 5 | import com.topdraw.business.module.points.available.service.PointsAvailableService; | 5 | import com.topdraw.business.module.points.available.service.PointsAvailableService; |
| 6 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; | 6 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; |
| 7 | import com.topdraw.business.module.points.available.service.mapper.PointsAvailableMapper; | 7 | import com.topdraw.business.module.points.available.service.mapper.PointsAvailableMapper; |
| 8 | import com.topdraw.utils.RedisUtils; | ||
| 9 | import com.topdraw.utils.StringUtils; | 8 | import com.topdraw.utils.StringUtils; |
| 10 | import com.topdraw.utils.ValidationUtil; | 9 | import com.topdraw.utils.ValidationUtil; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -31,8 +30,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -31,8 +30,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
| 31 | private PointsAvailableRepository pointsAvailableRepository; | 30 | private PointsAvailableRepository pointsAvailableRepository; |
| 32 | @Autowired | 31 | @Autowired |
| 33 | private PointsAvailableMapper pointsAvailableMapper; | 32 | private PointsAvailableMapper pointsAvailableMapper; |
| 34 | @Autowired | ||
| 35 | private RedisUtils redisUtils; | ||
| 36 | 33 | ||
| 37 | @Override | 34 | @Override |
| 38 | public List<PointsAvailableDTO> findByMemberIdOrderByExpireTime(Long memberId) { | 35 | public List<PointsAvailableDTO> findByMemberIdOrderByExpireTime(Long memberId) { |
| ... | @@ -50,16 +47,11 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -50,16 +47,11 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
| 50 | @Transactional(rollbackFor = Exception.class) | 47 | @Transactional(rollbackFor = Exception.class) |
| 51 | public PointsAvailableDTO create(PointsAvailable resources) { | 48 | public PointsAvailableDTO create(PointsAvailable resources) { |
| 52 | try { | 49 | try { |
| 53 | |||
| 54 | this.redisUtils.doLock("PointsAvailable::create::id"+resources.getMemberId().toString()); | ||
| 55 | PointsAvailable pointsAvailable = this.pointsAvailableRepository.save(resources); | 50 | PointsAvailable pointsAvailable = this.pointsAvailableRepository.save(resources); |
| 56 | |||
| 57 | return this.pointsAvailableMapper.toDto(pointsAvailable); | 51 | return this.pointsAvailableMapper.toDto(pointsAvailable); |
| 58 | } catch (Exception e) { | 52 | } catch (Exception e) { |
| 59 | e.printStackTrace(); | 53 | e.printStackTrace(); |
| 60 | throw e; | 54 | throw e; |
| 61 | } finally { | ||
| 62 | this.redisUtils.doUnLock("PointsAvailable::create::id"+resources.getMemberId().toString()); | ||
| 63 | } | 55 | } |
| 64 | } | 56 | } |
| 65 | 57 | ||
| ... | @@ -67,7 +59,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -67,7 +59,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
| 67 | @Transactional(rollbackFor = Exception.class) | 59 | @Transactional(rollbackFor = Exception.class) |
| 68 | public PointsAvailableDTO update(PointsAvailable resources) { | 60 | public PointsAvailableDTO update(PointsAvailable resources) { |
| 69 | try { | 61 | try { |
| 70 | this.redisUtils.doLock("PointsAvailable::update::id"+resources.getMemberId().toString()); | ||
| 71 | PointsAvailable pointsAvailable = this.pointsAvailableRepository.findById(resources.getId()).orElseGet(PointsAvailable::new); | 62 | PointsAvailable pointsAvailable = this.pointsAvailableRepository.findById(resources.getId()).orElseGet(PointsAvailable::new); |
| 72 | ValidationUtil.isNull(pointsAvailable.getId(),"PointsAvailable","id",resources.getId()); | 63 | ValidationUtil.isNull(pointsAvailable.getId(),"PointsAvailable","id",resources.getId()); |
| 73 | pointsAvailable.copy(resources); | 64 | pointsAvailable.copy(resources); |
| ... | @@ -77,8 +68,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -77,8 +68,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
| 77 | } catch (Exception e) { | 68 | } catch (Exception e) { |
| 78 | e.printStackTrace(); | 69 | e.printStackTrace(); |
| 79 | throw e; | 70 | throw e; |
| 80 | } finally { | ||
| 81 | this.redisUtils.doUnLock("PointsAvailable::update::id"+resources.getMemberId().toString()); | ||
| 82 | } | 71 | } |
| 83 | } | 72 | } |
| 84 | 73 | ||
| ... | @@ -86,7 +75,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -86,7 +75,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
| 86 | @Transactional(rollbackFor = Exception.class) | 75 | @Transactional(rollbackFor = Exception.class) |
| 87 | public void delete(Long id) { | 76 | public void delete(Long id) { |
| 88 | Assert.notNull(id, "The given id must not be null!"); | 77 | Assert.notNull(id, "The given id must not be null!"); |
| 89 | this.redisUtils.doLock("PointsAvailable::delete::id"+id); | ||
| 90 | try { | 78 | try { |
| 91 | PointsAvailable PointsAvailable = this.pointsAvailableRepository.findById(id).orElseThrow( | 79 | PointsAvailable PointsAvailable = this.pointsAvailableRepository.findById(id).orElseThrow( |
| 92 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.points.available.domain.PointsAvailable.class, id), 1)); | 80 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.points.available.domain.PointsAvailable.class, id), 1)); |
| ... | @@ -94,22 +82,17 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -94,22 +82,17 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
| 94 | } catch (Exception e) { | 82 | } catch (Exception e) { |
| 95 | e.printStackTrace(); | 83 | e.printStackTrace(); |
| 96 | throw e; | 84 | throw e; |
| 97 | } finally { | ||
| 98 | this.redisUtils.doLock("PointsAvailable::delete::id"+id); | ||
| 99 | } | 85 | } |
| 100 | } | 86 | } |
| 101 | 87 | ||
| 102 | @Override | 88 | @Override |
| 103 | @Transactional(rollbackFor = Exception.class) | 89 | @Transactional(rollbackFor = Exception.class) |
| 104 | public void deleteBatchByIds(List<Long> id) { | 90 | public void deleteBatchByIds(List<Long> id) { |
| 105 | this.redisUtils.doLock("PointsAvailable::create::id"+id); | ||
| 106 | try { | 91 | try { |
| 107 | this.pointsAvailableRepository.deleteBatchByIds(id); | 92 | this.pointsAvailableRepository.deleteBatchByIds(id); |
| 108 | } catch (Exception e) { | 93 | } catch (Exception e) { |
| 109 | e.printStackTrace(); | 94 | e.printStackTrace(); |
| 110 | throw e; | 95 | throw e; |
| 111 | } finally { | ||
| 112 | this.redisUtils.doUnLock("PointsAvailable::create::id"+id); | ||
| 113 | } | 96 | } |
| 114 | } | 97 | } |
| 115 | 98 | ||
| ... | @@ -146,7 +129,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -146,7 +129,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
| 146 | @Override | 129 | @Override |
| 147 | public void delete4Custom(Long id) { | 130 | public void delete4Custom(Long id) { |
| 148 | Assert.notNull(id, "The given id must not be null!"); | 131 | Assert.notNull(id, "The given id must not be null!"); |
| 149 | this.redisUtils.doLock("PointsAvailable::delete::id"+id); | ||
| 150 | try { | 132 | try { |
| 151 | PointsAvailable PointsAvailable = this.pointsAvailableRepository.findById(id).orElseThrow( | 133 | PointsAvailable PointsAvailable = this.pointsAvailableRepository.findById(id).orElseThrow( |
| 152 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.points.available.domain.PointsAvailable.class, id), 1)); | 134 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.points.available.domain.PointsAvailable.class, id), 1)); |
| ... | @@ -154,22 +136,17 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { | ... | @@ -154,22 +136,17 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { |
| 154 | } catch (Exception e) { | 136 | } catch (Exception e) { |
| 155 | e.printStackTrace(); | 137 | e.printStackTrace(); |
| 156 | throw e; | 138 | throw e; |
| 157 | } finally { | ||
| 158 | this.redisUtils.doUnLock("PointsAvailable::delete::id"+id); | ||
| 159 | } | 139 | } |
| 160 | } | 140 | } |
| 161 | 141 | ||
| 162 | @Override | 142 | @Override |
| 163 | public PointsAvailableDTO create4Custom(PointsAvailable resources) { | 143 | public PointsAvailableDTO create4Custom(PointsAvailable resources) { |
| 164 | this.redisUtils.doLock("PointsAvailable::create::id"+resources.getMemberId().toString()); | ||
| 165 | try { | 144 | try { |
| 166 | PointsAvailable pointsAvailable = this.pointsAvailableRepository.save(resources); | 145 | PointsAvailable pointsAvailable = this.pointsAvailableRepository.save(resources); |
| 167 | return this.pointsAvailableMapper.toDto(pointsAvailable); | 146 | return this.pointsAvailableMapper.toDto(pointsAvailable); |
| 168 | } catch (Exception e) { | 147 | } catch (Exception e) { |
| 169 | e.printStackTrace(); | 148 | e.printStackTrace(); |
| 170 | throw e; | 149 | throw e; |
| 171 | } finally { | ||
| 172 | this.redisUtils.doUnLock("PointsAvailable::create::id"+resources.getMemberId().toString()); | ||
| 173 | } | 150 | } |
| 174 | } | 151 | } |
| 175 | 152 | ... | ... |
| ... | @@ -33,6 +33,10 @@ public class Task implements Serializable { | ... | @@ -33,6 +33,10 @@ public class Task implements Serializable { |
| 33 | @Column(name = "task_template_id", nullable = false) | 33 | @Column(name = "task_template_id", nullable = false) |
| 34 | private Long taskTemplateId; | 34 | private Long taskTemplateId; |
| 35 | 35 | ||
| 36 | /** 关联实体id */ | ||
| 37 | @Column(name = "entity_id", nullable = false) | ||
| 38 | private String entityId; | ||
| 39 | |||
| 36 | @Transient | 40 | @Transient |
| 37 | private String taskTemplateCode; | 41 | private String taskTemplateCode; |
| 38 | 42 | ... | ... |
| ... | @@ -19,6 +19,9 @@ public class TaskDTO implements Serializable { | ... | @@ -19,6 +19,9 @@ public class TaskDTO implements Serializable { |
| 19 | /** 任务模板id */ | 19 | /** 任务模板id */ |
| 20 | private Long taskTemplateId; | 20 | private Long taskTemplateId; |
| 21 | 21 | ||
| 22 | /** 关联实体id */ | ||
| 23 | private String entityId; | ||
| 24 | |||
| 22 | /** 任务重复类型,-1:不限次;1:单次;>1:多次 */ | 25 | /** 任务重复类型,-1:不限次;1:单次;>1:多次 */ |
| 23 | private Integer taskRepeatType; | 26 | private Integer taskRepeatType; |
| 24 | 27 | ... | ... |
| 1 | package com.topdraw.business.module.task.template.constant; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/18 14:30 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/18 14:30 | ||
| 11 | */ | ||
| 12 | public interface TaskEventName { | ||
| 13 | //类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置; | ||
| 14 | // 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他 | ||
| 15 | String LOGIN = "LOGIN"; | ||
| 16 | String VIEW = "VIEW"; | ||
| 17 | String ACTIVITY = "ACTIVITY"; | ||
| 18 | String ORDER = "ORDER"; | ||
| 19 | String MEMBER_PRIORITY = "MEMBER_PRIORITY"; | ||
| 20 | String SIGN = "SIGN"; | ||
| 21 | String COMPLETE_INFO = "COMPLETE_INFO"; | ||
| 22 | String PLAY = "PLAY"; | ||
| 23 | String BINDING = "BINDING"; | ||
| 24 | String POINTS_TRANS = "POINTS_TRANS"; | ||
| 25 | String POINTS_EXCHANGE_GOODS = "POINTS_EXCHANGE_GOODS"; | ||
| 26 | String SYSTEM_OPERATE = "SYSTEM_OPERATE"; | ||
| 27 | String OTHER = "OHHER"; | ||
| 28 | |||
| 29 | } |
| 1 | package com.topdraw.business.module.task.template.constant; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/18 14:30 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/18 14:30 | ||
| 11 | */ | ||
| 12 | public interface TaskEventType { | ||
| 13 | //类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置; | ||
| 14 | // 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他 | ||
| 15 | int LOGIN = 1; | ||
| 16 | int VIEW = 2; | ||
| 17 | int ACTIVITY = 3; | ||
| 18 | int ORDER = 4; | ||
| 19 | int MEMBER_PRIORITY = 5; | ||
| 20 | int SIGN = 6; | ||
| 21 | int COMPLETE_INFO = 7; | ||
| 22 | int PLAY = 8; | ||
| 23 | int BINDING = 10; | ||
| 24 | int POINTS_TRANS = 11; | ||
| 25 | int POINTS_EXCHANGE_GOODS = 30; | ||
| 26 | int SYSTEM_OPERATE = 98; | ||
| 27 | int OHHER = 99; | ||
| 28 | |||
| 29 | } |
| 1 | package com.topdraw.business.module.user.app.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.annotation.CreatedDate; | ||
| 8 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 10 | |||
| 11 | import javax.persistence.*; | ||
| 12 | import java.io.Serializable; | ||
| 13 | import java.sql.Timestamp; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-06-27 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="uc_user_app") | ||
| 24 | public class UserApp implements Serializable { | ||
| 25 | |||
| 26 | // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号 | ||
| 27 | @Transient | ||
| 28 | private Integer accountType; | ||
| 29 | |||
| 30 | // 第三方账号 | ||
| 31 | @Transient | ||
| 32 | private String account; | ||
| 33 | |||
| 34 | // ID | ||
| 35 | @Id | ||
| 36 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 37 | @Column(name = "id") | ||
| 38 | private Long id; | ||
| 39 | |||
| 40 | // 会员id | ||
| 41 | @Column(name = "member_id") | ||
| 42 | private Long memberId; | ||
| 43 | |||
| 44 | // 用户名(一般为手机号) | ||
| 45 | @Column(name = "username", nullable = false) | ||
| 46 | private String username; | ||
| 47 | |||
| 48 | // 密码 | ||
| 49 | @Column(name = "password") | ||
| 50 | private String password; | ||
| 51 | |||
| 52 | // 类型 0:苹果;1:安卓;-1:未知 | ||
| 53 | @Column(name = "type", nullable = false) | ||
| 54 | private Integer type; | ||
| 55 | |||
| 56 | // 状态 0:禁用;1:生效;-1:注销 | ||
| 57 | @Column(name = "status", nullable = false) | ||
| 58 | private Integer status; | ||
| 59 | |||
| 60 | // 昵称 | ||
| 61 | @Column(name = "nickname") | ||
| 62 | private String nickname; | ||
| 63 | |||
| 64 | // 头像地址 | ||
| 65 | @Column(name = "headimgurl") | ||
| 66 | private String headimgurl; | ||
| 67 | |||
| 68 | // 邮箱 | ||
| 69 | @Column(name = "email") | ||
| 70 | private String email; | ||
| 71 | |||
| 72 | // 手机号 | ||
| 73 | @Column(name = "cellphone") | ||
| 74 | private String cellphone; | ||
| 75 | |||
| 76 | // 性别 0:女;1:男;-1:其他 | ||
| 77 | @Column(name = "gender") | ||
| 78 | private Integer gender; | ||
| 79 | |||
| 80 | // 生日 | ||
| 81 | @Column(name = "birthday") | ||
| 82 | private String birthday; | ||
| 83 | |||
| 84 | // 最近活跃时间 | ||
| 85 | @Column(name = "last_active_time") | ||
| 86 | private Timestamp lastActiveTime; | ||
| 87 | |||
| 88 | // 注销时间 | ||
| 89 | @Column(name = "delete_time") | ||
| 90 | private Timestamp deleteTime; | ||
| 91 | |||
| 92 | // 标签 | ||
| 93 | @Column(name = "tags") | ||
| 94 | private String tags; | ||
| 95 | |||
| 96 | // 描述 | ||
| 97 | @Column(name = "description") | ||
| 98 | private String description; | ||
| 99 | |||
| 100 | // 创建时间 | ||
| 101 | @CreatedDate | ||
| 102 | @Column(name = "create_time") | ||
| 103 | private Timestamp createTime; | ||
| 104 | |||
| 105 | // 更新时间 | ||
| 106 | @LastModifiedDate | ||
| 107 | @Column(name = "update_time") | ||
| 108 | private Timestamp updateTime; | ||
| 109 | |||
| 110 | public void copy(UserApp source){ | ||
| 111 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 112 | } | ||
| 113 | } |
| 1 | package com.topdraw.business.module.user.app.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.annotation.CreatedDate; | ||
| 8 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 10 | |||
| 11 | import javax.persistence.*; | ||
| 12 | import java.io.Serializable; | ||
| 13 | import java.sql.Timestamp; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-06-27 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="uc_user_app_bind") | ||
| 24 | public class UserAppBind implements Serializable { | ||
| 25 | |||
| 26 | @Transient | ||
| 27 | private String username; | ||
| 28 | |||
| 29 | @Transient | ||
| 30 | private String password; | ||
| 31 | @Transient | ||
| 32 | private String headImgUrl; | ||
| 33 | |||
| 34 | // 主键 | ||
| 35 | @Id | ||
| 36 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 37 | @Column(name = "id") | ||
| 38 | private Long id; | ||
| 39 | |||
| 40 | // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号 | ||
| 41 | @Column(name = "account_type", nullable = false) | ||
| 42 | private Integer accountType; | ||
| 43 | |||
| 44 | // 第三方账号 | ||
| 45 | @Column(name = "account", nullable = false) | ||
| 46 | private String account; | ||
| 47 | |||
| 48 | // app账号id | ||
| 49 | @Column(name = "user_app_id", nullable = false) | ||
| 50 | private Long userAppId; | ||
| 51 | |||
| 52 | // 绑定状态 0:解绑;1 绑定 | ||
| 53 | @Column(name = "status", nullable = false) | ||
| 54 | private Integer status; | ||
| 55 | |||
| 56 | // 昵称 | ||
| 57 | @Column(name = "nickname", nullable = false) | ||
| 58 | private String nickname; | ||
| 59 | |||
| 60 | // 创建时间 | ||
| 61 | @CreatedDate | ||
| 62 | @Column(name = "create_time") | ||
| 63 | private Timestamp createTime; | ||
| 64 | |||
| 65 | // 更新时间 | ||
| 66 | @LastModifiedDate | ||
| 67 | @Column(name = "update_time") | ||
| 68 | private Timestamp updateTime; | ||
| 69 | |||
| 70 | public void copy(UserAppBind source){ | ||
| 71 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 72 | } | ||
| 73 | } |
| 1 | package com.topdraw.business.module.user.app.domain; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/30 13:18 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/30 13:18 | ||
| 11 | */ | ||
| 12 | public class UserAppBindBuilder { | ||
| 13 | |||
| 14 | public static UserAppBind build(Long userAppId, String account, Integer accountType){ | ||
| 15 | UserAppBind userAppBind = new UserAppBind(); | ||
| 16 | userAppBind.setAccount(account); | ||
| 17 | userAppBind.setUserAppId(userAppId); | ||
| 18 | userAppBind.setAccountType(accountType); | ||
| 19 | userAppBind.setStatus(UserAppStatusConstant.VALID_STATUS); | ||
| 20 | return userAppBind; | ||
| 21 | } | ||
| 22 | |||
| 23 | } |
| 1 | package com.topdraw.business.module.user.app.domain; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/30 11:42 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/30 11:42 | ||
| 11 | */ | ||
| 12 | public interface UserAppBindStatusConstant { | ||
| 13 | // 绑定状态 0:解绑;1 绑定 | ||
| 14 | Integer VALID_STATUS = 1; | ||
| 15 | Integer INVALID_STATUS = 0; | ||
| 16 | |||
| 17 | } |
| 1 | package com.topdraw.business.module.user.app.domain; | ||
| 2 | |||
| 3 | import com.topdraw.util.TimestampUtil; | ||
| 4 | import org.apache.commons.lang3.StringUtils; | ||
| 5 | |||
| 6 | import java.util.Objects; | ||
| 7 | |||
| 8 | /** | ||
| 9 | * @author : | ||
| 10 | * @description: | ||
| 11 | * @function : | ||
| 12 | * @date :Created in 2022/6/30 11:35 | ||
| 13 | * @version: : | ||
| 14 | * @modified By: | ||
| 15 | * @since : modified in 2022/6/30 11:35 | ||
| 16 | */ | ||
| 17 | public class UserAppBuilder { | ||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | public static UserApp build(Long memberId, UserApp resource){ | ||
| 22 | |||
| 23 | UserApp userApp = new UserApp(); | ||
| 24 | userApp.setId(null); | ||
| 25 | userApp.setMemberId(memberId); | ||
| 26 | userApp.setUsername(resource.getUsername()); | ||
| 27 | userApp.setTags(resource.getTags()); | ||
| 28 | userApp.setLastActiveTime(TimestampUtil.now()); | ||
| 29 | userApp.setEmail(resource.getEmail()); | ||
| 30 | userApp.setType(Objects.isNull(resource.getType()) ? resource.getType() : -1); | ||
| 31 | userApp.setNickname(StringUtils.isNotBlank(resource.getNickname()) ? resource.getNickname() : resource.getUsername()); | ||
| 32 | userApp.setHeadimgurl(resource.getHeadimgurl()); | ||
| 33 | userApp.setPassword(resource.getPassword()); | ||
| 34 | userApp.setCellphone(StringUtils.isNotBlank(resource.getCellphone()) ? resource.getCellphone() : resource.getUsername()); | ||
| 35 | userApp.setBirthday(StringUtils.isNotBlank(resource.getBirthday()) ? resource.getBirthday() : "1900-01-01"); | ||
| 36 | userApp.setGender(Objects.nonNull(resource.getGender()) ? resource.getGender() : 0); | ||
| 37 | userApp.setStatus(UserAppStatusConstant.VALID_STATUS); | ||
| 38 | userApp.setCreateTime(null); | ||
| 39 | userApp.setUpdateTime(null); | ||
| 40 | return userApp; | ||
| 41 | } | ||
| 42 | |||
| 43 | |||
| 44 | } |
| 1 | package com.topdraw.business.module.user.app.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.annotation.CreatedDate; | ||
| 8 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 10 | |||
| 11 | import javax.persistence.*; | ||
| 12 | import java.io.Serializable; | ||
| 13 | import java.sql.Timestamp; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-06-27 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="uc_user_app") | ||
| 24 | public class UserAppIdManual implements Serializable { | ||
| 25 | |||
| 26 | // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号 | ||
| 27 | @Transient | ||
| 28 | private Integer accountType; | ||
| 29 | |||
| 30 | // 第三方账号 | ||
| 31 | @Transient | ||
| 32 | private String account; | ||
| 33 | |||
| 34 | @Transient | ||
| 35 | private String memberCode; | ||
| 36 | |||
| 37 | // ID | ||
| 38 | @Id | ||
| 39 | @GeneratedValue(strategy = GenerationType.SEQUENCE) | ||
| 40 | @Column(name = "id") | ||
| 41 | private Long id; | ||
| 42 | |||
| 43 | // 会员id | ||
| 44 | @Column(name = "member_id") | ||
| 45 | private Long memberId; | ||
| 46 | |||
| 47 | // 用户名(一般为手机号) | ||
| 48 | @Column(name = "username", nullable = false) | ||
| 49 | private String username; | ||
| 50 | |||
| 51 | // 密码 | ||
| 52 | @Column(name = "password") | ||
| 53 | private String password; | ||
| 54 | |||
| 55 | // 类型 0:苹果;1:安卓;-1:未知 | ||
| 56 | @Column(name = "type", nullable = false) | ||
| 57 | private Integer type; | ||
| 58 | |||
| 59 | // 状态 0:禁用;1:生效;-1:注销 | ||
| 60 | @Column(name = "status", nullable = false) | ||
| 61 | private Integer status; | ||
| 62 | |||
| 63 | // 昵称 | ||
| 64 | @Column(name = "nickname") | ||
| 65 | private String nickname; | ||
| 66 | |||
| 67 | // 头像地址 | ||
| 68 | @Column(name = "headimgurl") | ||
| 69 | private String headimgurl; | ||
| 70 | |||
| 71 | // 邮箱 | ||
| 72 | @Column(name = "email") | ||
| 73 | private String email; | ||
| 74 | |||
| 75 | // 手机号 | ||
| 76 | @Column(name = "cellphone") | ||
| 77 | private String cellphone; | ||
| 78 | |||
| 79 | // 性别 0:女;1:男;-1:其他 | ||
| 80 | @Column(name = "gender") | ||
| 81 | private Integer gender; | ||
| 82 | |||
| 83 | // 生日 | ||
| 84 | @Column(name = "birthday") | ||
| 85 | private String birthday; | ||
| 86 | |||
| 87 | // 最近活跃时间 | ||
| 88 | @Column(name = "last_active_time") | ||
| 89 | private Timestamp lastActiveTime; | ||
| 90 | |||
| 91 | // 注销时间 | ||
| 92 | @Column(name = "delete_time") | ||
| 93 | private Timestamp deleteTime; | ||
| 94 | |||
| 95 | // 标签 | ||
| 96 | @Column(name = "tags") | ||
| 97 | private String tags; | ||
| 98 | |||
| 99 | // 描述 | ||
| 100 | @Column(name = "description") | ||
| 101 | private String description; | ||
| 102 | |||
| 103 | // 创建时间 | ||
| 104 | @CreatedDate | ||
| 105 | @Column(name = "create_time") | ||
| 106 | private Timestamp createTime; | ||
| 107 | |||
| 108 | // 更新时间 | ||
| 109 | @LastModifiedDate | ||
| 110 | @Column(name = "update_time") | ||
| 111 | private Timestamp updateTime; | ||
| 112 | |||
| 113 | public void copy(UserAppIdManual source){ | ||
| 114 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 115 | } | ||
| 116 | } |
| 1 | package com.topdraw.business.module.user.app.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 8 | |||
| 9 | import javax.persistence.*; | ||
| 10 | import java.io.Serializable; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @author XiangHan | ||
| 14 | * @date 2022-06-27 | ||
| 15 | */ | ||
| 16 | @Entity | ||
| 17 | @Data | ||
| 18 | @EntityListeners(AuditingEntityListener.class) | ||
| 19 | @Accessors(chain = true) | ||
| 20 | @Table(name="uc_user_app") | ||
| 21 | public class UserAppSimple implements Serializable { | ||
| 22 | |||
| 23 | // ID | ||
| 24 | @Id | ||
| 25 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 26 | @Column(name = "id") | ||
| 27 | private Long id; | ||
| 28 | |||
| 29 | // 会员id | ||
| 30 | @Column(name = "member_id") | ||
| 31 | private Long memberId; | ||
| 32 | |||
| 33 | // 用户名(一般为手机号) | ||
| 34 | @Column(name = "username", nullable = false) | ||
| 35 | private String username; | ||
| 36 | |||
| 37 | // 状态 0:禁用;1:生效;-1:注销 | ||
| 38 | @Column(name = "status", nullable = false) | ||
| 39 | private Integer status; | ||
| 40 | |||
| 41 | // 昵称 | ||
| 42 | @Column(name = "nickname") | ||
| 43 | private String nickname; | ||
| 44 | |||
| 45 | // 头像地址 | ||
| 46 | @Column(name = "headimgurl") | ||
| 47 | private String headimgurl; | ||
| 48 | |||
| 49 | // 邮箱 | ||
| 50 | @Column(name = "email") | ||
| 51 | private String email; | ||
| 52 | |||
| 53 | // 手机号 | ||
| 54 | @Column(name = "cellphone") | ||
| 55 | private String cellphone; | ||
| 56 | |||
| 57 | // 性别 0:女;1:男;-1:其他 | ||
| 58 | @Column(name = "gender") | ||
| 59 | private Integer gender; | ||
| 60 | |||
| 61 | // 生日 | ||
| 62 | @Column(name = "birthday") | ||
| 63 | private String birthday; | ||
| 64 | |||
| 65 | // 标签 | ||
| 66 | @Column(name = "tags") | ||
| 67 | private String tags; | ||
| 68 | |||
| 69 | // 描述 | ||
| 70 | @Column(name = "description") | ||
| 71 | private String description; | ||
| 72 | |||
| 73 | public void copy(UserAppSimple source){ | ||
| 74 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 75 | } | ||
| 76 | } |
| 1 | package com.topdraw.business.module.user.app.domain; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/30 11:42 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/30 11:42 | ||
| 11 | */ | ||
| 12 | public interface UserAppStatusConstant { | ||
| 13 | // 状态 0:禁用;1:生效;-1:注销 | ||
| 14 | Integer VALID_STATUS = 1; | ||
| 15 | Integer FORBID_STATUS = 0; | ||
| 16 | Integer INVALID_STATUS = -1; | ||
| 17 | |||
| 18 | } |
| 1 | package com.topdraw.business.module.user.app.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.app.domain.UserAppBind; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | import org.springframework.data.jpa.repository.Modifying; | ||
| 7 | import org.springframework.data.jpa.repository.Query; | ||
| 8 | import org.springframework.data.repository.query.Param; | ||
| 9 | |||
| 10 | import java.util.List; | ||
| 11 | import java.util.Optional; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * @author XiangHan | ||
| 15 | * @date 2022-06-27 | ||
| 16 | */ | ||
| 17 | public interface UserAppBindRepository extends JpaRepository<UserAppBind, Long>, JpaSpecificationExecutor<UserAppBind> { | ||
| 18 | |||
| 19 | Optional<UserAppBind> findFirstByAccount(String account); | ||
| 20 | |||
| 21 | @Modifying | ||
| 22 | @Query(value = "UPDATE `uc_user_app_bind` SET `status` = 0 , `update_time` = now() WHERE `account` = ?1 AND `account_type` = ?2", nativeQuery = true) | ||
| 23 | Integer cancelUserAppBind(String account, Integer accountType); | ||
| 24 | |||
| 25 | Optional<UserAppBind> findFirstByAccountAndAccountType(String account, Integer accountType); | ||
| 26 | |||
| 27 | @Modifying | ||
| 28 | @Query(value = "UPDATE `uc_user_app_bind` SET `status` = :#{#resources.status}, `update_time` = now(), " + | ||
| 29 | " `user_app_id` = :#{#resources.userAppId}, `nickname` = :#{#resources.nickname} " + | ||
| 30 | " WHERE `account` = :#{#resources.account} AND accountType = :#{#resources.accountType}", nativeQuery = true) | ||
| 31 | Integer updateThirdAccount(@Param("resources") UserAppBind resources); | ||
| 32 | |||
| 33 | @Modifying | ||
| 34 | @Query(value = "UPDATE `uc_user_app_bind` SET `status` = :#{#resources.status}, `update_time` = now(), " + | ||
| 35 | " `user_app_id` = :#{#resources.userAppId} WHERE `account` = :#{#resources.account} AND accountType = :#{#resources.accountType}", | ||
| 36 | nativeQuery = true) | ||
| 37 | Integer updateThirdAccountStatusAndUserAppId(@Param("resources") UserAppBind resources); | ||
| 38 | |||
| 39 | @Modifying | ||
| 40 | @Query(value = "UPDATE `uc_user_app_bind` SET `status` = 1, `update_time` = now(), " + | ||
| 41 | " `user_app_id` = :#{#resources.userAppId} WHERE `account` = :#{#resources.account} AND accountType = :#{#resources.accountType}", | ||
| 42 | nativeQuery = true) | ||
| 43 | Integer updateValidStatusAndUserAppId(@Param("resources") UserAppBind resources); | ||
| 44 | |||
| 45 | |||
| 46 | @Modifying | ||
| 47 | @Query(value = "UPDATE `uc_user_app_bind` SET `update_time` = now(), `nickname` = :#{#resources.nickname} " + | ||
| 48 | " WHERE `account` = :#{#resources.account} AND `account_type` = :#{#resources.accountType}", nativeQuery = true) | ||
| 49 | Integer updateThirdAccountNickname(@Param("resources") UserAppBind resources); | ||
| 50 | |||
| 51 | @Modifying | ||
| 52 | @Query(value = "UPDATE `uc_user_app_bind` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, `status` = 1, `user_app_id` = :#{#resources.userAppId} " + | ||
| 53 | " WHERE `account` = :#{#resources.account} AND `account_type` = :#{#resources.accountType}", nativeQuery = true) | ||
| 54 | Integer updateValidStatusAndUserAppIdAndNickname(@Param("resources") UserAppBind resources); | ||
| 55 | |||
| 56 | @Modifying | ||
| 57 | @Query(value = "UPDATE `uc_user_app_bind` SET `update_time` = now(), `status` = 0 WHERE `id` IN ?1", nativeQuery = true) | ||
| 58 | Integer appCancellation(List<Long> ids); | ||
| 59 | |||
| 60 | List<UserAppBind> findByUserAppId(Long id); | ||
| 61 | } | ||
| 62 |
| 1 | package com.topdraw.business.module.user.app.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.app.domain.UserApp; | ||
| 4 | import com.topdraw.business.module.user.app.domain.UserAppIdManual; | ||
| 5 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 7 | import org.springframework.data.jpa.repository.Modifying; | ||
| 8 | import org.springframework.data.jpa.repository.Query; | ||
| 9 | import org.springframework.data.repository.query.Param; | ||
| 10 | |||
| 11 | import java.util.Optional; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * @author XiangHan | ||
| 15 | * @date 2022-06-27 | ||
| 16 | */ | ||
| 17 | public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpecificationExecutor<UserApp> { | ||
| 18 | |||
| 19 | @Query(value = "SELECT ua.* FROM uc_user_app ua WHERE ua.`username` = ?1 and ua.`status` IN (0 , 1)", nativeQuery = true) | ||
| 20 | Optional<UserApp> findByUsername(String username); | ||
| 21 | |||
| 22 | Optional<UserApp> findByUsernameAndPassword(String username, String password); | ||
| 23 | |||
| 24 | @Modifying | ||
| 25 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `last_active_time` = now() WHERE `username` = ?1 AND `status` = 1 ", nativeQuery = true) | ||
| 26 | Integer updateLastActiveTime(String username); | ||
| 27 | |||
| 28 | @Modifying | ||
| 29 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `username` = ?1 AND `status` = 1", nativeQuery = true) | ||
| 30 | Integer updatePasswordByUsername(String username, String password); | ||
| 31 | |||
| 32 | @Modifying | ||
| 33 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, " + | ||
| 34 | " `headimgurl` = :#{#resources.headimgurl}, `email` = :#{#resources.email}, `cellphone` = :#{#resources.cellphone}, " + | ||
| 35 | " `gender` = :#{#resources.gender}, `birthday` = :#{#resources.birthday}, `tags` = :#{#resources.tags}, `description` = :#{#resources.description}" + | ||
| 36 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | ||
| 37 | Integer updateAppInfo(@Param("resources") UserApp resources); | ||
| 38 | |||
| 39 | @Modifying | ||
| 40 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `id` = ?1", nativeQuery = true) | ||
| 41 | Integer updatePasswordById(Long id, String password); | ||
| 42 | |||
| 43 | @Modifying | ||
| 44 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(),`delete_time` = now(), `status` = -1 WHERE `id` = ?1", nativeQuery = true) | ||
| 45 | Integer appCancellation(Long id); | ||
| 46 | |||
| 47 | @Modifying | ||
| 48 | @Query(value = "UPDATE `uc_user_app` SET `last_active_time` = now(), `nickname` = ?2, `headimgurl` = ?3 " + | ||
| 49 | " WHERE `username` = ?1 and `status` = 1 ", nativeQuery = true) | ||
| 50 | Integer updateAppLastActiveTimeAndNicknameAndHeadImg(String username, String nickname, String headimgurl); | ||
| 51 | |||
| 52 | @Modifying | ||
| 53 | @Query(value = "INSERT INTO `uc_user_app`(`id`, `member_id`, `username`, `password`, `type`, `status`, `nickname`, `headimgurl`, `email`, `cellphone`, `gender`, `birthday`, `last_active_time`, `delete_time`, `tags`, `description`, `create_time`, `update_time`) " + | ||
| 54 | " VALUES (:#{#resources.id}, :#{#resources.memberId}, :#{#resources.username}, :#{#resources.password}, :#{#resources.type}," + | ||
| 55 | " 1, :#{#resources.nickname}, :#{#resources.headimgurl}, :#{#resources.email}, :#{#resources.cellphone}, " + | ||
| 56 | " :#{#resources.gender}, NULL, now(), NULL, :#{#resources.tags}, " + | ||
| 57 | " :#{#resources.description}, :#{#resources.createTime}, now());", nativeQuery = true) | ||
| 58 | void saveByIdManual(@Param("resources") UserAppIdManual userAppIdManual); | ||
| 59 | |||
| 60 | @Modifying | ||
| 61 | @Query(value = "UPDATE `uc_user_app` SET `username`= :#{#resources.username},`cellphone`= :#{#resources.cellphone}, `last_active_time` = now(), `nickname` = :#{#resources.nickname}, `headimgurl` = :#{#resources.headimgurl} " + | ||
| 62 | " WHERE `id` = :#{#resources.id} and `status` = 1 ", nativeQuery = true) | ||
| 63 | Integer updateAppLastActiveTimeAndNicknameAndHeadImgById(@Param("resources") UserApp userApp); | ||
| 64 | } |
src/main/java/com/topdraw/business/module/user/app/repository/UserAppSimpleRepository.java
0 → 100644
| 1 | package com.topdraw.business.module.user.app.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.app.domain.UserAppSimple; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-06-27 | ||
| 10 | */ | ||
| 11 | public interface UserAppSimpleRepository extends JpaRepository<UserAppSimple, Long>, JpaSpecificationExecutor<UserAppSimple> { | ||
| 12 | |||
| 13 | } |
| 1 | package com.topdraw.business.module.user.app.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.app.domain.UserAppBind; | ||
| 4 | import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; | ||
| 5 | |||
| 6 | import java.util.List; | ||
| 7 | |||
| 8 | /** | ||
| 9 | * @author XiangHan | ||
| 10 | * @date 2022-06-27 | ||
| 11 | */ | ||
| 12 | public interface UserAppBindService { | ||
| 13 | |||
| 14 | /** | ||
| 15 | * 根据ID查询 | ||
| 16 | * @param id ID | ||
| 17 | * @return UserAppBindDTO | ||
| 18 | */ | ||
| 19 | UserAppBindDTO findById(Long id); | ||
| 20 | |||
| 21 | /** | ||
| 22 | * | ||
| 23 | * @param resources | ||
| 24 | */ | ||
| 25 | UserAppBindDTO create(UserAppBind resources); | ||
| 26 | |||
| 27 | /** | ||
| 28 | * | ||
| 29 | * @param resources | ||
| 30 | */ | ||
| 31 | void update(UserAppBind resources); | ||
| 32 | |||
| 33 | /** | ||
| 34 | * | ||
| 35 | * @param id | ||
| 36 | */ | ||
| 37 | void delete(Long id); | ||
| 38 | |||
| 39 | /** | ||
| 40 | * | ||
| 41 | * @param account | ||
| 42 | * @return | ||
| 43 | */ | ||
| 44 | UserAppBindDTO findFirstByAccount(String account); | ||
| 45 | |||
| 46 | /** | ||
| 47 | * | ||
| 48 | * @param account | ||
| 49 | * @return | ||
| 50 | */ | ||
| 51 | boolean cancelUserAppBind(String account, Integer accountType); | ||
| 52 | |||
| 53 | /** | ||
| 54 | * | ||
| 55 | * @param account | ||
| 56 | * @param accountType | ||
| 57 | * @return | ||
| 58 | */ | ||
| 59 | UserAppBindDTO findFirstByAccountAndAccountType(String account, Integer accountType); | ||
| 60 | |||
| 61 | /** | ||
| 62 | * | ||
| 63 | * @param resources | ||
| 64 | * @return | ||
| 65 | */ | ||
| 66 | boolean updateThirdAccount(UserAppBind resources); | ||
| 67 | |||
| 68 | /** | ||
| 69 | * | ||
| 70 | * @param resources | ||
| 71 | * @return | ||
| 72 | */ | ||
| 73 | boolean updateThirdAccountNickname(UserAppBind resources); | ||
| 74 | |||
| 75 | /** | ||
| 76 | * | ||
| 77 | * @param resources | ||
| 78 | * @return | ||
| 79 | */ | ||
| 80 | boolean updateValidStatusAndUserAppIdAndNickname(UserAppBind resources); | ||
| 81 | |||
| 82 | boolean appCancellation(List<Long> ids); | ||
| 83 | |||
| 84 | List<UserAppBindDTO> findByUserAppId(Long id); | ||
| 85 | } |
| 1 | package com.topdraw.business.module.user.app.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.app.domain.UserApp; | ||
| 4 | import com.topdraw.business.module.user.app.domain.UserAppBind; | ||
| 5 | import com.topdraw.business.module.user.app.domain.UserAppIdManual; | ||
| 6 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | ||
| 7 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 8 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
| 9 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
| 10 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
| 11 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * @author XiangHan | ||
| 15 | * @date 2022-06-27 | ||
| 16 | */ | ||
| 17 | public interface UserAppService { | ||
| 18 | |||
| 19 | /** | ||
| 20 | * 根据ID查询 | ||
| 21 | * @param id ID | ||
| 22 | * @return UserAppDTO | ||
| 23 | */ | ||
| 24 | UserAppDTO findById(Long id); | ||
| 25 | |||
| 26 | /** | ||
| 27 | * 检查账号和秘密 | ||
| 28 | * @param username | ||
| 29 | * @return | ||
| 30 | */ | ||
| 31 | UserAppDTO findByUsername(String username); | ||
| 32 | |||
| 33 | |||
| 34 | /** | ||
| 35 | * | ||
| 36 | * @param resources | ||
| 37 | */ | ||
| 38 | UserAppDTO create(UserApp resources); | ||
| 39 | |||
| 40 | /** | ||
| 41 | * | ||
| 42 | * @param resources | ||
| 43 | */ | ||
| 44 | UserAppDTO update(UserApp resources); | ||
| 45 | |||
| 46 | /** | ||
| 47 | * | ||
| 48 | * @param id | ||
| 49 | */ | ||
| 50 | void delete(Long id); | ||
| 51 | |||
| 52 | /** | ||
| 53 | * | ||
| 54 | * @param resources | ||
| 55 | * @return | ||
| 56 | */ | ||
| 57 | boolean updateLastActiveTime(UserAppBind resources); | ||
| 58 | |||
| 59 | /** | ||
| 60 | * | ||
| 61 | * @param resources | ||
| 62 | * @return | ||
| 63 | */ | ||
| 64 | boolean updatePasswordByUsername(UserApp resources); | ||
| 65 | |||
| 66 | /** | ||
| 67 | * | ||
| 68 | * @param resources | ||
| 69 | * @return | ||
| 70 | */ | ||
| 71 | boolean updatePasswordById(UserApp resources); | ||
| 72 | |||
| 73 | /** | ||
| 74 | * | ||
| 75 | * @param resources | ||
| 76 | * @return | ||
| 77 | */ | ||
| 78 | boolean updateAppInfo(UserApp resources); | ||
| 79 | |||
| 80 | /** | ||
| 81 | * | ||
| 82 | * @param id | ||
| 83 | * @return | ||
| 84 | */ | ||
| 85 | boolean appCancellation(Long id); | ||
| 86 | |||
| 87 | /** | ||
| 88 | * | ||
| 89 | * @param resources | ||
| 90 | * @return | ||
| 91 | */ | ||
| 92 | boolean updateAppLastActiveTimeAndNicknameAndHeadImg(UserApp resources); | ||
| 93 | |||
| 94 | /** | ||
| 95 | * | ||
| 96 | * @param resources | ||
| 97 | * @return | ||
| 98 | */ | ||
| 99 | boolean asyncSaveByIdManual(UserAppIdManual resources); | ||
| 100 | |||
| 101 | |||
| 102 | } |
| 1 | package com.topdraw.business.module.user.app.service.dto; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 4 | import lombok.Data; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * @author : | ||
| 8 | * @description: | ||
| 9 | * @function : | ||
| 10 | * @date :Created in 2022/7/11 21:21 | ||
| 11 | * @version: : | ||
| 12 | * @modified By: | ||
| 13 | * @since : modified in 2022/7/11 21:21 | ||
| 14 | */ | ||
| 15 | @Data | ||
| 16 | public class AppRegisterDTO { | ||
| 17 | |||
| 18 | private UserAppDTO userAppDTO; | ||
| 19 | |||
| 20 | private MemberDTO memberDTO; | ||
| 21 | |||
| 22 | } |
| 1 | package com.topdraw.business.module.user.app.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import java.io.Serializable; | ||
| 6 | import java.sql.Timestamp; | ||
| 7 | |||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-06-27 | ||
| 12 | */ | ||
| 13 | @Data | ||
| 14 | public class UserAppBindDTO implements Serializable { | ||
| 15 | |||
| 16 | // 主键 | ||
| 17 | private Long id; | ||
| 18 | |||
| 19 | // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号 | ||
| 20 | private Integer accountType; | ||
| 21 | |||
| 22 | // 第三方账号 | ||
| 23 | private String account; | ||
| 24 | |||
| 25 | // app账号id | ||
| 26 | private Long userAppId; | ||
| 27 | |||
| 28 | // 绑定状态 0:解绑;1 绑定 | ||
| 29 | private Integer status; | ||
| 30 | |||
| 31 | // 昵称 | ||
| 32 | private String nickname; | ||
| 33 | |||
| 34 | // 创建时间 | ||
| 35 | private Timestamp createTime; | ||
| 36 | |||
| 37 | // 更新时间 | ||
| 38 | private Timestamp updateTime; | ||
| 39 | } |
| 1 | package com.topdraw.business.module.user.app.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import javax.persistence.Transient; | ||
| 6 | import java.io.Serializable; | ||
| 7 | import java.sql.Timestamp; | ||
| 8 | |||
| 9 | |||
| 10 | /** | ||
| 11 | * @author XiangHan | ||
| 12 | * @date 2022-06-27 | ||
| 13 | */ | ||
| 14 | @Data | ||
| 15 | public class UserAppDTO implements Serializable { | ||
| 16 | |||
| 17 | // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号 | ||
| 18 | private Integer accountType; | ||
| 19 | |||
| 20 | // 第三方账号 | ||
| 21 | private String account; | ||
| 22 | |||
| 23 | // ID | ||
| 24 | private Long id; | ||
| 25 | |||
| 26 | // 会员id | ||
| 27 | private Long memberId; | ||
| 28 | |||
| 29 | // 用户名(一般为手机号) | ||
| 30 | private String username; | ||
| 31 | |||
| 32 | // 密码 | ||
| 33 | private String password; | ||
| 34 | |||
| 35 | // 类型 0:苹果;1:安卓;-1:未知 | ||
| 36 | private Integer type; | ||
| 37 | |||
| 38 | // 状态 0:禁用;1:生效;-1:注销 | ||
| 39 | private Integer status; | ||
| 40 | |||
| 41 | // 昵称 | ||
| 42 | private String nickname; | ||
| 43 | |||
| 44 | // 头像地址 | ||
| 45 | private String headimgurl; | ||
| 46 | |||
| 47 | // 邮箱 | ||
| 48 | private String email; | ||
| 49 | |||
| 50 | // 手机号 | ||
| 51 | private String cellphone; | ||
| 52 | |||
| 53 | // 性别 0:女;1:男;-1:其他 | ||
| 54 | private Integer gender; | ||
| 55 | |||
| 56 | // 生日 | ||
| 57 | private String birthday; | ||
| 58 | |||
| 59 | // 最近活跃时间 | ||
| 60 | private Timestamp lastActiveTime; | ||
| 61 | |||
| 62 | // 注销时间 | ||
| 63 | private Timestamp deleteTime; | ||
| 64 | |||
| 65 | // 标签 | ||
| 66 | private String tags; | ||
| 67 | |||
| 68 | // 描述 | ||
| 69 | private String description; | ||
| 70 | |||
| 71 | // 创建时间 | ||
| 72 | private Timestamp createTime; | ||
| 73 | |||
| 74 | // 更新时间 | ||
| 75 | private Timestamp updateTime; | ||
| 76 | } |
| 1 | package com.topdraw.business.module.user.app.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import java.io.Serializable; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-06-27 | ||
| 10 | */ | ||
| 11 | @Data | ||
| 12 | public class UserAppSimpleDTO implements Serializable { | ||
| 13 | |||
| 14 | // ID | ||
| 15 | private Long id; | ||
| 16 | |||
| 17 | // 会员id | ||
| 18 | private Long memberId; | ||
| 19 | |||
| 20 | // 用户名(一般为手机号) | ||
| 21 | private String username; | ||
| 22 | |||
| 23 | // 状态 0:禁用;1:生效;-1:注销 | ||
| 24 | private Integer status; | ||
| 25 | |||
| 26 | // 昵称 | ||
| 27 | private String nickname; | ||
| 28 | |||
| 29 | // 头像地址 | ||
| 30 | private String headimgurl; | ||
| 31 | |||
| 32 | // 邮箱 | ||
| 33 | private String email; | ||
| 34 | |||
| 35 | // 手机号 | ||
| 36 | private String cellphone; | ||
| 37 | |||
| 38 | // 性别 0:女;1:男;-1:其他 | ||
| 39 | private Integer gender; | ||
| 40 | |||
| 41 | // 生日 | ||
| 42 | private String birthday; | ||
| 43 | |||
| 44 | // 标签 | ||
| 45 | private String tags; | ||
| 46 | |||
| 47 | // 描述 | ||
| 48 | private String description; | ||
| 49 | |||
| 50 | } |
src/main/java/com/topdraw/business/module/user/app/service/impl/UserAppBindServiceImpl.java
0 → 100644
| 1 | package com.topdraw.business.module.user.app.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.app.domain.UserAppBind; | ||
| 4 | import com.topdraw.business.module.user.app.repository.UserAppBindRepository; | ||
| 5 | import com.topdraw.business.module.user.app.service.UserAppBindService; | ||
| 6 | import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; | ||
| 7 | import com.topdraw.business.module.user.app.service.mapper.UserAppBindMapper; | ||
| 8 | import com.topdraw.utils.ValidationUtil; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 11 | import org.springframework.stereotype.Service; | ||
| 12 | import org.springframework.transaction.annotation.Propagation; | ||
| 13 | import org.springframework.transaction.annotation.Transactional; | ||
| 14 | import org.springframework.util.Assert; | ||
| 15 | |||
| 16 | import java.util.List; | ||
| 17 | |||
| 18 | /** | ||
| 19 | * @author XiangHan | ||
| 20 | * @date 2022-06-27 | ||
| 21 | */ | ||
| 22 | @Service | ||
| 23 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 24 | public class UserAppBindServiceImpl implements UserAppBindService { | ||
| 25 | |||
| 26 | @Autowired | ||
| 27 | private UserAppBindRepository userAppBindRepository; | ||
| 28 | |||
| 29 | @Autowired | ||
| 30 | private UserAppBindMapper userAppBindMapper; | ||
| 31 | |||
| 32 | @Override | ||
| 33 | public UserAppBindDTO findById(Long id) { | ||
| 34 | UserAppBind userAppBind = this.userAppBindRepository.findById(id).orElseGet(UserAppBind::new); | ||
| 35 | ValidationUtil.isNull(userAppBind.getId(),"UserAppBind","id",id); | ||
| 36 | return this.userAppBindMapper.toDto(userAppBind); | ||
| 37 | } | ||
| 38 | |||
| 39 | @Override | ||
| 40 | @Transactional(rollbackFor = Exception.class) | ||
| 41 | public UserAppBindDTO create(UserAppBind resources) { | ||
| 42 | UserAppBind userAppBind = this.userAppBindRepository.save(resources); | ||
| 43 | return this.userAppBindMapper.toDto(userAppBind); | ||
| 44 | } | ||
| 45 | |||
| 46 | @Override | ||
| 47 | @Transactional(rollbackFor = Exception.class) | ||
| 48 | public void update(UserAppBind resources) { | ||
| 49 | UserAppBind userAppBind = this.userAppBindRepository.findById(resources.getId()).orElseGet(UserAppBind::new); | ||
| 50 | ValidationUtil.isNull( userAppBind.getId(),"UserAppBind","id",resources.getId()); | ||
| 51 | userAppBind.copy(resources); | ||
| 52 | this.userAppBindRepository.save(userAppBind); | ||
| 53 | } | ||
| 54 | |||
| 55 | @Override | ||
| 56 | @Transactional(rollbackFor = Exception.class) | ||
| 57 | public void delete(Long id) { | ||
| 58 | Assert.notNull(id, "The given id must not be null!"); | ||
| 59 | UserAppBind UserAppBind = this.userAppBindRepository.findById(id).orElseThrow( | ||
| 60 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.user.app.domain.UserAppBind.class, id), 1)); | ||
| 61 | this.userAppBindRepository.delete(UserAppBind); | ||
| 62 | } | ||
| 63 | |||
| 64 | @Override | ||
| 65 | public UserAppBindDTO findFirstByAccount(String account) { | ||
| 66 | UserAppBind userAppBind = this.userAppBindRepository.findFirstByAccount(account).orElseGet(UserAppBind::new); | ||
| 67 | return this.userAppBindMapper.toDto(userAppBind); | ||
| 68 | } | ||
| 69 | |||
| 70 | @Override | ||
| 71 | @Transactional(rollbackFor = Exception.class) | ||
| 72 | public boolean cancelUserAppBind(String account, Integer accountType) { | ||
| 73 | return this.userAppBindRepository.cancelUserAppBind(account, accountType) > 0; | ||
| 74 | } | ||
| 75 | |||
| 76 | @Override | ||
| 77 | @Transactional(readOnly = true) | ||
| 78 | public UserAppBindDTO findFirstByAccountAndAccountType(String account, Integer accountType) { | ||
| 79 | UserAppBind userAppBind = this.userAppBindRepository.findFirstByAccountAndAccountType(account, accountType).orElseGet(UserAppBind::new); | ||
| 80 | return this.userAppBindMapper.toDto(userAppBind); | ||
| 81 | } | ||
| 82 | |||
| 83 | @Override | ||
| 84 | @Transactional(rollbackFor = Exception.class) | ||
| 85 | public boolean updateThirdAccount(UserAppBind resources) { | ||
| 86 | return this.userAppBindRepository.updateThirdAccount(resources) > 0; | ||
| 87 | } | ||
| 88 | |||
| 89 | @Override | ||
| 90 | @Transactional(rollbackFor = Exception.class) | ||
| 91 | public boolean updateThirdAccountNickname(UserAppBind resources) { | ||
| 92 | return this.userAppBindRepository.updateThirdAccountNickname(resources) > 0; | ||
| 93 | } | ||
| 94 | |||
| 95 | @Override | ||
| 96 | @Transactional(rollbackFor = Exception.class) | ||
| 97 | public boolean updateValidStatusAndUserAppIdAndNickname(UserAppBind resources) { | ||
| 98 | return this.userAppBindRepository.updateValidStatusAndUserAppIdAndNickname(resources) > 0; | ||
| 99 | } | ||
| 100 | |||
| 101 | @Override | ||
| 102 | @Transactional(rollbackFor = Exception.class) | ||
| 103 | public boolean appCancellation(List<Long> ids) { | ||
| 104 | return this.userAppBindRepository.appCancellation(ids) > 0; | ||
| 105 | } | ||
| 106 | |||
| 107 | @Override | ||
| 108 | @Transactional(readOnly = true) | ||
| 109 | public List<UserAppBindDTO> findByUserAppId(Long id) { | ||
| 110 | List<UserAppBind> userAppBinds = this.userAppBindRepository.findByUserAppId(id); | ||
| 111 | return this.userAppBindMapper.toDto(userAppBinds); | ||
| 112 | } | ||
| 113 | |||
| 114 | |||
| 115 | } |
| 1 | package com.topdraw.business.module.user.app.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.member.domain.Member; | ||
| 4 | import com.topdraw.business.module.member.domain.MemberBuilder; | ||
| 5 | import com.topdraw.business.module.member.domain.MemberTypeConstant; | ||
| 6 | import com.topdraw.business.module.member.service.MemberService; | ||
| 7 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 8 | import com.topdraw.business.module.user.app.domain.UserApp; | ||
| 9 | import com.topdraw.business.module.user.app.domain.UserAppBind; | ||
| 10 | import com.topdraw.business.module.user.app.domain.UserAppIdManual; | ||
| 11 | import com.topdraw.business.module.user.app.repository.UserAppRepository; | ||
| 12 | import com.topdraw.business.module.user.app.repository.UserAppSimpleRepository; | ||
| 13 | import com.topdraw.business.module.user.app.service.UserAppService; | ||
| 14 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | ||
| 15 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 16 | import com.topdraw.business.module.user.app.service.mapper.UserAppMapper; | ||
| 17 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
| 18 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
| 19 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
| 20 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
| 21 | import com.topdraw.utils.ValidationUtil; | ||
| 22 | import lombok.extern.slf4j.Slf4j; | ||
| 23 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 24 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 25 | import org.springframework.stereotype.Service; | ||
| 26 | import org.springframework.transaction.annotation.Propagation; | ||
| 27 | import org.springframework.transaction.annotation.Transactional; | ||
| 28 | import org.springframework.util.Assert; | ||
| 29 | |||
| 30 | import java.util.Objects; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * @author XiangHan | ||
| 34 | * @date 2022-06-27 | ||
| 35 | */ | ||
| 36 | @Service | ||
| 37 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 38 | @Slf4j | ||
| 39 | public class UserAppServiceImpl implements UserAppService { | ||
| 40 | |||
| 41 | @Autowired | ||
| 42 | private UserAppRepository userAppRepository; | ||
| 43 | @Autowired | ||
| 44 | private UserAppSimpleRepository userAppSimpleRepository; | ||
| 45 | @Autowired | ||
| 46 | private UserAppMapper userAppMapper; | ||
| 47 | @Autowired | ||
| 48 | private MemberService memberService; | ||
| 49 | |||
| 50 | |||
| 51 | @Override | ||
| 52 | @Transactional(readOnly = true) | ||
| 53 | public UserAppDTO findById(Long id) { | ||
| 54 | UserApp userApp = this.userAppRepository.findById(id).orElseGet(UserApp::new); | ||
| 55 | ValidationUtil.isNull(userApp.getId(),"UserApp","id",id); | ||
| 56 | return this.userAppMapper.toDto(userApp); | ||
| 57 | } | ||
| 58 | |||
| 59 | @Override | ||
| 60 | @Transactional(readOnly = true) | ||
| 61 | public UserAppDTO findByUsername(String username) { | ||
| 62 | UserApp userApp = this.userAppRepository.findByUsername(username).orElseGet(UserApp::new); | ||
| 63 | return this.userAppMapper.toDto(userApp); | ||
| 64 | } | ||
| 65 | |||
| 66 | @Override | ||
| 67 | @Transactional(rollbackFor = Exception.class) | ||
| 68 | public UserAppDTO create(UserApp resources) { | ||
| 69 | UserApp userApp = this.userAppRepository.save(resources); | ||
| 70 | return this.userAppMapper.toDto(userApp); | ||
| 71 | } | ||
| 72 | |||
| 73 | @Override | ||
| 74 | @Transactional(rollbackFor = Exception.class) | ||
| 75 | public UserAppDTO update(UserApp resources) { | ||
| 76 | UserApp userApp = this.userAppRepository.findById(resources.getId()).orElseGet(UserApp::new); | ||
| 77 | ValidationUtil.isNull( userApp.getId(),"UserApp","id",resources.getId()); | ||
| 78 | userApp.copy(resources); | ||
| 79 | UserApp _userApp = this.userAppRepository.save(userApp); | ||
| 80 | if (Objects.nonNull(_userApp.getId())) { | ||
| 81 | return this.userAppMapper.toDto(_userApp); | ||
| 82 | } | ||
| 83 | |||
| 84 | return this.userAppMapper.toDto(resources); | ||
| 85 | } | ||
| 86 | |||
| 87 | @Override | ||
| 88 | @Transactional(rollbackFor = Exception.class) | ||
| 89 | public void delete(Long id) { | ||
| 90 | Assert.notNull(id, "The given id must not be null!"); | ||
| 91 | UserApp UserApp = this.userAppRepository.findById(id).orElseThrow( | ||
| 92 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", UserApp.class, id), 1)); | ||
| 93 | this.userAppRepository.delete(UserApp); | ||
| 94 | } | ||
| 95 | |||
| 96 | @Override | ||
| 97 | @Transactional(rollbackFor = Exception.class) | ||
| 98 | public boolean updateLastActiveTime(UserAppBind resources) { | ||
| 99 | return this.userAppRepository.updateLastActiveTime(resources.getUsername()) > 0; | ||
| 100 | } | ||
| 101 | |||
| 102 | @Override | ||
| 103 | @Transactional(rollbackFor = Exception.class) | ||
| 104 | public boolean updatePasswordByUsername(UserApp resources) { | ||
| 105 | return this.userAppRepository.updatePasswordByUsername(resources.getUsername(), resources.getPassword()) > 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | @Override | ||
| 109 | @Transactional(rollbackFor = Exception.class) | ||
| 110 | public boolean updateAppInfo(UserApp resources) { | ||
| 111 | |||
| 112 | Long id = resources.getId(); | ||
| 113 | UserApp userApp = this.userAppRepository.findById(id).orElseGet(UserApp::new); | ||
| 114 | if (Objects.isNull(userApp.getId())) { | ||
| 115 | log.error("修改app信息失败,app账号信息不存在[updateAppInfo#]"); | ||
| 116 | return false; | ||
| 117 | } | ||
| 118 | |||
| 119 | userApp.copy(resources); | ||
| 120 | |||
| 121 | this.userAppRepository.updateAppInfo(userApp); | ||
| 122 | |||
| 123 | return true; | ||
| 124 | } | ||
| 125 | |||
| 126 | @Override | ||
| 127 | @Transactional(rollbackFor = Exception.class) | ||
| 128 | public boolean appCancellation(Long id) { | ||
| 129 | return this.userAppRepository.appCancellation(id) > 0; | ||
| 130 | } | ||
| 131 | |||
| 132 | @Override | ||
| 133 | @Transactional(rollbackFor = Exception.class) | ||
| 134 | public boolean updateAppLastActiveTimeAndNicknameAndHeadImg(UserApp resources) { | ||
| 135 | return this.userAppRepository.updateAppLastActiveTimeAndNicknameAndHeadImg(resources.getUsername(), | ||
| 136 | resources.getNickname(), resources.getHeadimgurl()) > 0; | ||
| 137 | } | ||
| 138 | |||
| 139 | @Transactional(rollbackFor = Exception.class) | ||
| 140 | public void asyncUpdateAppLastActiveTimeAndNicknameAndHeadImgById(UserApp resources) { | ||
| 141 | this.userAppRepository.updateAppLastActiveTimeAndNicknameAndHeadImgById(resources); | ||
| 142 | } | ||
| 143 | |||
| 144 | @Override | ||
| 145 | @Transactional(rollbackFor = Exception.class) | ||
| 146 | public boolean asyncSaveByIdManual(UserAppIdManual resources) { | ||
| 147 | String memberCode = resources.getMemberCode(); | ||
| 148 | |||
| 149 | Member member = new Member(); | ||
| 150 | member.setVip(0); | ||
| 151 | member.setType(MemberTypeConstant.app); | ||
| 152 | member.setCode(memberCode); | ||
| 153 | member.setNickname(resources.getNickname()); | ||
| 154 | member.setAvatarUrl(resources.getHeadimgurl()); | ||
| 155 | Member _member = MemberBuilder.build(member); | ||
| 156 | MemberDTO memberDTO = memberService.create(_member); | ||
| 157 | |||
| 158 | resources.setMemberId(memberDTO.getId()); | ||
| 159 | |||
| 160 | this.userAppRepository.saveByIdManual(resources); | ||
| 161 | return true; | ||
| 162 | } | ||
| 163 | |||
| 164 | @Override | ||
| 165 | @Transactional(rollbackFor = Exception.class) | ||
| 166 | public boolean updatePasswordById(UserApp resources) { | ||
| 167 | return this.userAppRepository.updatePasswordById(resources.getId(), resources.getPassword()) > 0; | ||
| 168 | } | ||
| 169 | |||
| 170 | |||
| 171 | } |
| 1 | package com.topdraw.business.module.user.app.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.user.app.domain.UserAppBind; | ||
| 5 | import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-06-27 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface UserAppBindMapper extends BaseMapper<UserAppBindDTO, UserAppBind> { | ||
| 15 | |||
| 16 | } |
| 1 | package com.topdraw.business.module.user.app.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.user.app.domain.UserApp; | ||
| 5 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-06-27 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface UserAppMapper extends BaseMapper<UserAppDTO, UserApp> { | ||
| 15 | |||
| 16 | } |
src/main/java/com/topdraw/business/module/user/app/service/mapper/UserAppSimpleMapper.java
0 → 100644
| 1 | package com.topdraw.business.module.user.app.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.user.app.domain.UserAppSimple; | ||
| 5 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-06-27 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface UserAppSimpleMapper extends BaseMapper<UserAppSimpleDTO, UserAppSimple> { | ||
| 15 | |||
| 16 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.annotation.CreatedDate; | ||
| 8 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 10 | |||
| 11 | import javax.persistence.*; | ||
| 12 | import java.io.Serializable; | ||
| 13 | import java.sql.Timestamp; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-07-07 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="uc_growth_report") | ||
| 24 | public class GrowthReport implements Serializable { | ||
| 25 | |||
| 26 | @Id | ||
| 27 | @Column(name = "id") | ||
| 28 | private Long id; | ||
| 29 | |||
| 30 | // 用户id | ||
| 31 | @Column(name = "user_id") | ||
| 32 | private Long userId; | ||
| 33 | |||
| 34 | // 会员id | ||
| 35 | @Column(name = "member_id") | ||
| 36 | private Long memberId; | ||
| 37 | |||
| 38 | // 会员code | ||
| 39 | @Column(name = "member_code") | ||
| 40 | private String memberCode; | ||
| 41 | |||
| 42 | // 大屏账号 | ||
| 43 | @Column(name = "platform_account") | ||
| 44 | private String platformAccount; | ||
| 45 | |||
| 46 | // 开始日期 | ||
| 47 | @Column(name = "start_date") | ||
| 48 | private String startDate; | ||
| 49 | |||
| 50 | // 结束时间 | ||
| 51 | @Column(name = "end_date") | ||
| 52 | private String endDate; | ||
| 53 | |||
| 54 | // 栏目播放时长数据 | ||
| 55 | @Column(name = "data") | ||
| 56 | private String data; | ||
| 57 | |||
| 58 | // 创建时间 | ||
| 59 | @CreatedDate | ||
| 60 | @Column(name = "create_time") | ||
| 61 | private Timestamp createTime; | ||
| 62 | |||
| 63 | // 修改时间 | ||
| 64 | @LastModifiedDate | ||
| 65 | @Column(name = "update_time") | ||
| 66 | private Timestamp updateTime; | ||
| 67 | |||
| 68 | public void copy(GrowthReport source){ | ||
| 69 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 70 | } | ||
| 71 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | import org.springframework.data.jpa.repository.Modifying; | ||
| 7 | import org.springframework.data.jpa.repository.Query; | ||
| 8 | |||
| 9 | import java.util.Optional; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * @author XiangHan | ||
| 13 | * @date 2022-07-07 | ||
| 14 | */ | ||
| 15 | public interface GrowthReportRepository extends JpaRepository<GrowthReport, Long>, JpaSpecificationExecutor<GrowthReport> { | ||
| 16 | |||
| 17 | Optional<GrowthReport> findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String startDate, String endDate); | ||
| 18 | |||
| 19 | @Modifying | ||
| 20 | @Query(value = "UPDATE `uc_growth_report` SET `data` = ?2, `update_time` = now() WHERE `id` =?1", nativeQuery = true) | ||
| 21 | Integer updateGrowthReportData(Long id, String data); | ||
| 22 | } |
src/main/java/com/topdraw/business/module/user/iptv/growreport/service/GrowthReportService.java
0 → 100644
| 1 | package com.topdraw.business.module.user.iptv.growreport.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 4 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * @author XiangHan | ||
| 8 | * @date 2022-07-07 | ||
| 9 | */ | ||
| 10 | public interface GrowthReportService { | ||
| 11 | |||
| 12 | /** | ||
| 13 | * 根据ID查询 | ||
| 14 | * @param id ID | ||
| 15 | * @return GrowthReportDTO | ||
| 16 | */ | ||
| 17 | GrowthReportDTO findById(Long id); | ||
| 18 | |||
| 19 | void create(GrowthReport resources); | ||
| 20 | |||
| 21 | void update(GrowthReport resources); | ||
| 22 | |||
| 23 | void delete(Long id); | ||
| 24 | |||
| 25 | GrowthReportDTO findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String weekFirstDay, String weekLastDay); | ||
| 26 | |||
| 27 | Integer updateGrowthReportData(Long id, String data); | ||
| 28 | } |
src/main/java/com/topdraw/business/module/user/iptv/growreport/service/dto/GrowthReportDTO.java
0 → 100644
| 1 | package com.topdraw.business.module.user.iptv.growreport.service.dto; | ||
| 2 | |||
| 3 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
| 4 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
| 5 | import lombok.Data; | ||
| 6 | |||
| 7 | import java.io.Serializable; | ||
| 8 | import java.sql.Timestamp; | ||
| 9 | |||
| 10 | |||
| 11 | /** | ||
| 12 | * @author XiangHan | ||
| 13 | * @date 2022-07-07 | ||
| 14 | */ | ||
| 15 | @Data | ||
| 16 | public class GrowthReportDTO implements Serializable { | ||
| 17 | |||
| 18 | // 处理精度丢失问题 | ||
| 19 | @JsonSerialize(using= ToStringSerializer.class) | ||
| 20 | private Long id; | ||
| 21 | |||
| 22 | // 用户id | ||
| 23 | private Long userId; | ||
| 24 | |||
| 25 | // 会员id | ||
| 26 | private Long memberId; | ||
| 27 | |||
| 28 | // 会员code | ||
| 29 | private String memberCode; | ||
| 30 | |||
| 31 | // 大屏账号 | ||
| 32 | private String platformAccount; | ||
| 33 | |||
| 34 | // 开始日期 | ||
| 35 | private String startDate; | ||
| 36 | |||
| 37 | // 结束时间 | ||
| 38 | private String endDate; | ||
| 39 | |||
| 40 | // 栏目播放时长数据 | ||
| 41 | private String data; | ||
| 42 | |||
| 43 | // 创建时间 | ||
| 44 | private Timestamp createTime; | ||
| 45 | |||
| 46 | // 修改时间 | ||
| 47 | private Timestamp updateTime; | ||
| 48 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.service.impl; | ||
| 2 | |||
| 3 | import cn.hutool.core.lang.Snowflake; | ||
| 4 | import cn.hutool.core.util.IdUtil; | ||
| 5 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 6 | import com.topdraw.business.module.user.iptv.growreport.repository.GrowthReportRepository; | ||
| 7 | import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService; | ||
| 8 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
| 9 | import com.topdraw.business.module.user.iptv.growreport.service.mapper.GrowthReportMapper; | ||
| 10 | import com.topdraw.utils.ValidationUtil; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 13 | import org.springframework.stereotype.Service; | ||
| 14 | import org.springframework.transaction.annotation.Propagation; | ||
| 15 | import org.springframework.transaction.annotation.Transactional; | ||
| 16 | import org.springframework.util.Assert; | ||
| 17 | |||
| 18 | /** | ||
| 19 | * @author XiangHan | ||
| 20 | * @date 2022-07-07 | ||
| 21 | */ | ||
| 22 | @Service | ||
| 23 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 24 | public class GrowthReportServiceImpl implements GrowthReportService { | ||
| 25 | |||
| 26 | @Autowired | ||
| 27 | private GrowthReportRepository growthReportRepository; | ||
| 28 | |||
| 29 | @Autowired | ||
| 30 | private GrowthReportMapper growthReportMapper; | ||
| 31 | |||
| 32 | @Override | ||
| 33 | public GrowthReportDTO findById(Long id) { | ||
| 34 | GrowthReport growthReport = this.growthReportRepository.findById(id).orElseGet(GrowthReport::new); | ||
| 35 | ValidationUtil.isNull(growthReport.getId(),"GrowthReport","id",id); | ||
| 36 | return this.growthReportMapper.toDto(growthReport); | ||
| 37 | } | ||
| 38 | |||
| 39 | @Override | ||
| 40 | @Transactional(rollbackFor = Exception.class) | ||
| 41 | public void create(GrowthReport resources) { | ||
| 42 | Snowflake snowflake = IdUtil.createSnowflake(1, 1); | ||
| 43 | resources.setId(snowflake.nextId()); | ||
| 44 | this.growthReportRepository.save(resources); | ||
| 45 | } | ||
| 46 | |||
| 47 | @Override | ||
| 48 | @Transactional(rollbackFor = Exception.class) | ||
| 49 | public void update(GrowthReport resources) { | ||
| 50 | GrowthReport growthReport = this.growthReportRepository.findById(resources.getId()).orElseGet(GrowthReport::new); | ||
| 51 | ValidationUtil.isNull( growthReport.getId(),"GrowthReport","id",resources.getId()); | ||
| 52 | growthReport.copy(resources); | ||
| 53 | this.growthReportRepository.save(growthReport); | ||
| 54 | } | ||
| 55 | |||
| 56 | @Override | ||
| 57 | @Transactional(rollbackFor = Exception.class) | ||
| 58 | public void delete(Long id) { | ||
| 59 | Assert.notNull(id, "The given id must not be null!"); | ||
| 60 | GrowthReport growthReport = this.growthReportRepository.findById(id).orElseThrow( | ||
| 61 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", GrowthReport.class, id), 1)); | ||
| 62 | this.growthReportRepository.delete(growthReport); | ||
| 63 | } | ||
| 64 | |||
| 65 | @Override | ||
| 66 | public GrowthReportDTO findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String weekFirstDay, String weekLastDay) { | ||
| 67 | GrowthReport growthReport = this.growthReportRepository.findByPlatformAccountAndStartDateAndEndDate(platformAccount, weekFirstDay, weekLastDay).orElseGet(GrowthReport::new); | ||
| 68 | return this.growthReportMapper.toDto(growthReport); | ||
| 69 | } | ||
| 70 | |||
| 71 | @Override | ||
| 72 | @Transactional(rollbackFor = Exception.class) | ||
| 73 | public Integer updateGrowthReportData(Long id, String data) { | ||
| 74 | return this.growthReportRepository.updateGrowthReportData(id, data); | ||
| 75 | } | ||
| 76 | |||
| 77 | |||
| 78 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 5 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-07 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface GrowthReportMapper extends BaseMapper<GrowthReportDTO, GrowthReport> { | ||
| 15 | |||
| 16 | } |
| ... | @@ -3,7 +3,11 @@ package com.topdraw.business.module.user.iptv.repository; | ... | @@ -3,7 +3,11 @@ 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; | ||
| 8 | import org.springframework.data.repository.query.Param; | ||
| 6 | 9 | ||
| 10 | import java.time.LocalDateTime; | ||
| 7 | import java.util.Optional; | 11 | import java.util.Optional; |
| 8 | 12 | ||
| 9 | /** | 13 | /** |
| ... | @@ -18,4 +22,45 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif | ... | @@ -18,4 +22,45 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif |
| 18 | 22 | ||
| 19 | Optional<UserTv> findByMemberId(Long memberId); | 23 | Optional<UserTv> findByMemberId(Long memberId); |
| 20 | 24 | ||
| 25 | @Modifying | ||
| 26 | @Query(value = "UPDATE `uc_user_tv` SET `vis_user_id` = ?2, `update_time` = ?3 WHERE `id` = ?1", nativeQuery = true) | ||
| 27 | Integer updateUserTvVisUserId(Long id, Long visUserId, LocalDateTime now); | ||
| 28 | |||
| 29 | |||
| 30 | @Modifying | ||
| 31 | @Query(value = "UPDATE `uc_user_tv` SET `member_id` = ?2, `update_time` = now() WHERE `platform_account` = ?1", nativeQuery = true) | ||
| 32 | void updateMemberId(String platformAccount, Long memberId); | ||
| 33 | |||
| 34 | @Modifying | ||
| 35 | @Query(value = "UPDATE `uc_user_tv` SET `priority_member_code` = ?2, `update_time` = now() WHERE `platform_account` = ?1", nativeQuery = true) | ||
| 36 | void updatePriorityMemberCode(String platformAccount, String priorityMemberCode); | ||
| 37 | |||
| 38 | @Modifying | ||
| 39 | @Query(value = "UPDATE `uc_user_tv` SET " + | ||
| 40 | " `cellphone` = :#{#resources.cellphone}, " + | ||
| 41 | " `username` = :#{#resources.username}, " + | ||
| 42 | " `nickname` = :#{#resources.nickname}, " + | ||
| 43 | " `image` = :#{#resources.image}, " + | ||
| 44 | " `platform` = :#{#resources.platform}, " + | ||
| 45 | " `login_days` = :#{#resources.loginDays}, " + | ||
| 46 | " `continue_days` = :#{#resources.continueDays}, " + | ||
| 47 | " `active_time` = :#{#resources.activeTime}, " + | ||
| 48 | " `groups` = :#{#resources.groups}, " + | ||
| 49 | " `tags` = :#{#resources.tags}, " + | ||
| 50 | " `login_type` = :#{#resources.loginType}, " + | ||
| 51 | " `status` = :#{#resources.status}, " + | ||
| 52 | " `description` = :#{#resources.description}, " + | ||
| 53 | " `create_by` = :#{#resources.createBy}, " + | ||
| 54 | " `update_by` = :#{#resources.updateBy}, " + | ||
| 55 | " `priority_member_code` = :#{#resources.priorityMemberCode}, " + | ||
| 56 | " `vis_user_id` = :#{#resources.visUserId}, " + | ||
| 57 | " `update_time` = now() WHERE `platform_account` = :#{#resources.platformAccount}", nativeQuery = true) | ||
| 58 | void updateUserTvByPlatformAccount(@Param("resources") UserTv userTv); | ||
| 59 | |||
| 60 | Long countByPlatformAccount(String platformAccount); | ||
| 61 | |||
| 62 | @Modifying | ||
| 63 | @Query(value = "UPDATE `uc_user_tv` SET `priority_member_code` = :#{#resources.priorityMemberCode}, " + | ||
| 64 | "`update_time` = now() WHERE `platform_account` = :#{#resources.platformAccount}", nativeQuery = true) | ||
| 65 | void updatePriorityMemberCode(@Param("resources") UserTv userTv); | ||
| 21 | } | 66 | } | ... | ... |
| ... | @@ -80,4 +80,45 @@ public interface UserTvService { | ... | @@ -80,4 +80,45 @@ 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 | |||
| 91 | |||
| 92 | /** | ||
| 93 | * | ||
| 94 | * @param platformAccount | ||
| 95 | * @param id | ||
| 96 | */ | ||
| 97 | void updateMemberId(String platformAccount, Long id); | ||
| 98 | |||
| 99 | /** | ||
| 100 | * | ||
| 101 | * @param platformAccount | ||
| 102 | * @param priorityMemberCode | ||
| 103 | */ | ||
| 104 | void updatePriorityMemberCode(String platformAccount, String priorityMemberCode); | ||
| 105 | |||
| 106 | /** | ||
| 107 | * | ||
| 108 | * @param userTv | ||
| 109 | */ | ||
| 110 | void updateUserTvByPlatformAccount(UserTv userTv); | ||
| 111 | |||
| 112 | /** | ||
| 113 | * | ||
| 114 | * @param platformAccount | ||
| 115 | * @return | ||
| 116 | */ | ||
| 117 | Long countByPlatformAccount(String platformAccount); | ||
| 118 | |||
| 119 | /** | ||
| 120 | * | ||
| 121 | * @param userTv | ||
| 122 | */ | ||
| 123 | void doUpdatePriorityMemberCode(UserTv userTv); | ||
| 83 | } | 124 | } | ... | ... |
| ... | @@ -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 | ||
| ... | @@ -39,6 +44,36 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -39,6 +44,36 @@ public class UserTvServiceImpl implements UserTvService { |
| 39 | @Autowired | 44 | @Autowired |
| 40 | private UserTvRepository userTvRepository; | 45 | private UserTvRepository userTvRepository; |
| 41 | 46 | ||
| 47 | @Override | ||
| 48 | @Transactional(rollbackFor = Exception.class) | ||
| 49 | public void updateMemberId(String platformAccount, Long memberId) { | ||
| 50 | this.userTvRepository.updateMemberId(platformAccount, memberId); | ||
| 51 | } | ||
| 52 | |||
| 53 | @Override | ||
| 54 | @Transactional(rollbackFor = Exception.class) | ||
| 55 | public void updatePriorityMemberCode(String platformAccount, String priorityMemberCode) { | ||
| 56 | this.userTvRepository.updatePriorityMemberCode(platformAccount, priorityMemberCode); | ||
| 57 | } | ||
| 58 | |||
| 59 | @Override | ||
| 60 | @Transactional(rollbackFor = Exception.class) | ||
| 61 | public void updateUserTvByPlatformAccount(UserTv userTv) { | ||
| 62 | this.userTvRepository.updateUserTvByPlatformAccount(userTv); | ||
| 63 | } | ||
| 64 | |||
| 65 | @Override | ||
| 66 | public Long countByPlatformAccount(String platformAccount) { | ||
| 67 | return this.userTvRepository.countByPlatformAccount(platformAccount); | ||
| 68 | } | ||
| 69 | |||
| 70 | @Override | ||
| 71 | @Transactional(rollbackFor = Exception.class) | ||
| 72 | public void doUpdatePriorityMemberCode(UserTv userTv) { | ||
| 73 | this.userTvRepository.updatePriorityMemberCode(userTv); | ||
| 74 | } | ||
| 75 | |||
| 76 | |||
| 42 | /** | 77 | /** |
| 43 | * 获取大屏账户对应的会员 | 78 | * 获取大屏账户对应的会员 |
| 44 | * <Waring> | 79 | * <Waring> |
| ... | @@ -66,6 +101,34 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -66,6 +101,34 @@ public class UserTvServiceImpl implements UserTvService { |
| 66 | throw new EntityNotFoundException(UserTvDTO.class,"platformAccount", GlobeExceptionMsg.IPTV_IS_NULL); | 101 | throw new EntityNotFoundException(UserTvDTO.class,"platformAccount", GlobeExceptionMsg.IPTV_IS_NULL); |
| 67 | } | 102 | } |
| 68 | 103 | ||
| 104 | @Override | ||
| 105 | @Transactional(rollbackFor = Exception.class) | ||
| 106 | public UserTvDTO asyncUpdateUserTvVisUserId(UserTv resources) { | ||
| 107 | log.info("UserTvServiceImpl ==> updateUserTvVisUserId ==>> param ==> {}",resources); | ||
| 108 | |||
| 109 | if (StringUtils.isBlank(resources.getPlatformAccount())){ | ||
| 110 | throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL); | ||
| 111 | } | ||
| 112 | |||
| 113 | if (Objects.isNull(resources.getVisUserId())){ | ||
| 114 | throw new BadRequestException(GlobeExceptionMsg.VIS_USER_ID_IS_NULL); | ||
| 115 | } | ||
| 116 | |||
| 117 | UserTvDTO userTvDTO = this.findByPlatformAccount(resources.getPlatformAccount()); | ||
| 118 | |||
| 119 | if (Objects.nonNull(userTvDTO.getId())) { | ||
| 120 | |||
| 121 | this.userTvRepository.updateUserTvVisUserId(userTvDTO.getId(), resources.getVisUserId(), LocalDateTime.now()); | ||
| 122 | |||
| 123 | } else { | ||
| 124 | |||
| 125 | log.error("修改大屏账号vis_user_id字段异常,请检查"); | ||
| 126 | |||
| 127 | } | ||
| 128 | |||
| 129 | return null; | ||
| 130 | } | ||
| 131 | |||
| 69 | private MemberDTO findMemberByMemberCode(String memberCode) { | 132 | private MemberDTO findMemberByMemberCode(String memberCode) { |
| 70 | return this.memberService.findByCode(memberCode); | 133 | return this.memberService.findByCode(memberCode); |
| 71 | } | 134 | } |
| ... | @@ -121,13 +184,6 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -121,13 +184,6 @@ public class UserTvServiceImpl implements UserTvService { |
| 121 | @Override | 184 | @Override |
| 122 | @Transactional(rollbackFor = Exception.class) | 185 | @Transactional(rollbackFor = Exception.class) |
| 123 | public void unbindPriorityMemberCode(UserTv resources) { | 186 | public void unbindPriorityMemberCode(UserTv resources) { |
| 124 | String platformAccount = resources.getPlatformAccount(); | ||
| 125 | if (StringUtils.isNotBlank(platformAccount)) { | ||
| 126 | UserTvDTO userTvDTO = this.findByPlatformAccount(platformAccount); | ||
| 127 | Long id = userTvDTO.getId(); | ||
| 128 | resources.setId(id); | ||
| 129 | resources.setMemberId(userTvDTO.getMemberId()); | ||
| 130 | } | ||
| 131 | this.userTvRepository.save(resources); | 187 | this.userTvRepository.save(resources); |
| 132 | } | 188 | } |
| 133 | 189 | ... | ... |
| ... | @@ -45,7 +45,7 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -45,7 +45,7 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
| 45 | @Transactional(rollbackFor = Exception.class) | 45 | @Transactional(rollbackFor = Exception.class) |
| 46 | public UserWeixin create(UserWeixin resources) { | 46 | public UserWeixin create(UserWeixin resources) { |
| 47 | MemberDTO memberDTO = memberService.findByCode(resources.getMemberCode()); | 47 | MemberDTO memberDTO = memberService.findByCode(resources.getMemberCode()); |
| 48 | if (Objects.nonNull(memberDTO)) { | 48 | if (Objects.nonNull(memberDTO.getId())) { |
| 49 | Long id = memberDTO.getId(); | 49 | Long id = memberDTO.getId(); |
| 50 | resources.setMemberId(id); | 50 | resources.setMemberId(id); |
| 51 | } | 51 | } | ... | ... |
| 1 | package com.topdraw.business.module.vis.hainan.app.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.annotation.CreatedDate; | ||
| 8 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 10 | |||
| 11 | import javax.persistence.*; | ||
| 12 | import java.io.Serializable; | ||
| 13 | import java.sql.Timestamp; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-07-14 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="vis_user") | ||
| 24 | public class VisUser implements Serializable { | ||
| 25 | |||
| 26 | // ID | ||
| 27 | @Id | ||
| 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 29 | @Column(name = "id") | ||
| 30 | private Long id; | ||
| 31 | |||
| 32 | // 所有者ID | ||
| 33 | @Column(name = "person_id") | ||
| 34 | private Long personId; | ||
| 35 | |||
| 36 | // 平台 | ||
| 37 | @Column(name = "platform") | ||
| 38 | private String platform; | ||
| 39 | |||
| 40 | // 平台账号 | ||
| 41 | @Column(name = "platform_account") | ||
| 42 | private String platformAccount; | ||
| 43 | |||
| 44 | // 用户名 | ||
| 45 | @Column(name = "username") | ||
| 46 | private String username; | ||
| 47 | |||
| 48 | // 密码 | ||
| 49 | @Column(name = "password") | ||
| 50 | private String password; | ||
| 51 | |||
| 52 | // 积分 | ||
| 53 | @Column(name = "points") | ||
| 54 | private Integer points; | ||
| 55 | |||
| 56 | // 昵称 | ||
| 57 | @Column(name = "nickname") | ||
| 58 | private String nickname; | ||
| 59 | |||
| 60 | // 真实姓名 | ||
| 61 | @Column(name = "realname") | ||
| 62 | private String realname; | ||
| 63 | |||
| 64 | // 头像 | ||
| 65 | @Column(name = "image") | ||
| 66 | private String image; | ||
| 67 | |||
| 68 | // 电子邮件 | ||
| 69 | @Column(name = "email") | ||
| 70 | private String email; | ||
| 71 | |||
| 72 | // 手机号 | ||
| 73 | @Column(name = "cellphone") | ||
| 74 | private String cellphone; | ||
| 75 | |||
| 76 | // 0-女 1-男 2-其他 | ||
| 77 | @Column(name = "gender") | ||
| 78 | private Integer gender; | ||
| 79 | |||
| 80 | // 生日 | ||
| 81 | @Column(name = "birthday") | ||
| 82 | private Integer birthday; | ||
| 83 | |||
| 84 | // 登录天数(总天数) | ||
| 85 | @Column(name = "login_days") | ||
| 86 | private Integer loginDays; | ||
| 87 | |||
| 88 | // 连续天数 | ||
| 89 | @Column(name = "continue_days") | ||
| 90 | private Integer continueDays; | ||
| 91 | |||
| 92 | // 活跃时间 | ||
| 93 | @Column(name = "active_time") | ||
| 94 | private Timestamp activeTime; | ||
| 95 | |||
| 96 | // 标签 | ||
| 97 | @Column(name = "tags") | ||
| 98 | private String tags; | ||
| 99 | |||
| 100 | // 登录类型:1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录 | ||
| 101 | @Column(name = "login_type") | ||
| 102 | private Integer loginType; | ||
| 103 | |||
| 104 | // 用户绑定ID | ||
| 105 | @Column(name = "vis_user_id") | ||
| 106 | private Long visUserId; | ||
| 107 | |||
| 108 | // 微信绑定ID | ||
| 109 | @Column(name = "vis_user_weixin_id") | ||
| 110 | private Long visUserWeixinId; | ||
| 111 | |||
| 112 | // QQ绑定ID | ||
| 113 | @Column(name = "vis_user_qq_id") | ||
| 114 | private Long visUserQqId; | ||
| 115 | |||
| 116 | // 微博绑定ID | ||
| 117 | @Column(name = "vis_user_weibo_id") | ||
| 118 | private Long visUserWeiboId; | ||
| 119 | |||
| 120 | // 苹果绑定ID | ||
| 121 | @Column(name = "vis_user_apple_id") | ||
| 122 | private Long visUserAppleId; | ||
| 123 | |||
| 124 | // 状态:默认1-生效 2-失效 | ||
| 125 | @Column(name = "status") | ||
| 126 | private Integer status; | ||
| 127 | |||
| 128 | // 创建时间 | ||
| 129 | @CreatedDate | ||
| 130 | @Column(name = "create_time") | ||
| 131 | private Timestamp createTime; | ||
| 132 | |||
| 133 | // 更新时间 | ||
| 134 | @LastModifiedDate | ||
| 135 | @Column(name = "update_time") | ||
| 136 | private Timestamp updateTime; | ||
| 137 | |||
| 138 | public void copy(VisUser source){ | ||
| 139 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 140 | } | ||
| 141 | } |
src/main/java/com/topdraw/business/module/vis/hainan/app/repository/VisUserRepository.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.app.repository; | ||
| 2 | |||
| 3 | |||
| 4 | import com.topdraw.business.module.vis.hainan.app.domain.VisUser; | ||
| 5 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 7 | |||
| 8 | /** | ||
| 9 | * @author XiangHan | ||
| 10 | * @date 2022-07-14 | ||
| 11 | */ | ||
| 12 | public interface VisUserRepository extends JpaRepository<VisUser, Long>, JpaSpecificationExecutor<VisUser> { | ||
| 13 | |||
| 14 | } |
| 1 | package com.topdraw.business.module.vis.hainan.app.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.vis.hainan.app.domain.VisUser; | ||
| 4 | import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * @author XiangHan | ||
| 8 | * @date 2022-07-14 | ||
| 9 | */ | ||
| 10 | public interface VisUserService { | ||
| 11 | |||
| 12 | /** | ||
| 13 | * 根据ID查询 | ||
| 14 | * @param id ID | ||
| 15 | * @return UserDTO | ||
| 16 | */ | ||
| 17 | VisUserDTO findById(Long id); | ||
| 18 | |||
| 19 | void create(VisUser resources); | ||
| 20 | |||
| 21 | void update(VisUser resources); | ||
| 22 | |||
| 23 | void delete(Long id); | ||
| 24 | |||
| 25 | } |
| 1 | package com.topdraw.business.module.vis.hainan.app.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import java.io.Serializable; | ||
| 6 | import java.sql.Timestamp; | ||
| 7 | |||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | @Data | ||
| 14 | public class VisUserDTO implements Serializable { | ||
| 15 | |||
| 16 | // ID | ||
| 17 | private Long id; | ||
| 18 | |||
| 19 | // 所有者ID | ||
| 20 | private Long personId; | ||
| 21 | |||
| 22 | // 平台 | ||
| 23 | private String platform; | ||
| 24 | |||
| 25 | // 平台账号 | ||
| 26 | private String platformAccount; | ||
| 27 | |||
| 28 | // 用户名 | ||
| 29 | private String username; | ||
| 30 | |||
| 31 | // 密码 | ||
| 32 | private String password; | ||
| 33 | |||
| 34 | // 积分 | ||
| 35 | private Integer points; | ||
| 36 | |||
| 37 | // 昵称 | ||
| 38 | private String nickname; | ||
| 39 | |||
| 40 | // 真实姓名 | ||
| 41 | private String realname; | ||
| 42 | |||
| 43 | // 头像 | ||
| 44 | private String image; | ||
| 45 | |||
| 46 | // 电子邮件 | ||
| 47 | private String email; | ||
| 48 | |||
| 49 | // 手机号 | ||
| 50 | private String cellphone; | ||
| 51 | |||
| 52 | // 0-女 1-男 2-其他 | ||
| 53 | private Integer gender; | ||
| 54 | |||
| 55 | // 生日 | ||
| 56 | private Integer birthday; | ||
| 57 | |||
| 58 | // 登录天数(总天数) | ||
| 59 | private Integer loginDays; | ||
| 60 | |||
| 61 | // 连续天数 | ||
| 62 | private Integer continueDays; | ||
| 63 | |||
| 64 | // 活跃时间 | ||
| 65 | private Timestamp activeTime; | ||
| 66 | |||
| 67 | // 标签 | ||
| 68 | private String tags; | ||
| 69 | |||
| 70 | // 登录类型:1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录 | ||
| 71 | private Integer loginType; | ||
| 72 | |||
| 73 | // 用户绑定ID | ||
| 74 | private Long visUserId; | ||
| 75 | |||
| 76 | // 微信绑定ID | ||
| 77 | private Long visUserWeixinId; | ||
| 78 | |||
| 79 | // QQ绑定ID | ||
| 80 | private Long visUserQqId; | ||
| 81 | |||
| 82 | // 微博绑定ID | ||
| 83 | private Long visUserWeiboId; | ||
| 84 | |||
| 85 | // 苹果绑定ID | ||
| 86 | private Long visUserAppleId; | ||
| 87 | |||
| 88 | // 状态:默认1-生效 2-失效 | ||
| 89 | private Integer status; | ||
| 90 | |||
| 91 | // 创建时间 | ||
| 92 | private Timestamp createTime; | ||
| 93 | |||
| 94 | // 更新时间 | ||
| 95 | private Timestamp updateTime; | ||
| 96 | } |
src/main/java/com/topdraw/business/module/vis/hainan/app/service/impl/VisUserServiceImpl.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.app.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.vis.hainan.app.domain.VisUser; | ||
| 4 | import com.topdraw.business.module.vis.hainan.app.repository.VisUserRepository; | ||
| 5 | import com.topdraw.business.module.vis.hainan.app.service.VisUserService; | ||
| 6 | import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO; | ||
| 7 | import com.topdraw.business.module.vis.hainan.app.service.mapper.VisUserMapper; | ||
| 8 | import com.topdraw.utils.ValidationUtil; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 11 | import org.springframework.stereotype.Service; | ||
| 12 | import org.springframework.transaction.annotation.Propagation; | ||
| 13 | import org.springframework.transaction.annotation.Transactional; | ||
| 14 | import org.springframework.util.Assert; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @author XiangHan | ||
| 18 | * @date 2022-07-14 | ||
| 19 | */ | ||
| 20 | @Service | ||
| 21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 22 | public class VisUserServiceImpl implements VisUserService { | ||
| 23 | |||
| 24 | @Autowired | ||
| 25 | private VisUserRepository visUserRepository; | ||
| 26 | |||
| 27 | @Autowired | ||
| 28 | private VisUserMapper visUserMapper; | ||
| 29 | |||
| 30 | @Override | ||
| 31 | public VisUserDTO findById(Long id) { | ||
| 32 | VisUser visUser = visUserRepository.findById(id).orElseGet(VisUser::new); | ||
| 33 | ValidationUtil.isNull(visUser.getId(),"User","id",id); | ||
| 34 | return visUserMapper.toDto(visUser); | ||
| 35 | } | ||
| 36 | |||
| 37 | @Override | ||
| 38 | @Transactional(rollbackFor = Exception.class) | ||
| 39 | public void create(VisUser resources) { | ||
| 40 | visUserRepository.save(resources); | ||
| 41 | } | ||
| 42 | |||
| 43 | @Override | ||
| 44 | @Transactional(rollbackFor = Exception.class) | ||
| 45 | public void update(VisUser resources) { | ||
| 46 | VisUser User = visUserRepository.findById(resources.getId()).orElseGet(VisUser::new); | ||
| 47 | ValidationUtil.isNull( User.getId(),"User","id",resources.getId()); | ||
| 48 | User.copy(resources); | ||
| 49 | visUserRepository.save(User); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | @Transactional(rollbackFor = Exception.class) | ||
| 54 | public void delete(Long id) { | ||
| 55 | Assert.notNull(id, "The given id must not be null!"); | ||
| 56 | VisUser User = visUserRepository.findById(id).orElseThrow( | ||
| 57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUser.class, id), 1)); | ||
| 58 | visUserRepository.delete(User); | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | } |
src/main/java/com/topdraw/business/module/vis/hainan/app/service/mapper/VisUserMapper.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.app.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.vis.hainan.app.domain.VisUser; | ||
| 5 | import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface VisUserMapper extends BaseMapper<VisUserDTO, VisUser> { | ||
| 15 | |||
| 16 | } |
| 1 | package com.topdraw.business.module.vis.hainan.apple.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.annotation.CreatedDate; | ||
| 8 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 10 | |||
| 11 | import javax.persistence.*; | ||
| 12 | import java.io.Serializable; | ||
| 13 | import java.sql.Timestamp; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-07-14 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="vis_user_apple") | ||
| 24 | public class VisUserApple implements Serializable { | ||
| 25 | |||
| 26 | |||
| 27 | @Transient | ||
| 28 | private String username; | ||
| 29 | @Transient | ||
| 30 | private Integer type; | ||
| 31 | |||
| 32 | // ID | ||
| 33 | @Id | ||
| 34 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 35 | @Column(name = "id") | ||
| 36 | private Long id; | ||
| 37 | |||
| 38 | // 所有者ID | ||
| 39 | @Column(name = "person_id") | ||
| 40 | private Long personId; | ||
| 41 | |||
| 42 | // 用户ID | ||
| 43 | @Column(name = "vis_user_id") | ||
| 44 | private Long visUserId; | ||
| 45 | |||
| 46 | // 苹果用户ID | ||
| 47 | @Column(name = "user") | ||
| 48 | private String user; | ||
| 49 | |||
| 50 | @Column(name = "identity_token") | ||
| 51 | private String identityToken; | ||
| 52 | |||
| 53 | @Column(name = "real_user_status") | ||
| 54 | private String realUserStatus; | ||
| 55 | |||
| 56 | @Column(name = "authorized_scopes") | ||
| 57 | private String authorizedScopes; | ||
| 58 | |||
| 59 | @Column(name = "authorization_code") | ||
| 60 | private String authorizationCode; | ||
| 61 | |||
| 62 | // 状态 0-失效 1-有效 | ||
| 63 | @Column(name = "status") | ||
| 64 | private Integer status; | ||
| 65 | |||
| 66 | // 全名 | ||
| 67 | @Column(name = "full_name") | ||
| 68 | private String fullName; | ||
| 69 | |||
| 70 | // E-main | ||
| 71 | @Column(name = "email") | ||
| 72 | private String email; | ||
| 73 | |||
| 74 | // 昵称 | ||
| 75 | @Column(name = "nickname") | ||
| 76 | private String nickname; | ||
| 77 | |||
| 78 | // 性别 | ||
| 79 | @Column(name = "sex") | ||
| 80 | private Integer sex; | ||
| 81 | |||
| 82 | // 国家 | ||
| 83 | @Column(name = "country") | ||
| 84 | private String country; | ||
| 85 | |||
| 86 | // 省份 | ||
| 87 | @Column(name = "province") | ||
| 88 | private String province; | ||
| 89 | |||
| 90 | // 城市 | ||
| 91 | @Column(name = "city") | ||
| 92 | private String city; | ||
| 93 | |||
| 94 | // 头像地址 | ||
| 95 | @Column(name = "icon") | ||
| 96 | private String icon; | ||
| 97 | |||
| 98 | // 描述 | ||
| 99 | @Column(name = "description") | ||
| 100 | private String description; | ||
| 101 | |||
| 102 | // 创建时间 | ||
| 103 | @CreatedDate | ||
| 104 | @Column(name = "create_time") | ||
| 105 | private Timestamp createTime; | ||
| 106 | |||
| 107 | // 更新时间 | ||
| 108 | @LastModifiedDate | ||
| 109 | @Column(name = "update_time") | ||
| 110 | private Timestamp updateTime; | ||
| 111 | |||
| 112 | public void copy(VisUserApple source){ | ||
| 113 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 114 | } | ||
| 115 | } |
src/main/java/com/topdraw/business/module/vis/hainan/apple/repository/VisUserAppleRepository.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.apple.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-07-14 | ||
| 10 | */ | ||
| 11 | public interface VisUserAppleRepository extends JpaRepository<VisUserApple, Long>, JpaSpecificationExecutor<VisUserApple> { | ||
| 12 | |||
| 13 | } |
src/main/java/com/topdraw/business/module/vis/hainan/apple/service/VisUserAppleService.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.apple.service; | ||
| 2 | |||
| 3 | |||
| 4 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
| 5 | import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-07-14 | ||
| 10 | */ | ||
| 11 | public interface VisUserAppleService { | ||
| 12 | |||
| 13 | /** | ||
| 14 | * 根据ID查询 | ||
| 15 | * @param id ID | ||
| 16 | * @return VisUserAppleDTO | ||
| 17 | */ | ||
| 18 | VisUserAppleDTO findById(Long id); | ||
| 19 | |||
| 20 | void create(VisUserApple resources); | ||
| 21 | |||
| 22 | void update(VisUserApple resources); | ||
| 23 | |||
| 24 | void delete(Long id); | ||
| 25 | |||
| 26 | } |
src/main/java/com/topdraw/business/module/vis/hainan/apple/service/dto/VisUserAppleDTO.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.apple.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import java.io.Serializable; | ||
| 6 | import java.sql.Timestamp; | ||
| 7 | |||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | @Data | ||
| 14 | public class VisUserAppleDTO implements Serializable { | ||
| 15 | |||
| 16 | // ID | ||
| 17 | private Long id; | ||
| 18 | |||
| 19 | // 所有者ID | ||
| 20 | private Long personId; | ||
| 21 | |||
| 22 | // 用户ID | ||
| 23 | private Long visUserId; | ||
| 24 | |||
| 25 | // 苹果用户ID | ||
| 26 | private String user; | ||
| 27 | |||
| 28 | private String identityToken; | ||
| 29 | |||
| 30 | private String realUserStatus; | ||
| 31 | |||
| 32 | private String authorizedScopes; | ||
| 33 | |||
| 34 | private String authorizationCode; | ||
| 35 | |||
| 36 | // 状态 0-失效 1-有效 | ||
| 37 | private Integer status; | ||
| 38 | |||
| 39 | // 全名 | ||
| 40 | private String fullName; | ||
| 41 | |||
| 42 | // E-main | ||
| 43 | private String email; | ||
| 44 | |||
| 45 | // 昵称 | ||
| 46 | private String nickname; | ||
| 47 | |||
| 48 | // 性别 | ||
| 49 | private Integer sex; | ||
| 50 | |||
| 51 | // 国家 | ||
| 52 | private String country; | ||
| 53 | |||
| 54 | // 省份 | ||
| 55 | private String province; | ||
| 56 | |||
| 57 | // 城市 | ||
| 58 | private String city; | ||
| 59 | |||
| 60 | // 头像地址 | ||
| 61 | private String icon; | ||
| 62 | |||
| 63 | // 描述 | ||
| 64 | private String description; | ||
| 65 | |||
| 66 | // 创建时间 | ||
| 67 | private Timestamp createTime; | ||
| 68 | |||
| 69 | // 更新时间 | ||
| 70 | private Timestamp updateTime; | ||
| 71 | } |
| 1 | package com.topdraw.business.process.domian.weixin; | 1 | package com.topdraw.business.module.vis.hainan.apple.service.dto; |
| 2 | 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | import lombok.Data; | 3 | import lombok.Data; |
| 5 | 4 | ||
| 6 | import java.time.LocalDateTime; | ||
| 7 | |||
| 8 | /** | 5 | /** |
| 9 | * 微信账户信息 | ||
| 10 | * @author XiangHan | 6 | * @author XiangHan |
| 11 | * @date 2021-01-18 | 7 | * @date 2022-07-14 |
| 12 | */ | 8 | */ |
| 13 | @Data | 9 | @Data |
| 14 | public class BuyVipBean extends WeiXinUserBean { | 10 | public class VisUserAppleQueryCriteria{ |
| 15 | |||
| 16 | private Integer vip; | ||
| 17 | |||
| 18 | @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 19 | private LocalDateTime vipExpireTime; | ||
| 20 | |||
| 21 | |||
| 22 | } | 11 | } | ... | ... |
src/main/java/com/topdraw/business/module/vis/hainan/apple/service/impl/VisUserAppleServiceImpl.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.apple.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
| 4 | import com.topdraw.business.module.vis.hainan.apple.repository.VisUserAppleRepository; | ||
| 5 | import com.topdraw.business.module.vis.hainan.apple.service.VisUserAppleService; | ||
| 6 | import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO; | ||
| 7 | import com.topdraw.business.module.vis.hainan.apple.service.mapper.VisUserAppleMapper; | ||
| 8 | import com.topdraw.utils.ValidationUtil; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 11 | import org.springframework.stereotype.Service; | ||
| 12 | import org.springframework.transaction.annotation.Propagation; | ||
| 13 | import org.springframework.transaction.annotation.Transactional; | ||
| 14 | import org.springframework.util.Assert; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @author XiangHan | ||
| 18 | * @date 2022-07-14 | ||
| 19 | */ | ||
| 20 | @Service | ||
| 21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 22 | public class VisUserAppleServiceImpl implements VisUserAppleService { | ||
| 23 | |||
| 24 | @Autowired | ||
| 25 | private VisUserAppleRepository visUserAppleRepository; | ||
| 26 | |||
| 27 | @Autowired | ||
| 28 | private VisUserAppleMapper visUserAppleMapper; | ||
| 29 | |||
| 30 | @Override | ||
| 31 | public VisUserAppleDTO findById(Long id) { | ||
| 32 | VisUserApple visUserApple = visUserAppleRepository.findById(id).orElseGet(VisUserApple::new); | ||
| 33 | ValidationUtil.isNull(visUserApple.getId(),"VisUserApple","id",id); | ||
| 34 | return visUserAppleMapper.toDto(visUserApple); | ||
| 35 | } | ||
| 36 | |||
| 37 | @Override | ||
| 38 | @Transactional(rollbackFor = Exception.class) | ||
| 39 | public void create(VisUserApple resources) { | ||
| 40 | visUserAppleRepository.save(resources); | ||
| 41 | } | ||
| 42 | |||
| 43 | @Override | ||
| 44 | @Transactional(rollbackFor = Exception.class) | ||
| 45 | public void update(VisUserApple resources) { | ||
| 46 | VisUserApple visUserApple = visUserAppleRepository.findById(resources.getId()).orElseGet(VisUserApple::new); | ||
| 47 | ValidationUtil.isNull( visUserApple.getId(),"VisUserApple","id",resources.getId()); | ||
| 48 | visUserApple.copy(resources); | ||
| 49 | visUserAppleRepository.save(visUserApple); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | @Transactional(rollbackFor = Exception.class) | ||
| 54 | public void delete(Long id) { | ||
| 55 | Assert.notNull(id, "The given id must not be null!"); | ||
| 56 | VisUserApple visUserApple = visUserAppleRepository.findById(id).orElseThrow( | ||
| 57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserApple.class, id), 1)); | ||
| 58 | visUserAppleRepository.delete(visUserApple); | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | } |
src/main/java/com/topdraw/business/module/vis/hainan/apple/service/mapper/VisUserAppleMapper.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.apple.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple; | ||
| 5 | import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface VisUserAppleMapper extends BaseMapper<VisUserAppleDTO, VisUserApple> { | ||
| 15 | |||
| 16 | } |
| 1 | package com.topdraw.business.module.vis.hainan.qq.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.annotation.CreatedDate; | ||
| 8 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 10 | |||
| 11 | import javax.persistence.*; | ||
| 12 | import java.io.Serializable; | ||
| 13 | import java.sql.Timestamp; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-07-14 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="vis_user_qq") | ||
| 24 | public class VisUserQq implements Serializable { | ||
| 25 | @Transient | ||
| 26 | private String username; | ||
| 27 | @Transient | ||
| 28 | private Integer type; | ||
| 29 | // ID | ||
| 30 | @Id | ||
| 31 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 32 | @Column(name = "id") | ||
| 33 | private Long id; | ||
| 34 | |||
| 35 | // 所有者ID | ||
| 36 | @Column(name = "person_id") | ||
| 37 | private Long personId; | ||
| 38 | |||
| 39 | // 用户ID | ||
| 40 | @Column(name = "vis_user_id") | ||
| 41 | private Long visUserId; | ||
| 42 | |||
| 43 | // QQunionid,针对开发者 | ||
| 44 | @Column(name = "unionid") | ||
| 45 | private String unionid; | ||
| 46 | |||
| 47 | // QQappid | ||
| 48 | @Column(name = "app_id") | ||
| 49 | private String appId; | ||
| 50 | |||
| 51 | // QQopenid | ||
| 52 | @Column(name = "openid") | ||
| 53 | private String openid; | ||
| 54 | |||
| 55 | // QQuserid | ||
| 56 | @Column(name = "user_id") | ||
| 57 | private String userId; | ||
| 58 | |||
| 59 | // 状态 0-失效 1-有效 | ||
| 60 | @Column(name = "status") | ||
| 61 | private Integer status; | ||
| 62 | |||
| 63 | // 昵称 | ||
| 64 | @Column(name = "nickname") | ||
| 65 | private String nickname; | ||
| 66 | |||
| 67 | // 性别 | ||
| 68 | @Column(name = "sex") | ||
| 69 | private Integer sex; | ||
| 70 | |||
| 71 | // 国家 | ||
| 72 | @Column(name = "country") | ||
| 73 | private String country; | ||
| 74 | |||
| 75 | // 省份 | ||
| 76 | @Column(name = "province") | ||
| 77 | private String province; | ||
| 78 | |||
| 79 | // 城市 | ||
| 80 | @Column(name = "city") | ||
| 81 | private String city; | ||
| 82 | |||
| 83 | // 头像地址 | ||
| 84 | @Column(name = "icon") | ||
| 85 | private String icon; | ||
| 86 | |||
| 87 | @Column(name = "pay_token") | ||
| 88 | private String payToken; | ||
| 89 | |||
| 90 | @Column(name = "secretType") | ||
| 91 | private String secretType; | ||
| 92 | |||
| 93 | @Column(name = "secret") | ||
| 94 | private String secret; | ||
| 95 | |||
| 96 | @Column(name = "pfkey") | ||
| 97 | private String pfkey; | ||
| 98 | |||
| 99 | @Column(name = "pf") | ||
| 100 | private String pf; | ||
| 101 | |||
| 102 | // access_token | ||
| 103 | @Column(name = "access_token") | ||
| 104 | private String accessToken; | ||
| 105 | |||
| 106 | // expires_in | ||
| 107 | @Column(name = "expires_in") | ||
| 108 | private Integer expiresIn; | ||
| 109 | |||
| 110 | // expires_time | ||
| 111 | @Column(name = "expires_time") | ||
| 112 | private Timestamp expiresTime; | ||
| 113 | |||
| 114 | // 描述 | ||
| 115 | @Column(name = "description") | ||
| 116 | private String description; | ||
| 117 | |||
| 118 | // 创建时间 | ||
| 119 | @CreatedDate | ||
| 120 | @Column(name = "create_time") | ||
| 121 | private Timestamp createTime; | ||
| 122 | |||
| 123 | // 更新时间 | ||
| 124 | @LastModifiedDate | ||
| 125 | @Column(name = "update_time") | ||
| 126 | private Timestamp updateTime; | ||
| 127 | |||
| 128 | public void copy(VisUserQq source){ | ||
| 129 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 130 | } | ||
| 131 | } |
src/main/java/com/topdraw/business/module/vis/hainan/qq/repository/VisUserQqRepository.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.qq.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-07-14 | ||
| 10 | */ | ||
| 11 | public interface VisUserQqRepository extends JpaRepository<VisUserQq, Long>, JpaSpecificationExecutor<VisUserQq> { | ||
| 12 | |||
| 13 | } |
| 1 | package com.topdraw.business.module.vis.hainan.qq.service; | ||
| 2 | |||
| 3 | |||
| 4 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
| 5 | import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-07-14 | ||
| 10 | */ | ||
| 11 | public interface VisUserQqService { | ||
| 12 | |||
| 13 | /** | ||
| 14 | * 根据ID查询 | ||
| 15 | * @param id ID | ||
| 16 | * @return VisUserQqDTO | ||
| 17 | */ | ||
| 18 | VisUserQqDTO findById(Long id); | ||
| 19 | |||
| 20 | void create(VisUserQq resources); | ||
| 21 | |||
| 22 | void update(VisUserQq resources); | ||
| 23 | |||
| 24 | void delete(Long id); | ||
| 25 | |||
| 26 | VisUserQqDTO findByOpenid(String account); | ||
| 27 | } |
| 1 | package com.topdraw.business.module.vis.hainan.qq.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import java.io.Serializable; | ||
| 6 | import java.sql.Timestamp; | ||
| 7 | |||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | @Data | ||
| 14 | public class VisUserQqDTO implements Serializable { | ||
| 15 | |||
| 16 | // ID | ||
| 17 | private Long id; | ||
| 18 | |||
| 19 | // 所有者ID | ||
| 20 | private Long personId; | ||
| 21 | |||
| 22 | // 用户ID | ||
| 23 | private Long visUserId; | ||
| 24 | |||
| 25 | // QQunionid,针对开发者 | ||
| 26 | private String unionid; | ||
| 27 | |||
| 28 | // QQappid | ||
| 29 | private String appId; | ||
| 30 | |||
| 31 | // QQopenid | ||
| 32 | private String openid; | ||
| 33 | |||
| 34 | // QQuserid | ||
| 35 | private String userId; | ||
| 36 | |||
| 37 | // 状态 0-失效 1-有效 | ||
| 38 | private Integer status; | ||
| 39 | |||
| 40 | // 昵称 | ||
| 41 | private String nickname; | ||
| 42 | |||
| 43 | // 性别 | ||
| 44 | private Integer sex; | ||
| 45 | |||
| 46 | // 国家 | ||
| 47 | private String country; | ||
| 48 | |||
| 49 | // 省份 | ||
| 50 | private String province; | ||
| 51 | |||
| 52 | // 城市 | ||
| 53 | private String city; | ||
| 54 | |||
| 55 | // 头像地址 | ||
| 56 | private String icon; | ||
| 57 | |||
| 58 | private String payToken; | ||
| 59 | |||
| 60 | private String secretType; | ||
| 61 | |||
| 62 | private String secret; | ||
| 63 | |||
| 64 | private String pfkey; | ||
| 65 | |||
| 66 | private String pf; | ||
| 67 | |||
| 68 | // access_token | ||
| 69 | private String accessToken; | ||
| 70 | |||
| 71 | // expires_in | ||
| 72 | private Integer expiresIn; | ||
| 73 | |||
| 74 | // expires_time | ||
| 75 | private Timestamp expiresTime; | ||
| 76 | |||
| 77 | // 描述 | ||
| 78 | private String description; | ||
| 79 | |||
| 80 | // 创建时间 | ||
| 81 | private Timestamp createTime; | ||
| 82 | |||
| 83 | // 更新时间 | ||
| 84 | private Timestamp updateTime; | ||
| 85 | } |
src/main/java/com/topdraw/business/module/vis/hainan/qq/service/impl/VisUserQqServiceImpl.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.qq.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
| 4 | import com.topdraw.business.module.vis.hainan.qq.repository.VisUserQqRepository; | ||
| 5 | import com.topdraw.business.module.vis.hainan.qq.service.VisUserQqService; | ||
| 6 | import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO; | ||
| 7 | import com.topdraw.business.module.vis.hainan.qq.service.mapper.VisUserQqMapper; | ||
| 8 | import com.topdraw.utils.ValidationUtil; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 11 | import org.springframework.stereotype.Service; | ||
| 12 | import org.springframework.transaction.annotation.Propagation; | ||
| 13 | import org.springframework.transaction.annotation.Transactional; | ||
| 14 | import org.springframework.util.Assert; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @author XiangHan | ||
| 18 | * @date 2022-07-14 | ||
| 19 | */ | ||
| 20 | @Service | ||
| 21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 22 | public class VisUserQqServiceImpl implements VisUserQqService { | ||
| 23 | |||
| 24 | @Autowired | ||
| 25 | private VisUserQqRepository visUserQqRepository; | ||
| 26 | |||
| 27 | @Autowired | ||
| 28 | private VisUserQqMapper visUserQqMapper; | ||
| 29 | |||
| 30 | @Override | ||
| 31 | public VisUserQqDTO findById(Long id) { | ||
| 32 | VisUserQq visUserQq = visUserQqRepository.findById(id).orElseGet(VisUserQq::new); | ||
| 33 | ValidationUtil.isNull(visUserQq.getId(),"VisUserQq","id",id); | ||
| 34 | return visUserQqMapper.toDto(visUserQq); | ||
| 35 | } | ||
| 36 | |||
| 37 | @Override | ||
| 38 | @Transactional(rollbackFor = Exception.class) | ||
| 39 | public void create(VisUserQq resources) { | ||
| 40 | visUserQqRepository.save(resources); | ||
| 41 | } | ||
| 42 | |||
| 43 | @Override | ||
| 44 | @Transactional(rollbackFor = Exception.class) | ||
| 45 | public void update(VisUserQq resources) { | ||
| 46 | VisUserQq visUserQq = visUserQqRepository.findById(resources.getId()).orElseGet(VisUserQq::new); | ||
| 47 | ValidationUtil.isNull( visUserQq.getId(),"VisUserQq","id",resources.getId()); | ||
| 48 | visUserQq.copy(resources); | ||
| 49 | visUserQqRepository.save(visUserQq); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | @Transactional(rollbackFor = Exception.class) | ||
| 54 | public void delete(Long id) { | ||
| 55 | Assert.notNull(id, "The given id must not be null!"); | ||
| 56 | VisUserQq visUserQq = visUserQqRepository.findById(id).orElseThrow( | ||
| 57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserQq.class, id), 1)); | ||
| 58 | visUserQqRepository.delete(visUserQq); | ||
| 59 | } | ||
| 60 | |||
| 61 | @Override | ||
| 62 | public VisUserQqDTO findByOpenid(String account) { | ||
| 63 | return null; | ||
| 64 | } | ||
| 65 | |||
| 66 | |||
| 67 | } |
src/main/java/com/topdraw/business/module/vis/hainan/qq/service/mapper/VisUserQqMapper.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.qq.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq; | ||
| 5 | import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface VisUserQqMapper extends BaseMapper<VisUserQqDTO, VisUserQq> { | ||
| 15 | |||
| 16 | } |
| 1 | package com.topdraw.business.module.vis.hainan.weibo.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.annotation.CreatedDate; | ||
| 8 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 10 | |||
| 11 | import javax.persistence.*; | ||
| 12 | import java.io.Serializable; | ||
| 13 | import java.sql.Timestamp; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-07-14 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="vis_user_weibo") | ||
| 24 | public class VisUserWeibo implements Serializable { | ||
| 25 | @Transient | ||
| 26 | private String username; | ||
| 27 | @Transient | ||
| 28 | private Integer type; | ||
| 29 | // ID | ||
| 30 | @Id | ||
| 31 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 32 | @Column(name = "id") | ||
| 33 | private Long id; | ||
| 34 | |||
| 35 | // 所有者ID | ||
| 36 | @Column(name = "person_id") | ||
| 37 | private Long personId; | ||
| 38 | |||
| 39 | // 用户ID | ||
| 40 | @Column(name = "vis_user_id") | ||
| 41 | private Long visUserId; | ||
| 42 | |||
| 43 | // 微博appid | ||
| 44 | @Column(name = "app_id") | ||
| 45 | private String appId; | ||
| 46 | |||
| 47 | // 微博用户ID | ||
| 48 | @Column(name = "user_id") | ||
| 49 | private String userId; | ||
| 50 | |||
| 51 | // 状态 0-失效 1-有效 | ||
| 52 | @Column(name = "status") | ||
| 53 | private Integer status; | ||
| 54 | |||
| 55 | // 昵称 | ||
| 56 | @Column(name = "nickname") | ||
| 57 | private String nickname; | ||
| 58 | |||
| 59 | // 性别 | ||
| 60 | @Column(name = "sex") | ||
| 61 | private Integer sex; | ||
| 62 | |||
| 63 | // 国家 | ||
| 64 | @Column(name = "country") | ||
| 65 | private String country; | ||
| 66 | |||
| 67 | // 省份 | ||
| 68 | @Column(name = "province") | ||
| 69 | private String province; | ||
| 70 | |||
| 71 | // 城市 | ||
| 72 | @Column(name = "city") | ||
| 73 | private String city; | ||
| 74 | |||
| 75 | // 头像地址 | ||
| 76 | @Column(name = "icon") | ||
| 77 | private String icon; | ||
| 78 | |||
| 79 | // secretType | ||
| 80 | @Column(name = "secretType") | ||
| 81 | private String secretType; | ||
| 82 | |||
| 83 | // secret | ||
| 84 | @Column(name = "secret") | ||
| 85 | private String secret; | ||
| 86 | |||
| 87 | // snsregat | ||
| 88 | @Column(name = "snsregat") | ||
| 89 | private String snsregat; | ||
| 90 | |||
| 91 | // snsUserUrl | ||
| 92 | @Column(name = "snsUserUrl") | ||
| 93 | private String snsUserUrl; | ||
| 94 | |||
| 95 | // shareCount | ||
| 96 | @Column(name = "shareCount") | ||
| 97 | private String shareCount; | ||
| 98 | |||
| 99 | // followerCount | ||
| 100 | @Column(name = "followerCount") | ||
| 101 | private String followerCount; | ||
| 102 | |||
| 103 | // refresh_token | ||
| 104 | @Column(name = "refresh_token") | ||
| 105 | private String refreshToken; | ||
| 106 | |||
| 107 | // access_token | ||
| 108 | @Column(name = "access_token") | ||
| 109 | private String accessToken; | ||
| 110 | |||
| 111 | // expires_in | ||
| 112 | @Column(name = "expires_in") | ||
| 113 | private Long expiresIn; | ||
| 114 | |||
| 115 | // expires_time | ||
| 116 | @Column(name = "expires_time") | ||
| 117 | private Timestamp expiresTime; | ||
| 118 | |||
| 119 | // 描述 | ||
| 120 | @Column(name = "description") | ||
| 121 | private String description; | ||
| 122 | |||
| 123 | // 创建时间 | ||
| 124 | @CreatedDate | ||
| 125 | @Column(name = "create_time") | ||
| 126 | private Timestamp createTime; | ||
| 127 | |||
| 128 | // 更新时间 | ||
| 129 | @LastModifiedDate | ||
| 130 | @Column(name = "update_time") | ||
| 131 | private Timestamp updateTime; | ||
| 132 | |||
| 133 | public void copy(VisUserWeibo source){ | ||
| 134 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 135 | } | ||
| 136 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weibo/repository/VisUserWeiboRepository.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.weibo.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-07-14 | ||
| 10 | */ | ||
| 11 | public interface VisUserWeiboRepository extends JpaRepository<VisUserWeibo, Long>, JpaSpecificationExecutor<VisUserWeibo> { | ||
| 12 | |||
| 13 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weibo/service/VisUserWeiboService.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.weibo.service; | ||
| 2 | |||
| 3 | |||
| 4 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
| 5 | import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-07-14 | ||
| 10 | */ | ||
| 11 | public interface VisUserWeiboService { | ||
| 12 | |||
| 13 | /** | ||
| 14 | * 根据ID查询 | ||
| 15 | * @param id ID | ||
| 16 | * @return VisUserWeiboDTO | ||
| 17 | */ | ||
| 18 | VisUserWeiboDTO findById(Long id); | ||
| 19 | |||
| 20 | void create(VisUserWeibo resources); | ||
| 21 | |||
| 22 | void update(VisUserWeibo resources); | ||
| 23 | |||
| 24 | void delete(Long id); | ||
| 25 | |||
| 26 | VisUserWeiboDTO findByUserid(String account); | ||
| 27 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weibo/service/dto/VisUserWeiboDTO.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.weibo.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import java.io.Serializable; | ||
| 6 | import java.sql.Timestamp; | ||
| 7 | |||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | @Data | ||
| 14 | public class VisUserWeiboDTO implements Serializable { | ||
| 15 | |||
| 16 | // ID | ||
| 17 | private Long id; | ||
| 18 | |||
| 19 | // 所有者ID | ||
| 20 | private Long personId; | ||
| 21 | |||
| 22 | // 用户ID | ||
| 23 | private Long visUserId; | ||
| 24 | |||
| 25 | // 微博appid | ||
| 26 | private String appId; | ||
| 27 | |||
| 28 | // 微博用户ID | ||
| 29 | private String userId; | ||
| 30 | |||
| 31 | // 状态 0-失效 1-有效 | ||
| 32 | private Integer status; | ||
| 33 | |||
| 34 | // 昵称 | ||
| 35 | private String nickname; | ||
| 36 | |||
| 37 | // 性别 | ||
| 38 | private Integer sex; | ||
| 39 | |||
| 40 | // 国家 | ||
| 41 | private String country; | ||
| 42 | |||
| 43 | // 省份 | ||
| 44 | private String province; | ||
| 45 | |||
| 46 | // 城市 | ||
| 47 | private String city; | ||
| 48 | |||
| 49 | // 头像地址 | ||
| 50 | private String icon; | ||
| 51 | |||
| 52 | // secretType | ||
| 53 | private String secretType; | ||
| 54 | |||
| 55 | // secret | ||
| 56 | private String secret; | ||
| 57 | |||
| 58 | // snsregat | ||
| 59 | private String snsregat; | ||
| 60 | |||
| 61 | // snsUserUrl | ||
| 62 | private String snsUserUrl; | ||
| 63 | |||
| 64 | // shareCount | ||
| 65 | private String shareCount; | ||
| 66 | |||
| 67 | // followerCount | ||
| 68 | private String followerCount; | ||
| 69 | |||
| 70 | // refresh_token | ||
| 71 | private String refreshToken; | ||
| 72 | |||
| 73 | // access_token | ||
| 74 | private String accessToken; | ||
| 75 | |||
| 76 | // expires_in | ||
| 77 | private Long expiresIn; | ||
| 78 | |||
| 79 | // expires_time | ||
| 80 | private Timestamp expiresTime; | ||
| 81 | |||
| 82 | // 描述 | ||
| 83 | private String description; | ||
| 84 | |||
| 85 | // 创建时间 | ||
| 86 | private Timestamp createTime; | ||
| 87 | |||
| 88 | // 更新时间 | ||
| 89 | private Timestamp updateTime; | ||
| 90 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weibo/service/impl/VisUserWeiboServiceImpl.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.weibo.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
| 4 | import com.topdraw.business.module.vis.hainan.weibo.repository.VisUserWeiboRepository; | ||
| 5 | import com.topdraw.business.module.vis.hainan.weibo.service.VisUserWeiboService; | ||
| 6 | import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO; | ||
| 7 | import com.topdraw.business.module.vis.hainan.weibo.service.mapper.VisUserWeiboMapper; | ||
| 8 | import com.topdraw.utils.ValidationUtil; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 11 | import org.springframework.stereotype.Service; | ||
| 12 | import org.springframework.transaction.annotation.Propagation; | ||
| 13 | import org.springframework.transaction.annotation.Transactional; | ||
| 14 | import org.springframework.util.Assert; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @author XiangHan | ||
| 18 | * @date 2022-07-14 | ||
| 19 | */ | ||
| 20 | @Service | ||
| 21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 22 | public class VisUserWeiboServiceImpl implements VisUserWeiboService { | ||
| 23 | |||
| 24 | @Autowired | ||
| 25 | private VisUserWeiboRepository visUserWeiboRepository; | ||
| 26 | |||
| 27 | @Autowired | ||
| 28 | private VisUserWeiboMapper visUserWeiboMapper; | ||
| 29 | |||
| 30 | @Override | ||
| 31 | public VisUserWeiboDTO findById(Long id) { | ||
| 32 | VisUserWeibo visUserWeibo = visUserWeiboRepository.findById(id).orElseGet(VisUserWeibo::new); | ||
| 33 | ValidationUtil.isNull(visUserWeibo.getId(),"VisUserWeibo","id",id); | ||
| 34 | return visUserWeiboMapper.toDto(visUserWeibo); | ||
| 35 | } | ||
| 36 | |||
| 37 | @Override | ||
| 38 | @Transactional(rollbackFor = Exception.class) | ||
| 39 | public void create(VisUserWeibo resources) { | ||
| 40 | visUserWeiboRepository.save(resources); | ||
| 41 | } | ||
| 42 | |||
| 43 | @Override | ||
| 44 | @Transactional(rollbackFor = Exception.class) | ||
| 45 | public void update(VisUserWeibo resources) { | ||
| 46 | VisUserWeibo visUserWeibo = visUserWeiboRepository.findById(resources.getId()).orElseGet(VisUserWeibo::new); | ||
| 47 | ValidationUtil.isNull( visUserWeibo.getId(),"VisUserWeibo","id",resources.getId()); | ||
| 48 | visUserWeibo.copy(resources); | ||
| 49 | visUserWeiboRepository.save(visUserWeibo); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | @Transactional(rollbackFor = Exception.class) | ||
| 54 | public void delete(Long id) { | ||
| 55 | Assert.notNull(id, "The given id must not be null!"); | ||
| 56 | VisUserWeibo visUserWeibo = visUserWeiboRepository.findById(id).orElseThrow( | ||
| 57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserWeibo.class, id), 1)); | ||
| 58 | visUserWeiboRepository.delete(visUserWeibo); | ||
| 59 | } | ||
| 60 | |||
| 61 | @Override | ||
| 62 | public VisUserWeiboDTO findByUserid(String account) { | ||
| 63 | return null; | ||
| 64 | } | ||
| 65 | |||
| 66 | |||
| 67 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weibo/service/mapper/VisUserWeiboMapper.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.weibo.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo; | ||
| 5 | import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface VisUserWeiboMapper extends BaseMapper<VisUserWeiboDTO, VisUserWeibo> { | ||
| 15 | |||
| 16 | } |
| 1 | package com.topdraw.business.module.vis.hainan.weixin.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.experimental.Accessors; | ||
| 7 | import org.springframework.data.annotation.CreatedDate; | ||
| 8 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 10 | |||
| 11 | import javax.persistence.*; | ||
| 12 | import java.io.Serializable; | ||
| 13 | import java.sql.Timestamp; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-07-14 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="vis_user_weixin") | ||
| 24 | public class VisUserWeixin implements Serializable { | ||
| 25 | |||
| 26 | |||
| 27 | @Transient | ||
| 28 | private String username; | ||
| 29 | @Transient | ||
| 30 | private Integer type; | ||
| 31 | |||
| 32 | // ID | ||
| 33 | @Id | ||
| 34 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 35 | @Column(name = "id") | ||
| 36 | private Long id; | ||
| 37 | |||
| 38 | // 所有者ID | ||
| 39 | @Column(name = "person_id") | ||
| 40 | private Long personId; | ||
| 41 | |||
| 42 | // 用户ID | ||
| 43 | @Column(name = "vis_user_id") | ||
| 44 | private Long visUserId; | ||
| 45 | |||
| 46 | // 微信unionid,针对开发者 | ||
| 47 | @Column(name = "unionid") | ||
| 48 | private String unionid; | ||
| 49 | |||
| 50 | // 微信appid | ||
| 51 | @Column(name = "appid") | ||
| 52 | private String appid; | ||
| 53 | |||
| 54 | // 微信appid | ||
| 55 | @Column(name = "app_id") | ||
| 56 | private String appId; | ||
| 57 | |||
| 58 | // 微信openid,针对微信app | ||
| 59 | @Column(name = "openid") | ||
| 60 | private String openid; | ||
| 61 | |||
| 62 | // 状态 0-失效 1-有效 | ||
| 63 | @Column(name = "status") | ||
| 64 | private Integer status; | ||
| 65 | |||
| 66 | // 昵称 | ||
| 67 | @Column(name = "nickname") | ||
| 68 | private String nickname; | ||
| 69 | |||
| 70 | // 性别 | ||
| 71 | @Column(name = "sex") | ||
| 72 | private Integer sex; | ||
| 73 | |||
| 74 | // 国家 | ||
| 75 | @Column(name = "country") | ||
| 76 | private String country; | ||
| 77 | |||
| 78 | // 省份 | ||
| 79 | @Column(name = "province") | ||
| 80 | private String province; | ||
| 81 | |||
| 82 | // 城市 | ||
| 83 | @Column(name = "city") | ||
| 84 | private String city; | ||
| 85 | |||
| 86 | // 头像地址 | ||
| 87 | @Column(name = "headimgurl") | ||
| 88 | private String headimgurl; | ||
| 89 | |||
| 90 | // 特权信息 | ||
| 91 | @Column(name = "privilege") | ||
| 92 | private String privilege; | ||
| 93 | |||
| 94 | // refresh_token | ||
| 95 | @Column(name = "refresh_token") | ||
| 96 | private String refreshToken; | ||
| 97 | |||
| 98 | // access_token | ||
| 99 | @Column(name = "access_token") | ||
| 100 | private String accessToken; | ||
| 101 | |||
| 102 | // expires_in | ||
| 103 | @Column(name = "expires_in") | ||
| 104 | private Integer expiresIn; | ||
| 105 | |||
| 106 | // expires_time | ||
| 107 | @Column(name = "expires_time") | ||
| 108 | private Timestamp expiresTime; | ||
| 109 | |||
| 110 | // 描述 | ||
| 111 | @Column(name = "description") | ||
| 112 | private String description; | ||
| 113 | |||
| 114 | // 创建时间 | ||
| 115 | @CreatedDate | ||
| 116 | @Column(name = "create_time") | ||
| 117 | private Timestamp createTime; | ||
| 118 | |||
| 119 | // 更新时间 | ||
| 120 | @LastModifiedDate | ||
| 121 | @Column(name = "update_time") | ||
| 122 | private Timestamp updateTime; | ||
| 123 | |||
| 124 | public void copy(VisUserWeixin source){ | ||
| 125 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 126 | } | ||
| 127 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weixin/repository/VisUserWeixinRepository.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.weixin.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | |||
| 7 | import java.util.Optional; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | public interface VisUserWeixinRepository extends JpaRepository<VisUserWeixin, Long>, JpaSpecificationExecutor<VisUserWeixin> { | ||
| 14 | |||
| 15 | |||
| 16 | Optional<VisUserWeixin> findByOpenid(String account); | ||
| 17 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weixin/service/VisUserWeixinService.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.weixin.service; | ||
| 2 | |||
| 3 | |||
| 4 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
| 5 | import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-07-14 | ||
| 10 | */ | ||
| 11 | public interface VisUserWeixinService { | ||
| 12 | |||
| 13 | /** | ||
| 14 | * 根据ID查询 | ||
| 15 | * @param id ID | ||
| 16 | * @return VisUserWeixinDTO | ||
| 17 | */ | ||
| 18 | VisUserWeixinDTO findById(Long id); | ||
| 19 | |||
| 20 | void create(VisUserWeixin resources); | ||
| 21 | |||
| 22 | void update(VisUserWeixin resources); | ||
| 23 | |||
| 24 | void delete(Long id); | ||
| 25 | |||
| 26 | VisUserWeixinDTO findByOpenid(String account); | ||
| 27 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weixin/service/dto/VisUserWeixinDTO.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.weixin.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import java.io.Serializable; | ||
| 6 | import java.sql.Timestamp; | ||
| 7 | |||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | @Data | ||
| 14 | public class VisUserWeixinDTO implements Serializable { | ||
| 15 | |||
| 16 | |||
| 17 | // ID | ||
| 18 | private Long id; | ||
| 19 | |||
| 20 | // 所有者ID | ||
| 21 | private Long personId; | ||
| 22 | |||
| 23 | // 用户ID | ||
| 24 | private Long visUserId; | ||
| 25 | |||
| 26 | // 微信unionid,针对开发者 | ||
| 27 | private String unionid; | ||
| 28 | |||
| 29 | // 微信appid | ||
| 30 | private String appid; | ||
| 31 | |||
| 32 | // 微信appid | ||
| 33 | private String appId; | ||
| 34 | |||
| 35 | // 微信openid,针对微信app | ||
| 36 | private String openid; | ||
| 37 | |||
| 38 | // 状态 0-失效 1-有效 | ||
| 39 | private Integer status; | ||
| 40 | |||
| 41 | // 昵称 | ||
| 42 | private String nickname; | ||
| 43 | |||
| 44 | // 性别 | ||
| 45 | private Integer sex; | ||
| 46 | |||
| 47 | // 国家 | ||
| 48 | private String country; | ||
| 49 | |||
| 50 | // 省份 | ||
| 51 | private String province; | ||
| 52 | |||
| 53 | // 城市 | ||
| 54 | private String city; | ||
| 55 | |||
| 56 | // 头像地址 | ||
| 57 | private String headimgurl; | ||
| 58 | |||
| 59 | // 特权信息 | ||
| 60 | private String privilege; | ||
| 61 | |||
| 62 | // refresh_token | ||
| 63 | private String refreshToken; | ||
| 64 | |||
| 65 | // access_token | ||
| 66 | private String accessToken; | ||
| 67 | |||
| 68 | // expires_in | ||
| 69 | private Integer expiresIn; | ||
| 70 | |||
| 71 | // expires_time | ||
| 72 | private Timestamp expiresTime; | ||
| 73 | |||
| 74 | // 描述 | ||
| 75 | private String description; | ||
| 76 | |||
| 77 | // 创建时间 | ||
| 78 | private Timestamp createTime; | ||
| 79 | |||
| 80 | // 更新时间 | ||
| 81 | private Timestamp updateTime; | ||
| 82 | } |
| 1 | package com.topdraw.business.module.vis.hainan.weixin.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
| 4 | import com.topdraw.business.module.vis.hainan.weixin.repository.VisUserWeixinRepository; | ||
| 5 | import com.topdraw.business.module.vis.hainan.weixin.service.VisUserWeixinService; | ||
| 6 | import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO; | ||
| 7 | import com.topdraw.business.module.vis.hainan.weixin.service.mapper.VisUserWeixinMapper; | ||
| 8 | import com.topdraw.utils.ValidationUtil; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 11 | import org.springframework.stereotype.Service; | ||
| 12 | import org.springframework.transaction.annotation.Propagation; | ||
| 13 | import org.springframework.transaction.annotation.Transactional; | ||
| 14 | import org.springframework.util.Assert; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @author XiangHan | ||
| 18 | * @date 2022-07-14 | ||
| 19 | */ | ||
| 20 | @Service | ||
| 21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 22 | public class VisUserWeixinServiceImpl implements VisUserWeixinService { | ||
| 23 | |||
| 24 | @Autowired | ||
| 25 | private VisUserWeixinRepository visUserWeixinRepository; | ||
| 26 | |||
| 27 | @Autowired | ||
| 28 | private VisUserWeixinMapper visUserWeixinMapper; | ||
| 29 | |||
| 30 | @Override | ||
| 31 | public VisUserWeixinDTO findById(Long id) { | ||
| 32 | VisUserWeixin visUserWeixin = visUserWeixinRepository.findById(id).orElseGet(VisUserWeixin::new); | ||
| 33 | ValidationUtil.isNull(visUserWeixin.getId(),"VisUserWeixin","id",id); | ||
| 34 | return visUserWeixinMapper.toDto(visUserWeixin); | ||
| 35 | } | ||
| 36 | |||
| 37 | @Override | ||
| 38 | @Transactional(rollbackFor = Exception.class) | ||
| 39 | public void create(VisUserWeixin resources) { | ||
| 40 | visUserWeixinRepository.save(resources); | ||
| 41 | } | ||
| 42 | |||
| 43 | @Override | ||
| 44 | @Transactional(rollbackFor = Exception.class) | ||
| 45 | public void update(VisUserWeixin resources) { | ||
| 46 | VisUserWeixin visUserWeixin = visUserWeixinRepository.findById(resources.getId()).orElseGet(VisUserWeixin::new); | ||
| 47 | ValidationUtil.isNull( visUserWeixin.getId(),"VisUserWeixin","id",resources.getId()); | ||
| 48 | visUserWeixin.copy(resources); | ||
| 49 | visUserWeixinRepository.save(visUserWeixin); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | @Transactional(rollbackFor = Exception.class) | ||
| 54 | public void delete(Long id) { | ||
| 55 | Assert.notNull(id, "The given id must not be null!"); | ||
| 56 | VisUserWeixin visUserWeixin = visUserWeixinRepository.findById(id).orElseThrow( | ||
| 57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserWeixin.class, id), 1)); | ||
| 58 | visUserWeixinRepository.delete(visUserWeixin); | ||
| 59 | } | ||
| 60 | |||
| 61 | @Override | ||
| 62 | public VisUserWeixinDTO findByOpenid(String account) { | ||
| 63 | VisUserWeixin visUserWeixin = visUserWeixinRepository.findByOpenid(account).orElseGet(VisUserWeixin::new); | ||
| 64 | return visUserWeixinMapper.toDto(visUserWeixin); | ||
| 65 | } | ||
| 66 | |||
| 67 | |||
| 68 | } |
src/main/java/com/topdraw/business/module/vis/hainan/weixin/service/mapper/VisUserWeixinMapper.java
0 → 100644
| 1 | package com.topdraw.business.module.vis.hainan.weixin.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin; | ||
| 5 | import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-14 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface VisUserWeixinMapper extends BaseMapper<VisUserWeixinDTO, VisUserWeixin> { | ||
| 15 | |||
| 16 | } |
src/main/java/com/topdraw/business/process/domian/weixin/DefaultWeiXinBeanDefinition.java
deleted
100644 → 0
| 1 | package com.topdraw.business.process.domian.weixin; | ||
| 2 | |||
| 3 | import cn.hutool.core.date.DateUtil; | ||
| 4 | import cn.hutool.http.HttpUtil; | ||
| 5 | import com.alibaba.fastjson.JSONObject; | ||
| 6 | import com.topdraw.exception.BadRequestException; | ||
| 7 | import com.topdraw.utils.StringUtils; | ||
| 8 | import lombok.Data; | ||
| 9 | import org.springframework.beans.factory.annotation.Value; | ||
| 10 | import org.springframework.stereotype.Component; | ||
| 11 | |||
| 12 | import java.io.File; | ||
| 13 | import java.nio.charset.StandardCharsets; | ||
| 14 | import java.util.Base64; | ||
| 15 | import java.util.Date; | ||
| 16 | import java.util.UUID; | ||
| 17 | |||
| 18 | @Data | ||
| 19 | @Component | ||
| 20 | public class DefaultWeiXinBeanDefinition implements WeiXinBeanDefinition { | ||
| 21 | |||
| 22 | // | ||
| 23 | private String appid; | ||
| 24 | |||
| 25 | private String openId; | ||
| 26 | |||
| 27 | private String code; | ||
| 28 | |||
| 29 | private String token; | ||
| 30 | |||
| 31 | private String secret; | ||
| 32 | |||
| 33 | private String unionId; | ||
| 34 | |||
| 35 | private String nickname; | ||
| 36 | |||
| 37 | private String headImgUrl; | ||
| 38 | |||
| 39 | private JSONObject userInfo; | ||
| 40 | |||
| 41 | private String phoneNumber; | ||
| 42 | |||
| 43 | @Value("${file.upload:upload}") | ||
| 44 | private String filePath; | ||
| 45 | |||
| 46 | public DefaultWeiXinBeanDefinition() { | ||
| 47 | } | ||
| 48 | |||
| 49 | public DefaultWeiXinBeanDefinition(String appId, String code, String unionId, String openId, JSONObject userInfoWxJo, String phone) { | ||
| 50 | |||
| 51 | this.userInfo = userInfoWxJo; | ||
| 52 | if (userInfo != null) { | ||
| 53 | |||
| 54 | if (StringUtils.isNotBlank(userInfoWxJo.getString("unionId"))) { | ||
| 55 | unionId = userInfoWxJo.getString("unionId"); | ||
| 56 | } | ||
| 57 | |||
| 58 | if (StringUtils.isNotBlank(userInfoWxJo.getString("openId"))) { | ||
| 59 | openId = userInfoWxJo.getString("openId"); | ||
| 60 | } | ||
| 61 | |||
| 62 | headImgUrl = userInfoWxJo.getString("avatarUrl"); | ||
| 63 | |||
| 64 | if (StringUtils.isNotBlank(userInfoWxJo.getString("nickName"))) { | ||
| 65 | nickname = Base64.getEncoder().encodeToString(userInfoWxJo.getString("nickName").getBytes(StandardCharsets.UTF_8)); | ||
| 66 | } | ||
| 67 | |||
| 68 | String phoneNumber = userInfoWxJo.getString("phoneNumber"); | ||
| 69 | if (StringUtils.isBlank(phoneNumber)) { | ||
| 70 | throw new BadRequestException("phoneNumber is null..."); | ||
| 71 | } | ||
| 72 | |||
| 73 | this.phoneNumber = phoneNumber; | ||
| 74 | |||
| 75 | if (StringUtils.isNotBlank(headImgUrl)) { | ||
| 76 | |||
| 77 | new Thread(() -> { | ||
| 78 | String s = UUID.randomUUID().toString(); | ||
| 79 | File file = new File(System.getProperty("user.dir") + "/" + filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd")); | ||
| 80 | if (!file.exists()) { | ||
| 81 | file.mkdirs(); | ||
| 82 | } | ||
| 83 | |||
| 84 | HttpUtil.downloadFile(headImgUrl, new File(System.getProperty("user.dir") + "/" + filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd") + "/" + s + ".jpg")); | ||
| 85 | |||
| 86 | headImgUrl = filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd") + "/" + s + ".jpg"; | ||
| 87 | }).start(); | ||
| 88 | |||
| 89 | } | ||
| 90 | |||
| 91 | } | ||
| 92 | |||
| 93 | this.unionId = unionId; | ||
| 94 | this.phoneNumber = phone; | ||
| 95 | this.openId = openId; | ||
| 96 | this.appid = appId; | ||
| 97 | this.code = code; | ||
| 98 | } | ||
| 99 | |||
| 100 | @Override | ||
| 101 | public String getAppId() { | ||
| 102 | return this.appid; | ||
| 103 | } | ||
| 104 | |||
| 105 | @Override | ||
| 106 | public String getCode() { | ||
| 107 | return this.code; | ||
| 108 | } | ||
| 109 | |||
| 110 | @Override | ||
| 111 | public String getToken() { | ||
| 112 | return this.token; | ||
| 113 | } | ||
| 114 | |||
| 115 | @Override | ||
| 116 | public String getSecret() { | ||
| 117 | return this.secret; | ||
| 118 | } | ||
| 119 | |||
| 120 | @Override | ||
| 121 | public String getOpenId() { | ||
| 122 | return this.openId; | ||
| 123 | } | ||
| 124 | |||
| 125 | @Override | ||
| 126 | public String getUnionId() { | ||
| 127 | return this.unionId; | ||
| 128 | } | ||
| 129 | |||
| 130 | @Override | ||
| 131 | public String getNickname() { | ||
| 132 | return this.nickname; | ||
| 133 | } | ||
| 134 | |||
| 135 | @Override | ||
| 136 | public String getHeadImgUrl() { | ||
| 137 | return this.headImgUrl; | ||
| 138 | } | ||
| 139 | |||
| 140 | @Override | ||
| 141 | public JSONObject getUserInfo() { | ||
| 142 | return this.userInfo; | ||
| 143 | } | ||
| 144 | } |
| 1 | package com.topdraw.business.process.domian.weixin; | ||
| 2 | |||
| 3 | |||
| 4 | import com.alibaba.fastjson.JSONObject; | ||
| 5 | import lombok.Data; | ||
| 6 | |||
| 7 | @Data | ||
| 8 | public class SubscribeBean extends WeiXinUserBean { | ||
| 9 | |||
| 10 | private JSONObject userInfoJson; | ||
| 11 | |||
| 12 | private JSONObject iptvUserInfo; | ||
| 13 | |||
| 14 | private String msgType; | ||
| 15 | |||
| 16 | private String event; | ||
| 17 | |||
| 18 | |||
| 19 | /** */ | ||
| 20 | private String openId; | ||
| 21 | |||
| 22 | /** */ | ||
| 23 | private String appId; | ||
| 24 | |||
| 25 | /** */ | ||
| 26 | private String eventKey; | ||
| 27 | |||
| 28 | private String unionid; | ||
| 29 | private String nickname; | ||
| 30 | private String headimgurl; | ||
| 31 | |||
| 32 | } |
| 1 | package com.topdraw.business.process.domian.weixin; | ||
| 2 | |||
| 3 | import lombok.AllArgsConstructor; | ||
| 4 | import lombok.Data; | ||
| 5 | import lombok.NoArgsConstructor; | ||
| 6 | |||
| 7 | import javax.validation.constraints.NotNull; | ||
| 8 | |||
| 9 | @Data | ||
| 10 | @AllArgsConstructor | ||
| 11 | @NoArgsConstructor | ||
| 12 | public class SubscribeBeanEvent { | ||
| 13 | |||
| 14 | @NotNull(message = "【content】 not be null !!!") | ||
| 15 | private String content; | ||
| 16 | |||
| 17 | } |
src/main/java/com/topdraw/business/process/domian/weixin/WeiXinBeanDefinition.java
deleted
100644 → 0
| 1 | package com.topdraw.business.process.domian.weixin; | ||
| 2 | |||
| 3 | import com.alibaba.fastjson.JSONObject; | ||
| 4 | |||
| 5 | public interface WeiXinBeanDefinition { | ||
| 6 | |||
| 7 | String getAppId(); | ||
| 8 | |||
| 9 | String getCode(); | ||
| 10 | |||
| 11 | String getToken(); | ||
| 12 | |||
| 13 | String getSecret(); | ||
| 14 | |||
| 15 | String getOpenId(); | ||
| 16 | |||
| 17 | String getUnionId(); | ||
| 18 | |||
| 19 | String getNickname(); | ||
| 20 | |||
| 21 | String getHeadImgUrl(); | ||
| 22 | |||
| 23 | JSONObject getUserInfo(); | ||
| 24 | } |
| 1 | package com.topdraw.business.process.domian.weixin; | ||
| 2 | |||
| 3 | |||
| 4 | import lombok.Data; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * 微信账户信息 | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2021-01-18 | ||
| 10 | */ | ||
| 11 | @Data | ||
| 12 | public class WeiXinUserBean { | ||
| 13 | |||
| 14 | private Long id; | ||
| 15 | |||
| 16 | private String unionid; | ||
| 17 | |||
| 18 | /** */ | ||
| 19 | private String openid; | ||
| 20 | |||
| 21 | /** */ | ||
| 22 | private String appid; | ||
| 23 | |||
| 24 | /** 加密后的appId,参数 */ | ||
| 25 | private String wxAppid; | ||
| 26 | |||
| 27 | /** 加密后的code,参数 */ | ||
| 28 | private String wxCode; | ||
| 29 | |||
| 30 | /** */ | ||
| 31 | private String userInfo; | ||
| 32 | |||
| 33 | /** 会员id */ | ||
| 34 | private Long memberId; | ||
| 35 | |||
| 36 | /** 加密信息 */ | ||
| 37 | private String encryptedData; | ||
| 38 | |||
| 39 | /** 解析用户电话号码时使用,参数 */ | ||
| 40 | private String iv; | ||
| 41 | |||
| 42 | /** 资源id */ | ||
| 43 | private String sourceId; | ||
| 44 | |||
| 45 | /** 资源类型 */ | ||
| 46 | private String sourceType; | ||
| 47 | |||
| 48 | /** 资源描述,用来表示从哪个地方链接进来的 */ | ||
| 49 | private String sourceDesc; | ||
| 50 | |||
| 51 | /** 资源实例 */ | ||
| 52 | private String sourceEntity; | ||
| 53 | |||
| 54 | /** 推荐者id */ | ||
| 55 | private Long sourceUser; | ||
| 56 | |||
| 57 | private String nikename; | ||
| 58 | |||
| 59 | private String headimgurl; | ||
| 60 | } |
| ... | @@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired; | ... | @@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | 12 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 13 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| 14 | 14 | ||
| 15 | import java.util.Objects; | ||
| 16 | |||
| 15 | /** | 17 | /** |
| 16 | * | 18 | * |
| 17 | */ | 19 | */ |
| ... | @@ -21,13 +23,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -21,13 +23,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
| 21 | @Autowired | 23 | @Autowired |
| 22 | private ExpDetailService expDetailService; | 24 | private ExpDetailService expDetailService; |
| 23 | @Autowired | 25 | @Autowired |
| 24 | private MemberOperationService memberOperationService; | ||
| 25 | @Autowired | ||
| 26 | private MemberLevelService memberLevelService; | ||
| 27 | @Autowired | ||
| 28 | private MemberService memberService; | 26 | private MemberService memberService; |
| 29 | @Autowired | ||
| 30 | ThreadPoolTaskExecutor threadPoolTaskExecutor; | ||
| 31 | 27 | ||
| 32 | public void asyncMemberExpAndLevel(Member member) { | 28 | public void asyncMemberExpAndLevel(Member member) { |
| 33 | String code = member.getCode(); | 29 | String code = member.getCode(); |
| ... | @@ -40,8 +36,10 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -40,8 +36,10 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
| 40 | public void asyncExpDetail(ExpDetail expDetail) { | 36 | public void asyncExpDetail(ExpDetail expDetail) { |
| 41 | String code = expDetail.getMemberCode(); | 37 | String code = expDetail.getMemberCode(); |
| 42 | MemberDTO memberDTO = this.memberService.findByCode(code); | 38 | MemberDTO memberDTO = this.memberService.findByCode(code); |
| 43 | expDetail.setMemberId(memberDTO.getId()); | 39 | if (Objects.nonNull(memberDTO.getId())) { |
| 40 | expDetail.setMemberId(memberDTO.getId()); | ||
| 41 | this.expDetailService.create(expDetail); | ||
| 42 | } | ||
| 44 | 43 | ||
| 45 | this.expDetailService.create(expDetail); | ||
| 46 | } | 44 | } |
| 47 | } | 45 | } | ... | ... |
| ... | @@ -7,29 +7,18 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; | ... | @@ -7,29 +7,18 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 7 | import com.topdraw.business.module.points.available.domain.PointsAvailable; | 7 | import com.topdraw.business.module.points.available.domain.PointsAvailable; |
| 8 | import com.topdraw.business.module.points.available.service.PointsAvailableService; | 8 | import com.topdraw.business.module.points.available.service.PointsAvailableService; |
| 9 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; | 9 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; |
| 10 | import com.topdraw.business.module.points.detail.detailhistory.service.PointsDetailHistoryService; | ||
| 11 | import com.topdraw.business.module.points.detail.domain.PointsDetail; | 10 | import com.topdraw.business.module.points.detail.domain.PointsDetail; |
| 12 | import com.topdraw.business.module.points.detail.service.PointsDetailService; | 11 | import com.topdraw.business.module.points.detail.service.PointsDetailService; |
| 13 | import com.topdraw.business.module.points.service.PointsService; | ||
| 14 | import com.topdraw.business.process.domian.TempPoints; | ||
| 15 | import com.topdraw.business.process.service.PointsOperationService; | 12 | import com.topdraw.business.process.service.PointsOperationService; |
| 16 | import com.topdraw.business.process.service.member.MemberOperationService; | ||
| 17 | import com.topdraw.util.IdWorker; | ||
| 18 | import com.topdraw.util.TimestampUtil; | ||
| 19 | import com.topdraw.utils.StringUtils; | 13 | import com.topdraw.utils.StringUtils; |
| 20 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
| 21 | import org.springframework.beans.BeanUtils; | ||
| 22 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | 16 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 24 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| 25 | import org.springframework.transaction.annotation.Propagation; | 18 | import org.springframework.transaction.annotation.Propagation; |
| 26 | import org.springframework.transaction.annotation.Transactional; | 19 | import org.springframework.transaction.annotation.Transactional; |
| 27 | import org.springframework.util.CollectionUtils; | ||
| 28 | 20 | ||
| 29 | import javax.validation.constraints.NotNull; | ||
| 30 | import java.time.LocalDateTime; | ||
| 31 | import java.util.*; | 21 | import java.util.*; |
| 32 | import java.util.stream.Collectors; | ||
| 33 | 22 | ||
| 34 | /** | 23 | /** |
| 35 | * | 24 | * |
| ... | @@ -49,24 +38,35 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -49,24 +38,35 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
| 49 | ThreadPoolTaskExecutor threadPoolTaskExecutor; | 38 | ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| 50 | 39 | ||
| 51 | public void asyncMemberPoint(Member member) { | 40 | public void asyncMemberPoint(Member member) { |
| 41 | log.info("修改会员积分,参数 =>> {}", member); | ||
| 52 | String code = member.getCode(); | 42 | String code = member.getCode(); |
| 43 | if (StringUtils.isBlank(code)) { | ||
| 44 | log.error("修改会员积分失败,参数错误,会员code为空"); | ||
| 45 | return; | ||
| 46 | } | ||
| 53 | MemberDTO memberDTO = this.memberService.findByCode(code); | 47 | MemberDTO memberDTO = this.memberService.findByCode(code); |
| 54 | member.setId(memberDTO.getId()); | 48 | if (Objects.nonNull(memberDTO.getId())) { |
| 55 | this.memberService.doUpdateMemberPoints(member); | 49 | member.setId(memberDTO.getId()); |
| 50 | this.memberService.doUpdateMemberPoints(member); | ||
| 51 | } | ||
| 56 | } | 52 | } |
| 57 | 53 | ||
| 58 | public void asyncPointsAvailable(PointsAvailable pointsAvailable) { | 54 | public void asyncPointsAvailable(PointsAvailable pointsAvailable) { |
| 59 | String memberCode = pointsAvailable.getMemberCode(); | 55 | String memberCode = pointsAvailable.getMemberCode(); |
| 60 | MemberDTO memberDTO = this.memberService.findByCode(memberCode); | 56 | MemberDTO memberDTO = this.memberService.findByCode(memberCode); |
| 61 | pointsAvailable.setMemberId(memberDTO.getId()); | 57 | if (Objects.nonNull(memberDTO.getId())) { |
| 62 | this.pointsAvailableService.create4Custom(pointsAvailable); | 58 | pointsAvailable.setMemberId(memberDTO.getId()); |
| 59 | this.pointsAvailableService.create4Custom(pointsAvailable); | ||
| 60 | } | ||
| 63 | } | 61 | } |
| 64 | 62 | ||
| 65 | public void asyncPointsDetail(PointsDetail pointsDetail) { | 63 | public void asyncPointsDetail(PointsDetail pointsDetail) { |
| 66 | String memberCode = pointsDetail.getMemberCode(); | 64 | String memberCode = pointsDetail.getMemberCode(); |
| 67 | MemberDTO memberDTO = this.memberService.findByCode(memberCode); | 65 | MemberDTO memberDTO = this.memberService.findByCode(memberCode); |
| 68 | pointsDetail.setMemberId(memberDTO.getId()); | 66 | if (Objects.nonNull(memberDTO.getId())) { |
| 69 | this.pointsDetailService.create4Custom(pointsDetail); | 67 | pointsDetail.setMemberId(memberDTO.getId()); |
| 68 | this.pointsDetailService.create4Custom(pointsDetail); | ||
| 69 | } | ||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | public void asyncDeletePointsAvailable(PointsAvailable pointsAvailable) { | 72 | public void asyncDeletePointsAvailable(PointsAvailable pointsAvailable) { | ... | ... |
| 1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | ||
| 3 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; | 4 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; |
| 4 | import com.topdraw.business.module.task.attribute.service.TaskAttrService; | 5 | import com.topdraw.business.module.task.attribute.service.TaskAttrService; |
| 5 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; | 6 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; |
| ... | @@ -50,10 +51,10 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -50,10 +51,10 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 50 | TaskDTO taskDTO = this.findByCode(code); | 51 | TaskDTO taskDTO = this.findByCode(code); |
| 51 | if (Objects.isNull(taskDTO.getId())) { | 52 | if (Objects.isNull(taskDTO.getId())) { |
| 52 | TaskDTO taskDTO_ = this.taskService.create(task); | 53 | TaskDTO taskDTO_ = this.taskService.create(task); |
| 53 | if (Objects.nonNull(taskDTO_.getId())) { | 54 | /*if (Objects.nonNull(taskDTO_.getId())) { |
| 54 | task.setId(taskDTO_.getId()); | 55 | task.setId(taskDTO_.getId()); |
| 55 | this.createTaskAttr(task); | 56 | this.createTaskAttr(task); |
| 56 | } | 57 | }*/ |
| 57 | } | 58 | } |
| 58 | } | 59 | } |
| 59 | 60 | ||
| ... | @@ -72,17 +73,23 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -72,17 +73,23 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 72 | String code = task.getCode(); | 73 | String code = task.getCode(); |
| 73 | TaskDTO taskDTO = this.findByCode(code); | 74 | TaskDTO taskDTO = this.findByCode(code); |
| 74 | if (Objects.nonNull(taskDTO.getId())) { | 75 | if (Objects.nonNull(taskDTO.getId())) { |
| 75 | Long id = taskDTO.getId(); | 76 | Task task1 = new Task(); |
| 76 | task.setId(id); | 77 | BeanUtils.copyProperties(taskDTO, task1); |
| 77 | 78 | ||
| 79 | Long id = taskDTO.getId(); | ||
| 80 | task1.setId(id); | ||
| 78 | String taskTemplateCode = task.getTaskTemplateCode(); | 81 | String taskTemplateCode = task.getTaskTemplateCode(); |
| 79 | TaskTemplateDTO taskTemplateDTO = this.taskTemplateOperationService.findByCode(taskTemplateCode); | 82 | if (StringUtils.isNotBlank(taskTemplateCode)) { |
| 80 | Long templateId = taskTemplateDTO.getId(); | 83 | TaskTemplateDTO taskTemplateDTO = this.taskTemplateOperationService.findByCode(taskTemplateCode); |
| 81 | task.setTaskTemplateId(templateId); | 84 | Long templateId = taskTemplateDTO.getId(); |
| 82 | TaskDTO update = this.update(task); | 85 | task1.setTaskTemplateId(templateId); |
| 83 | if (Objects.nonNull(update)) { | ||
| 84 | this.updateTaskAttr(task); | ||
| 85 | } | 86 | } |
| 87 | |||
| 88 | task1.copy(task); | ||
| 89 | TaskDTO update = this.update(task1); | ||
| 90 | /*if (Objects.nonNull(update)) { | ||
| 91 | this.updateTaskAttr(task); | ||
| 92 | }*/ | ||
| 86 | } | 93 | } |
| 87 | 94 | ||
| 88 | } | 95 | } |
| ... | @@ -129,8 +136,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -129,8 +136,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 129 | } | 136 | } |
| 130 | 137 | ||
| 131 | private TaskDTO findByCode(String code){ | 138 | private TaskDTO findByCode(String code){ |
| 132 | TaskDTO taskDTO = this.taskService.findByCode(code); | 139 | return this.taskService.findByCode(code); |
| 133 | return taskDTO; | ||
| 134 | } | 140 | } |
| 135 | 141 | ||
| 136 | } | 142 | } | ... | ... |
| ... | @@ -2,9 +2,27 @@ package com.topdraw.business.process.service.impl; | ... | @@ -2,9 +2,27 @@ package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | 3 | ||
| 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.domain.MemberBuilder; | ||
| 6 | import com.topdraw.business.module.member.domain.MemberTypeConstant; | ||
| 7 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | ||
| 8 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | ||
| 9 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | ||
| 5 | import com.topdraw.business.module.member.service.MemberService; | 10 | import com.topdraw.business.module.member.service.MemberService; |
| 6 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 11 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 12 | import com.topdraw.business.module.user.app.domain.UserApp; | ||
| 13 | import com.topdraw.business.module.user.app.domain.UserAppBind; | ||
| 14 | import com.topdraw.business.module.user.app.domain.UserAppBindBuilder; | ||
| 15 | import com.topdraw.business.module.user.app.domain.UserAppBuilder; | ||
| 16 | import com.topdraw.business.module.user.app.service.UserAppBindService; | ||
| 17 | import com.topdraw.business.module.user.app.service.UserAppService; | ||
| 18 | import com.topdraw.business.module.user.app.service.dto.AppRegisterDTO; | ||
| 19 | import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; | ||
| 20 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | ||
| 21 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ||
| 7 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 22 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 23 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 24 | import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService; | ||
| 25 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
| 8 | import com.topdraw.business.module.user.iptv.service.UserTvService; | 26 | import com.topdraw.business.module.user.iptv.service.UserTvService; |
| 9 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 27 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 10 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 28 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| ... | @@ -15,8 +33,10 @@ import com.topdraw.business.process.service.dto.MemberAndUserTvDTO; | ... | @@ -15,8 +33,10 @@ import com.topdraw.business.process.service.dto.MemberAndUserTvDTO; |
| 15 | import com.topdraw.business.process.service.dto.MemberAndWeixinUserDTO; | 33 | import com.topdraw.business.process.service.dto.MemberAndWeixinUserDTO; |
| 16 | import com.topdraw.exception.EntityNotFoundException; | 34 | import com.topdraw.exception.EntityNotFoundException; |
| 17 | import com.topdraw.exception.GlobeExceptionMsg; | 35 | import com.topdraw.exception.GlobeExceptionMsg; |
| 36 | import com.topdraw.util.TimestampUtil; | ||
| 18 | import lombok.extern.slf4j.Slf4j; | 37 | import lombok.extern.slf4j.Slf4j; |
| 19 | import org.apache.commons.lang3.StringUtils; | 38 | import org.apache.commons.lang3.StringUtils; |
| 39 | import org.springframework.aop.framework.AopContext; | ||
| 20 | import org.springframework.beans.BeanUtils; | 40 | import org.springframework.beans.BeanUtils; |
| 21 | import org.springframework.beans.factory.annotation.Autowired; | 41 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | import org.springframework.stereotype.Service; | 42 | import org.springframework.stereotype.Service; |
| ... | @@ -37,34 +57,160 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -37,34 +57,160 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 37 | private UserTvService userTvService; | 57 | private UserTvService userTvService; |
| 38 | @Autowired | 58 | @Autowired |
| 39 | private UserWeixinService userWeixinService; | 59 | private UserWeixinService userWeixinService; |
| 60 | @Autowired | ||
| 61 | private MemberProfileService memberProfileService; | ||
| 62 | @Autowired | ||
| 63 | private GrowthReportService growthReportService; | ||
| 64 | @Autowired | ||
| 65 | private UserAppService userAppService; | ||
| 66 | @Autowired | ||
| 67 | private UserAppBindService userAppBindService; | ||
| 68 | |||
| 69 | public void asyncUpdateAppLastActiveTimeAndNicknameAndHeadImg(UserAppDTO resources) { | ||
| 70 | UserAppDTO userAppDTO = this.userAppService.findByUsername(resources.getUsername()); | ||
| 71 | if (Objects.isNull(userAppDTO.getId())) { | ||
| 72 | |||
| 73 | UserApp userApp = new UserApp(); | ||
| 74 | userApp.setId(userAppDTO.getId()); | ||
| 75 | userApp.setUsername(userAppDTO.getUsername()); | ||
| 76 | userApp.setNickname(resources.getNickname()); | ||
| 77 | userApp.setHeadimgurl(resources.getHeadimgurl()); | ||
| 78 | this.userAppService.updateAppLastActiveTimeAndNicknameAndHeadImg(userApp); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | public void asyncCancelUserAppBind(UserAppBindDTO resources) { | ||
| 83 | |||
| 84 | } | ||
| 85 | |||
| 86 | public void asyncUpdatePasswordByUsername(UserAppDTO resources) { | ||
| 87 | UserAppDTO userAppDTO = this.userAppService.findByUsername(resources.getUsername()); | ||
| 88 | if (Objects.isNull(userAppDTO.getId())) { | ||
| 89 | UserApp userApp = new UserApp(); | ||
| 90 | userApp.setId(userAppDTO.getId()); | ||
| 91 | userApp.setPassword(resources.getPassword()); | ||
| 92 | this.userAppService.updatePasswordById(userApp); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | public void asyncUpdateAppInfo(UserAppDTO resources) { | ||
| 97 | UserAppDTO userAppDTO = this.userAppService.findByUsername(resources.getUsername()); | ||
| 98 | if (Objects.nonNull(userAppDTO.getId())) { | ||
| 99 | UserApp userApp = new UserApp(); | ||
| 100 | BeanUtils.copyProperties(resources, userApp); | ||
| 101 | userApp.setId(userAppDTO.getId()); | ||
| 102 | this.userAppService.updateAppInfo(userApp); | ||
| 103 | } | ||
| 104 | } | ||
| 105 | |||
| 106 | public void asyncAppCancellation(UserAppDTO resources) { | ||
| 107 | UserAppDTO userAppDTO = this.userAppService.findByUsername(resources.getUsername()); | ||
| 108 | if (Objects.nonNull(userAppDTO.getId())) { | ||
| 109 | this.userAppService.appCancellation(userAppDTO.getId()); | ||
| 110 | } | ||
| 111 | } | ||
| 112 | |||
| 113 | public void asyncAppRegister(AppRegisterDTO appRegisterDTO) { | ||
| 114 | UserAppDTO userAppDTOResources = appRegisterDTO.getUserAppDTO(); | ||
| 115 | MemberDTO memberDTOResources = appRegisterDTO.getMemberDTO(); | ||
| 116 | |||
| 117 | UserAppDTO userAppDTO = this.userAppService.findByUsername(userAppDTOResources.getUsername()); | ||
| 118 | if (Objects.isNull(userAppDTO.getId())) { | ||
| 119 | |||
| 120 | // 先创建会员 | ||
| 121 | // Member member = MemberBuilder.build(MemberTypeConstant.app, userAppDTOResources.getHeadimgurl(), userAppDTOResources.getNickname(), 0); | ||
| 122 | Member member = new Member(); | ||
| 123 | BeanUtils.copyProperties(memberDTOResources, member); | ||
| 124 | member.setId(null); | ||
| 125 | MemberDTO _memberDTO = this.memberService.create(member); | ||
| 126 | |||
| 127 | if (Objects.nonNull(_memberDTO.getId())) { | ||
| 128 | |||
| 129 | UserApp userApp = new UserApp(); | ||
| 130 | BeanUtils.copyProperties(userAppDTOResources, userApp); | ||
| 131 | userApp.setId(null); | ||
| 132 | // 保存app账号 | ||
| 133 | UserAppDTO _userAppDTO = this.userAppService.create(UserAppBuilder.build(_memberDTO.getId(), userApp)); | ||
| 134 | |||
| 135 | if (Objects.nonNull(_userAppDTO.getId()) && StringUtils.isNotBlank(userAppDTO.getAccount())) { | ||
| 136 | UserAppBindDTO userAppBindDTO = this.userAppBindService.findFirstByAccount(userAppDTO.getAccount()); | ||
| 137 | if (Objects.isNull(userAppBindDTO.getId())) { | ||
| 138 | // 保存绑定关系 | ||
| 139 | UserAppBind userAppBind = UserAppBindBuilder.build(_userAppDTO.getId(), userAppDTO.getAccount(), userAppDTO.getAccountType()); | ||
| 140 | this.userAppBindService.create(userAppBind); | ||
| 141 | } | ||
| 142 | } | ||
| 143 | |||
| 144 | } | ||
| 145 | |||
| 146 | } | ||
| 147 | } | ||
| 148 | |||
| 149 | public void asyncsaveGrowthReport(GrowthReport growthReport) { | ||
| 150 | String platformAccount = growthReport.getPlatformAccount(); | ||
| 151 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
| 152 | if (Objects.isNull(userTvDTO.getId())){ | ||
| 153 | log.error("保存成长报告失败,大屏信息不存在[asyncsaveGrowthReport#]"); | ||
| 154 | return; | ||
| 155 | } | ||
| 156 | |||
| 157 | String weekFirstDay = com.topdraw.util.DateUtil.getWeekFirstDay(); | ||
| 158 | String weekLastDay = com.topdraw.util.DateUtil.getWeekLastDay(); | ||
| 159 | GrowthReportDTO growthReportDTO = this.growthReportService.findByPlatformAccountAndStartDateAndEndDate(platformAccount, weekFirstDay, weekLastDay); | ||
| 160 | |||
| 161 | if (Objects.isNull(growthReportDTO.getId())) { | ||
| 162 | |||
| 163 | Long id = userTvDTO.getId(); | ||
| 164 | Long memberId = userTvDTO.getMemberId(); | ||
| 165 | growthReport.setUserId(id); | ||
| 166 | growthReport.setMemberId(memberId); | ||
| 167 | growthReport.setStartDate(weekFirstDay); | ||
| 168 | growthReport.setEndDate(weekLastDay); | ||
| 169 | |||
| 170 | this.growthReportService.create(growthReport); | ||
| 171 | |||
| 172 | } else { | ||
| 173 | |||
| 174 | this.growthReportService.updateGrowthReportData(growthReportDTO.getId(), growthReport.getData()); | ||
| 175 | |||
| 176 | } | ||
| 177 | |||
| 178 | } | ||
| 40 | 179 | ||
| 41 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | 180 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) |
| 42 | public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) { | 181 | public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) { |
| 182 | log.info("保存微信账号并同时创建会员信息 ==>> {}", memberAndWeixinUserDTO); | ||
| 183 | |||
| 43 | UserWeixinDTO userWeixinDTO = memberAndWeixinUserDTO.getUserWeixinDTO(); | 184 | UserWeixinDTO userWeixinDTO = memberAndWeixinUserDTO.getUserWeixinDTO(); |
| 44 | String openid = userWeixinDTO.getOpenid(); | 185 | String openid = userWeixinDTO.getOpenid(); |
| 45 | String unionid = userWeixinDTO.getUnionid(); | 186 | String unionid = userWeixinDTO.getUnionid(); |
| 46 | String appid = userWeixinDTO.getAppid(); | 187 | String appid = userWeixinDTO.getAppid(); |
| 47 | 188 | ||
| 48 | UserWeixinDTO _userWeixinDTO = this.userWeixinService.findFirstByAppIdAndOpenId(appid, openid); | 189 | UserWeixinDTO _userWeixinDTO = this.userWeixinService.findFirstByAppIdAndOpenId(appid, openid); |
| 190 | log.info("通过appid ==>> {} 和openId ==>> {},检查微信账号是否存在 ==>> {}",appid, openid, _userWeixinDTO); | ||
| 49 | // 无账号 | 191 | // 无账号 |
| 50 | if (Objects.isNull(_userWeixinDTO.getId())) { | 192 | if (Objects.isNull(_userWeixinDTO.getId())) { |
| 51 | 193 | ||
| 52 | // 是否存在会员 | 194 | // 其他账号 |
| 53 | UserWeixinDTO userWeixinDTO1 = this.userWeixinService.findFirstByUnionId(unionid); | 195 | UserWeixinDTO userWeixinDTO1 = this.userWeixinService.findFirstByUnionId(unionid); |
| 196 | log.info("账号不存在通过unionid ==>> {},检查其他微信账号是否存在 ==>> {}",unionid, userWeixinDTO1); | ||
| 54 | 197 | ||
| 55 | if (Objects.nonNull(userWeixinDTO1.getId())) { | 198 | if (Objects.nonNull(userWeixinDTO1.getId())) { |
| 56 | 199 | ||
| 57 | Long memberId = userWeixinDTO1.getMemberId(); | 200 | Long memberId = userWeixinDTO1.getMemberId(); |
| 58 | if (Objects.nonNull(memberId)) { | 201 | if (Objects.nonNull(memberId)) { |
| 59 | |||
| 60 | userWeixinDTO.setMemberId(memberId); | 202 | userWeixinDTO.setMemberId(memberId); |
| 61 | MemberDTO memberDTO = this.memberService.findById(memberId); | 203 | MemberDTO memberDTO = this.memberService.findById(memberId); |
| 62 | MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO(); | 204 | log.info("其他账号的会员信息 ==>> {},memberId ==>> {}",memberDTO, memberId); |
| 63 | this.updateMember(memberDTO, memberDTO1); | 205 | if (Objects.nonNull(memberDTO.getId())) { |
| 206 | MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO(); | ||
| 207 | this.updateMember(memberDTO, memberDTO1); | ||
| 208 | } | ||
| 64 | 209 | ||
| 65 | } else { | 210 | } else { |
| 66 | 211 | ||
| 67 | MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO(); | 212 | MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO(); |
| 213 | log.info("其他账号的无会员信息,创建会员 memberDTO1 ==>> {}",memberDTO1); | ||
| 68 | String memberCode = memberDTO1.getCode(); | 214 | String memberCode = memberDTO1.getCode(); |
| 69 | if (StringUtils.isNotBlank(memberCode)) { | 215 | if (StringUtils.isNotBlank(memberCode)) { |
| 70 | Member member = new Member(); | 216 | Member member = new Member(); |
| ... | @@ -75,10 +221,11 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -75,10 +221,11 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 75 | 221 | ||
| 76 | } | 222 | } |
| 77 | 223 | ||
| 78 | // 无会员 | 224 | // 无其他账号 |
| 79 | } else { | 225 | } else { |
| 80 | 226 | ||
| 81 | MemberDTO memberDTO = memberAndWeixinUserDTO.getMemberDTO(); | 227 | MemberDTO memberDTO = memberAndWeixinUserDTO.getMemberDTO(); |
| 228 | log.info("无其他账号的无会员信息,创建会员 memberDTO ==>> {}",memberDTO); | ||
| 82 | Member member = new Member(); | 229 | Member member = new Member(); |
| 83 | BeanUtils.copyProperties(memberDTO, member); | 230 | BeanUtils.copyProperties(memberDTO, member); |
| 84 | member.setId(null); | 231 | member.setId(null); |
| ... | @@ -87,19 +234,20 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -87,19 +234,20 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 87 | } | 234 | } |
| 88 | 235 | ||
| 89 | userWeixinDTO.setId(null); | 236 | userWeixinDTO.setId(null); |
| 237 | log.info("保存微信账号,userWeixinDTO ==>> {}",userWeixinDTO); | ||
| 90 | this.createWeixin(userWeixinDTO); | 238 | this.createWeixin(userWeixinDTO); |
| 91 | 239 | ||
| 92 | } else { | 240 | } else { |
| 93 | 241 | // 账号存在,会员也存在 | |
| 94 | // 会员存在 | 242 | // 会员存在 |
| 95 | if(Objects.nonNull(_userWeixinDTO.getMemberId())) { | 243 | if(Objects.nonNull(_userWeixinDTO.getMemberId())) { |
| 96 | // 账号存在,修改账号和会员 | 244 | // 账号存在,修改账号和会员 |
| 97 | this.updateWeixin(_userWeixinDTO, userWeixinDTO); | 245 | this.updateWeixin(_userWeixinDTO, userWeixinDTO); |
| 98 | MemberDTO _memberDTO = this.memberService.findById(_userWeixinDTO.getMemberId()); | 246 | MemberDTO _memberDTO = this.memberService.findById(_userWeixinDTO.getMemberId()); |
| 99 | 247 | if (Objects.nonNull(_memberDTO.getId())){ | |
| 100 | MemberDTO memberDTO = memberAndWeixinUserDTO.getMemberDTO(); | 248 | MemberDTO memberDTO = memberAndWeixinUserDTO.getMemberDTO(); |
| 101 | this.updateMember(_memberDTO, memberDTO); | 249 | this.updateMember(_memberDTO, memberDTO); |
| 102 | 250 | } | |
| 103 | // 有账号无会员 | 251 | // 有账号无会员 |
| 104 | } else { | 252 | } else { |
| 105 | 253 | ||
| ... | @@ -139,13 +287,18 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -139,13 +287,18 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 139 | 287 | ||
| 140 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | 288 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) |
| 141 | public void asyncMemberAndUserTv4Iptv(MemberAndUserTvDTO memberAndUserTvDTO) { | 289 | public void asyncMemberAndUserTv4Iptv(MemberAndUserTvDTO memberAndUserTvDTO) { |
| 290 | log.info("同步小屏侧过来的大屏账号和会员, memberAndUserTvDTO ==>> {}", memberAndUserTvDTO); | ||
| 291 | |||
| 142 | UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO(); | 292 | UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO(); |
| 143 | MemberDTO memberDTO = memberAndUserTvDTO.getMemberDTO(); | 293 | MemberDTO memberDTO = memberAndUserTvDTO.getMemberDTO(); |
| 144 | 294 | ||
| 145 | String platformAccount = userTvDTO.getPlatformAccount(); | 295 | String platformAccount = userTvDTO.getPlatformAccount(); |
| 296 | log.info("同步小屏侧过来的大屏账号, platformAccount ==>> {}", platformAccount); | ||
| 146 | UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | 297 | UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); |
| 147 | if (Objects.isNull(_userTvDTO)) { | 298 | // log.info("查询数据对应的大屏账号信息, _userTvDTO ==>> {}", _userTvDTO); |
| 148 | 299 | ||
| 300 | if (Objects.isNull(_userTvDTO)) { | ||
| 301 | log.info("大屏账号不存在, 创建会员并新增账号"); | ||
| 149 | memberDTO.setId(null); | 302 | memberDTO.setId(null); |
| 150 | // 创建大屏会员 | 303 | // 创建大屏会员 |
| 151 | MemberDTO _memberDTO = this.createMember(memberDTO); | 304 | MemberDTO _memberDTO = this.createMember(memberDTO); |
| ... | @@ -155,46 +308,72 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -155,46 +308,72 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 155 | 308 | ||
| 156 | } else { | 309 | } else { |
| 157 | 310 | ||
| 158 | String code = memberDTO.getCode(); | 311 | Long memberId = _userTvDTO.getMemberId(); |
| 159 | MemberDTO _memberDTO = this.memberService.findByCode(code); | 312 | if (Objects.isNull(memberId)) { |
| 160 | if (Objects.nonNull(_memberDTO.getId())) { | ||
| 161 | this.updateMember(_memberDTO, memberDTO); | ||
| 162 | } else { | ||
| 163 | memberDTO.setId(null); | 313 | memberDTO.setId(null); |
| 164 | MemberDTO _memberDTO0 = this.createMember(memberDTO); | 314 | // 创建大屏会员 |
| 165 | userTvDTO.setMemberId(_memberDTO0.getId()); | 315 | MemberDTO _memberDTO = this.createMember(memberDTO); |
| 316 | userTvDTO.setMemberId(_memberDTO.getId()); | ||
| 317 | |||
| 318 | log.info("大屏账号存在, 但无会员信息,新增会员信息并修改大屏账号"); | ||
| 319 | // this.userTvService.updateMemberId(platformAccount, _memberDTO.getId()); | ||
| 320 | |||
| 321 | } else { | ||
| 322 | |||
| 323 | MemberProfileDTO memberProfileDTO = this.memberProfileService.findByMemberId(memberId); | ||
| 324 | if (Objects.isNull(memberProfileDTO)) { | ||
| 325 | MemberDTO memberDTO1 = this.memberService.findById(memberId); | ||
| 326 | Member member = new Member(); | ||
| 327 | BeanUtils.copyProperties(memberDTO1, member); | ||
| 328 | this.memberProfileService.createDefault(member); | ||
| 329 | } | ||
| 330 | |||
| 166 | } | 331 | } |
| 167 | 332 | ||
| 168 | this.updateUserTv(_userTvDTO, userTvDTO); | 333 | |
| 334 | UserTv userTv = new UserTv(); | ||
| 335 | BeanUtils.copyProperties(_userTvDTO, userTv); | ||
| 336 | this.userTvService.updateUserTvByPlatformAccount(userTv); | ||
| 337 | |||
| 169 | } | 338 | } |
| 170 | } | 339 | } |
| 171 | 340 | ||
| 172 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | 341 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) |
| 173 | public void asyncAppletBind(MemberAndUserTvDTO memberAndUserTvDTO) { | 342 | public void asyncMinaBind(MemberAndUserTvDTO memberAndUserTvDTO) { |
| 343 | log.info("asyncAppletBind ==>> 小程序绑定大屏,参数 memberAndUserTvDTO ==>> {}", memberAndUserTvDTO); | ||
| 174 | UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO(); | 344 | UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO(); |
| 175 | MemberDTO memberDTO = memberAndUserTvDTO.getMemberDTO(); | 345 | MemberDTO memberDTO = memberAndUserTvDTO.getMemberDTO(); |
| 176 | 346 | ||
| 177 | String platformAccount = userTvDTO.getPlatformAccount(); | 347 | String platformAccount = userTvDTO.getPlatformAccount(); |
| 178 | UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | 348 | UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); |
| 179 | if (Objects.nonNull(_userTvDTO)) { | 349 | if (Objects.nonNull(_userTvDTO.getId())) { |
| 180 | 350 | ||
| 181 | // | 351 | // |
| 182 | this.updateUserTv(_userTvDTO, userTvDTO); | 352 | // userTvDTO.getPriorityMemberCode(); |
| 353 | // this.updateUserTv(_userTvDTO, userTvDTO); | ||
| 354 | // 修改大屏账号的主会员 | ||
| 355 | String priorityMemberCode = userTvDTO.getPriorityMemberCode(); | ||
| 356 | log.info("修改大屏账号的主会员, 主会员priorityMemberCode ==>> {}", priorityMemberCode); | ||
| 357 | if (StringUtils.isNotBlank(priorityMemberCode)) { | ||
| 358 | this.userTvService.updatePriorityMemberCode(platformAccount, priorityMemberCode); | ||
| 359 | } | ||
| 183 | 360 | ||
| 184 | String code = memberDTO.getCode(); | 361 | String code = memberDTO.getCode(); |
| 185 | MemberDTO _memberDTO = this.memberService.findByCode(code); | 362 | MemberDTO _memberDTO = this.memberService.findByCode(code); |
| 186 | 363 | ||
| 187 | memberDTO.setUserIptvId(_userTvDTO.getId()); | 364 | memberDTO.setUserIptvId(_userTvDTO.getId()); |
| 365 | log.info("修改会员对应绑定的大屏账号id, memberId ==>> {} || userTvId ==>> {}", _memberDTO.getId(), _userTvDTO.getId()); | ||
| 188 | this.memberService.updateUserIptvIdById(_memberDTO.getId(), _userTvDTO.getId(), LocalDateTime.now()); | 366 | this.memberService.updateUserIptvIdById(_memberDTO.getId(), _userTvDTO.getId(), LocalDateTime.now()); |
| 189 | //this.updateMember(_memberDTO, memberDTO); | ||
| 190 | 367 | ||
| 191 | } else { | 368 | } else { |
| 192 | 369 | ||
| 193 | throw new EntityNotFoundException(UserTvDTO.class, "id", GlobeExceptionMsg.IPTV_IS_NULL); | 370 | log.error("asyncAppletBind ==>> 小程序绑定大屏异常,大屏账号不存在, platformAccount ==>> {}", platformAccount); |
| 194 | 371 | ||
| 195 | } | 372 | } |
| 373 | |||
| 196 | } | 374 | } |
| 197 | 375 | ||
| 376 | |||
| 198 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | 377 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) |
| 199 | public void asyncUnbind(MemberAndUserTvDTO memberAndUserTvDTO) { | 378 | public void asyncUnbind(MemberAndUserTvDTO memberAndUserTvDTO) { |
| 200 | UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO(); | 379 | UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO(); |
| ... | @@ -202,30 +381,26 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -202,30 +381,26 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 202 | 381 | ||
| 203 | String platformAccount = userTvDTO.getPlatformAccount(); | 382 | String platformAccount = userTvDTO.getPlatformAccount(); |
| 204 | UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | 383 | UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); |
| 205 | 384 | if (Objects.nonNull(_userTvDTO.getId())) { | |
| 206 | _userTvDTO.setPriorityMemberCode(null); | 385 | // |
| 207 | // | 386 | UserTv userTv = new UserTv(); |
| 208 | this.unbindPriorityMemberCode(_userTvDTO); | 387 | userTv.setPriorityMemberCode(userTvDTO.getPriorityMemberCode()); |
| 388 | userTv.setId(_userTvDTO.getId()); | ||
| 389 | userTv.setPlatformAccount(_userTvDTO.getPlatformAccount()); | ||
| 390 | this.userTvService.doUpdatePriorityMemberCode(userTv); | ||
| 391 | } | ||
| 209 | 392 | ||
| 210 | String code = memberDTO.getCode(); | 393 | String code = memberDTO.getCode(); |
| 211 | MemberDTO _memberDTO = this.memberService.findByCode(code); | 394 | MemberDTO _memberDTO = this.memberService.findByCode(code); |
| 212 | this.unbindUserIpTv(_memberDTO); | 395 | if (Objects.nonNull(_memberDTO.getId())) { |
| 213 | 396 | Member member = new Member(); | |
| 214 | } | 397 | member.setId(_memberDTO.getId()); |
| 215 | 398 | member.setUserIptvId(null); | |
| 216 | private void unbindUserIpTv(MemberDTO memberDTO) { | 399 | member.setBindIptvPlatformType(null); |
| 217 | memberDTO.setUserIptvId(null); | 400 | member.setBindIptvTime(null); |
| 218 | memberDTO.setBindIptvPlatformType(null); | 401 | this.memberService.doUpdateMemberUserIptvIdAndBindPlatformTypeAndBingTime(member); |
| 219 | memberDTO.setBindIptvTime(null); | 402 | } |
| 220 | Member member = new Member(); | ||
| 221 | BeanUtils.copyProperties(memberDTO, member); | ||
| 222 | this.memberService.unbindUserIpTv(member); | ||
| 223 | } | ||
| 224 | 403 | ||
| 225 | private void unbindPriorityMemberCode(UserTvDTO userTvDTO) { | ||
| 226 | UserTv userTv = new UserTv(); | ||
| 227 | BeanUtils.copyProperties(userTvDTO, userTv); | ||
| 228 | this.userTvService.unbindPriorityMemberCode(userTv); | ||
| 229 | } | 404 | } |
| 230 | 405 | ||
| 231 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | 406 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) |
| ... | @@ -313,12 +488,42 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -313,12 +488,42 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 313 | } | 488 | } |
| 314 | 489 | ||
| 315 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | 490 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) |
| 491 | public void asyncUserTvChangeMainAccount(UserTvDTO userTvDTO) { | ||
| 492 | log.info("asyncUserTv ==>> userTvDTO ==>> {}", userTvDTO); | ||
| 493 | |||
| 494 | String priorityMemberCode = userTvDTO.getPriorityMemberCode(); | ||
| 495 | if (StringUtils.isBlank(priorityMemberCode)) { | ||
| 496 | log.error("大屏账号设置主会员异常,主会员code不存在"); | ||
| 497 | return; | ||
| 498 | } | ||
| 499 | |||
| 500 | String platformAccount = userTvDTO.getPlatformAccount(); | ||
| 501 | UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
| 502 | log.info("从数据库中获取大屏信息, _userTvDTO ==>> {}", _userTvDTO); | ||
| 503 | if (Objects.isNull(_userTvDTO.getId())) { | ||
| 504 | log.error("大屏账号设置主会员异常,大屏账号不存在"); | ||
| 505 | return; | ||
| 506 | } | ||
| 507 | |||
| 508 | UserTv userTv = new UserTv(); | ||
| 509 | userTv.setId(_userTvDTO.getId()); | ||
| 510 | userTv.setPlatformAccount(platformAccount); | ||
| 511 | userTv.setPriorityMemberCode(priorityMemberCode); | ||
| 512 | log.info("开始修改大屏数据,userTv ==>>{}", userTv); | ||
| 513 | this.userTvService.doUpdatePriorityMemberCode(userTv); | ||
| 514 | } | ||
| 515 | |||
| 516 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | ||
| 316 | public void asyncUserTv(UserTvDTO userTvDTO) { | 517 | public void asyncUserTv(UserTvDTO userTvDTO) { |
| 317 | log.info("asyncUserTv ==>> userTvDTO ==>> {}", userTvDTO); | 518 | log.info("asyncUserTv ==>> userTvDTO ==>> {}", userTvDTO); |
| 318 | String platformAccount = userTvDTO.getPlatformAccount(); | 519 | String platformAccount = userTvDTO.getPlatformAccount(); |
| 319 | UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | 520 | UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); |
| 320 | log.info("db result ==>> _userTvDTO ==>> {}", _userTvDTO); | 521 | log.info("db result ==>> _userTvDTO ==>> {}", _userTvDTO); |
| 321 | this.updateUserTv(_userTvDTO, userTvDTO); | 522 | // this.updateUserTv(_userTvDTO, userTvDTO); |
| 523 | |||
| 524 | UserTv userTv = new UserTv(); | ||
| 525 | BeanUtils.copyProperties(userTvDTO, userTv); | ||
| 526 | this.userTvService.updateUserTvByPlatformAccount(userTv); | ||
| 322 | } | 527 | } |
| 323 | 528 | ||
| 324 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | 529 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) |
| ... | @@ -546,27 +751,4 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -546,27 +751,4 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 546 | BeanUtils.copyProperties(userTvDTO, userTv); | 751 | BeanUtils.copyProperties(userTvDTO, userTv); |
| 547 | this.userTvService.create(userTv); | 752 | this.userTvService.create(userTv); |
| 548 | } | 753 | } |
| 549 | |||
| 550 | private void updateUserTv(UserTvDTO _userTvDTO, UserTvDTO userTvDTO){ | ||
| 551 | userTvDTO.setId(_userTvDTO.getId()); | ||
| 552 | |||
| 553 | Long memberId = _userTvDTO.getMemberId(); | ||
| 554 | if (Objects.isNull(memberId)){ | ||
| 555 | String memberCode = userTvDTO.getMemberCode(); | ||
| 556 | if (StringUtils.isNotBlank(memberCode)) { | ||
| 557 | MemberDTO memberDTO = this.memberService.findByCode(memberCode); | ||
| 558 | userTvDTO.setMemberId(memberDTO.getId()); | ||
| 559 | } | ||
| 560 | } else { | ||
| 561 | userTvDTO.setMemberId(memberId); | ||
| 562 | } | ||
| 563 | |||
| 564 | userTvDTO.setPlatformAccount(_userTvDTO.getPlatformAccount()); | ||
| 565 | userTvDTO.setCreateTime(_userTvDTO.getCreateTime()); | ||
| 566 | |||
| 567 | UserTv userTv = new UserTv(); | ||
| 568 | BeanUtils.copyProperties(userTvDTO, userTv); | ||
| 569 | log.info("updateUserTv ==>> userTv ==>> {}" , userTv); | ||
| 570 | this.userTvService.update(userTv); | ||
| 571 | } | ||
| 572 | } | 754 | } | ... | ... |
| ... | @@ -8,9 +8,12 @@ import com.topdraw.business.module.member.service.MemberService; | ... | @@ -8,9 +8,12 @@ import com.topdraw.business.module.member.service.MemberService; |
| 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 9 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | 9 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; |
| 10 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; | 10 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; |
| 11 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO; | ||
| 11 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | 12 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
| 12 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 13 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| 13 | import com.topdraw.business.process.service.member.MemberOperationService; | 14 | import com.topdraw.business.process.service.member.MemberOperationService; |
| 15 | import lombok.extern.slf4j.Slf4j; | ||
| 16 | import org.apache.commons.lang3.StringUtils; | ||
| 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.scheduling.concurrent.ThreadPoolTaskExecutor; | 19 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| ... | @@ -19,10 +22,12 @@ import org.springframework.util.Assert; | ... | @@ -19,10 +22,12 @@ import org.springframework.util.Assert; |
| 19 | 22 | ||
| 20 | import java.time.LocalDateTime; | 23 | import java.time.LocalDateTime; |
| 21 | import java.time.ZoneOffset; | 24 | import java.time.ZoneOffset; |
| 25 | import java.util.List; | ||
| 22 | import java.util.Objects; | 26 | import java.util.Objects; |
| 23 | 27 | ||
| 24 | @Service | 28 | @Service |
| 25 | //@CacheConfig(cacheNames = "member") | 29 | //@CacheConfig(cacheNames = "member") |
| 30 | @Slf4j | ||
| 26 | public class MemberOperationServiceImpl implements MemberOperationService { | 31 | public class MemberOperationServiceImpl implements MemberOperationService { |
| 27 | 32 | ||
| 28 | @Autowired | 33 | @Autowired |
| ... | @@ -36,14 +41,37 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -36,14 +41,37 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
| 36 | @Autowired | 41 | @Autowired |
| 37 | private ThreadPoolTaskExecutor threadPoolTaskExecutor; | 42 | private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| 38 | 43 | ||
| 39 | public void asyncUpdateMemberVip(MemberDTO memberDTO) { | 44 | public void asyncDoUpdateGroupsBatch(List<Member> resources) { |
| 40 | String code = memberDTO.getCode(); | 45 | this.memberService.asyncDoUpdateGroupsBatch(resources); |
| 41 | MemberDTO memberDTO1 = this.findByCode(code); | 46 | } |
| 42 | memberDTO1.setVip(memberDTO.getVip()); | 47 | |
| 43 | memberDTO1.setVipExpireTime(memberDTO.getVipExpireTime()); | 48 | public void asyncUpdateMemberVipAndVipExpireTime(MemberDTO resource) { |
| 49 | log.info("修改会员vip,参数==>>{}", resource); | ||
| 50 | |||
| 51 | String code = resource.getCode(); | ||
| 52 | if (StringUtils.isBlank(code)) { | ||
| 53 | log.error("修改会员vip失败,参数错误,会员code为空"); | ||
| 54 | return; | ||
| 55 | } | ||
| 56 | |||
| 57 | MemberDTO memberDTO = this.findByCode(code); | ||
| 58 | |||
| 44 | Member member = new Member(); | 59 | Member member = new Member(); |
| 45 | BeanUtils.copyProperties(memberDTO1, member); | 60 | member.setId(memberDTO.getId()); |
| 46 | this.update(member); | 61 | member.setVip(resource.getVip()); |
| 62 | member.setVipExpireTime(resource.getVipExpireTime()); | ||
| 63 | this.memberService.doUpdateMemberVipAndVipExpireTime(member); | ||
| 64 | } | ||
| 65 | |||
| 66 | public void asyncCreateMemberVipHistory(MemberVipHistoryDTO memberVipHistoryDTO) { | ||
| 67 | String memberCode = memberVipHistoryDTO.getMemberCode(); | ||
| 68 | MemberDTO memberDTO = this.findByCode(memberCode); | ||
| 69 | memberVipHistoryDTO.setMemberId(memberDTO.getId()); | ||
| 70 | |||
| 71 | MemberVipHistory memberVipHistory = new MemberVipHistory(); | ||
| 72 | BeanUtils.copyProperties(memberVipHistoryDTO, MemberVipHistory.class); | ||
| 73 | memberVipHistory.setId(null); | ||
| 74 | this.memberVipHistoryService.create(memberVipHistory); | ||
| 47 | } | 75 | } |
| 48 | 76 | ||
| 49 | // @Cacheable(key = "#memberId") | 77 | // @Cacheable(key = "#memberId") |
| ... | @@ -94,8 +122,8 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -94,8 +122,8 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
| 94 | // @CachePut(key = "#resources.id") | 122 | // @CachePut(key = "#resources.id") |
| 95 | @Override | 123 | @Override |
| 96 | public MemberDTO doUpdateMemberPoints(Member resources) { | 124 | public MemberDTO doUpdateMemberPoints(Member resources) { |
| 97 | // return this.memberService.doUpdateMemberPoints(resources); | ||
| 98 | MemberDTO memberDTO = this.findByCode(resources.getCode()); | 125 | MemberDTO memberDTO = this.findByCode(resources.getCode()); |
| 126 | |||
| 99 | Member member = new Member(); | 127 | Member member = new Member(); |
| 100 | member.setId(memberDTO.getId()); | 128 | member.setId(memberDTO.getId()); |
| 101 | member.setPoints(resources.getPoints()); | 129 | member.setPoints(resources.getPoints()); | ... | ... |
| ... | @@ -7,12 +7,12 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | ... | @@ -7,12 +7,12 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 7 | import com.topdraw.business.module.member.service.MemberService; | 7 | import com.topdraw.business.module.member.service.MemberService; |
| 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 9 | import com.topdraw.business.process.service.dto.MemberProfileAndMemberDTO; | 9 | import com.topdraw.business.process.service.dto.MemberProfileAndMemberDTO; |
| 10 | import com.topdraw.business.process.service.member.MemberOperationService; | ||
| 11 | import com.topdraw.business.process.service.member.MemberProfileOperationService; | 10 | import com.topdraw.business.process.service.member.MemberProfileOperationService; |
| 11 | import lombok.extern.slf4j.Slf4j; | ||
| 12 | import org.apache.commons.lang3.StringUtils; | ||
| 12 | import org.springframework.beans.BeanUtils; | 13 | import org.springframework.beans.BeanUtils; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
| 15 | import org.springframework.util.StringUtils; | ||
| 16 | 16 | ||
| 17 | import java.util.Objects; | 17 | import java.util.Objects; |
| 18 | 18 | ||
| ... | @@ -26,83 +26,100 @@ import java.util.Objects; | ... | @@ -26,83 +26,100 @@ import java.util.Objects; |
| 26 | * @since : modified in 2022/3/20 17:34 | 26 | * @since : modified in 2022/3/20 17:34 |
| 27 | */ | 27 | */ |
| 28 | @Service | 28 | @Service |
| 29 | @Slf4j | ||
| 29 | public class MemberProfileOperationServiceImpl implements MemberProfileOperationService { | 30 | public class MemberProfileOperationServiceImpl implements MemberProfileOperationService { |
| 30 | 31 | ||
| 31 | @Autowired | 32 | @Autowired |
| 32 | private MemberProfileService memberProfileService; | ||
| 33 | @Autowired | ||
| 34 | private MemberOperationService memberOperationService; | ||
| 35 | @Autowired | ||
| 36 | private MemberService memberService; | 33 | private MemberService memberService; |
| 34 | @Autowired | ||
| 35 | private MemberProfileService memberProfileService; | ||
| 36 | |||
| 37 | /** | ||
| 38 | * | ||
| 39 | * @param resource | ||
| 40 | */ | ||
| 41 | public void asyncCreateMemberProfileAndSyncMember(MemberProfileDTO resource) { | ||
| 42 | log.info("创建会员属性,参数 ==>> {}", resource); | ||
| 43 | String memberCode = resource.getMemberCode(); | ||
| 44 | if (StringUtils.isBlank(memberCode)) { | ||
| 45 | log.error("创建会员属性失败,会员code不存在"); | ||
| 46 | return; | ||
| 47 | } | ||
| 37 | 48 | ||
| 38 | public void asyncCreateMemberProfile(MemberProfileDTO memberProfileDTO) { | ||
| 39 | String memberCode = memberProfileDTO.getMemberCode(); | ||
| 40 | MemberDTO memberDTO = this.memberService.findByCode(memberCode); | 49 | MemberDTO memberDTO = this.memberService.findByCode(memberCode); |
| 50 | if (Objects.isNull(memberDTO.getId())) { | ||
| 51 | log.error("创建会员属性失败,会员信息不存在 ==>> memberCode ==>> {}", memberCode); | ||
| 52 | return; | ||
| 53 | } | ||
| 54 | |||
| 41 | Long memberId = memberDTO.getId(); | 55 | Long memberId = memberDTO.getId(); |
| 42 | MemberProfileDTO _memberProfileDTO = this.memberProfileService.findByMemberId(memberId); | 56 | MemberProfileDTO _memberProfileDTO = this.memberProfileService.findByMemberId(memberId); |
| 57 | |||
| 43 | if (Objects.isNull(_memberProfileDTO.getId())) { | 58 | if (Objects.isNull(_memberProfileDTO.getId())) { |
| 44 | memberProfileDTO.setMemberId(memberId); | ||
| 45 | this.createMemberProfileAndSyncMember(memberProfileDTO, memberDTO); | ||
| 46 | } | ||
| 47 | 59 | ||
| 48 | } | 60 | MemberProfile memberProfile = new MemberProfile(); |
| 61 | BeanUtils.copyProperties(resource, memberProfile); | ||
| 62 | memberProfile.setId(null); | ||
| 63 | memberProfile.setMemberId(memberId); | ||
| 64 | this.memberProfileService.createDefault(memberProfile); | ||
| 49 | 65 | ||
| 50 | private void createMemberProfileAndSyncMember(MemberProfileDTO memberProfileDTO, MemberDTO memberDTO) { | 66 | Member member = new Member(); |
| 51 | this.createMemberProfile(memberProfileDTO); | 67 | member.setId(memberDTO.getId()); |
| 52 | this.syncMember(memberProfileDTO, memberDTO); | 68 | member.setCode(memberDTO.getCode()); |
| 53 | } | 69 | member.setAvatarUrl(memberProfile.getAvatarUrl()); |
| 70 | member.setNickname(memberProfile.getRealname()); | ||
| 71 | member.setGender(memberProfile.getGender()); | ||
| 72 | this.memberService.doUpdateMemberAvatarUrlAndNicknameAndGender(member); | ||
| 73 | } | ||
| 54 | 74 | ||
| 55 | private void syncMember(MemberProfileDTO memberProfileDTO, MemberDTO memberDTO) { | ||
| 56 | memberDTO.setAvatarUrl(memberProfileDTO.getAvatarUrl()); | ||
| 57 | memberDTO.setNickname(memberProfileDTO.getRealname()); | ||
| 58 | memberDTO.setGender(memberProfileDTO.getGender()); | ||
| 59 | Member member = new Member(); | ||
| 60 | BeanUtils.copyProperties(memberDTO, member); | ||
| 61 | this.memberService.update(member); | ||
| 62 | } | 75 | } |
| 63 | 76 | ||
| 64 | private void createMemberProfile(MemberProfileDTO memberProfileDTO) { | ||
| 65 | MemberProfile memberProfile = new MemberProfile(); | ||
| 66 | BeanUtils.copyProperties(memberProfileDTO, memberProfile); | ||
| 67 | this.memberProfileService.createDefault(memberProfile); | ||
| 68 | } | ||
| 69 | |||
| 70 | public MemberProfileDTO asyncMemberProfile(MemberProfileDTO memberProfileDTO){ | ||
| 71 | String memberCode = memberProfileDTO.getMemberCode(); | ||
| 72 | MemberDTO memberDTO = this.memberService.findByCode(memberCode); | ||
| 73 | Long memberId = memberDTO.getId(); | ||
| 74 | MemberProfileDTO _memberProfileDTO = this.memberProfileService.findByMemberId(memberId); | ||
| 75 | memberProfileDTO.setId(_memberProfileDTO.getId()); | ||
| 76 | memberProfileDTO.setMemberId(memberId); | ||
| 77 | return this.updateMemberProfile(memberProfileDTO); | ||
| 78 | } | ||
| 79 | |||
| 80 | private MemberProfileDTO updateMemberProfile(MemberProfileDTO memberProfileDTO) { | ||
| 81 | MemberProfile memberProfile = new MemberProfile(); | ||
| 82 | BeanUtils.copyProperties(memberProfileDTO, memberProfile); | ||
| 83 | return this.memberProfileService.update(memberProfile); | ||
| 84 | } | ||
| 85 | 77 | ||
| 78 | /** | ||
| 79 | * | ||
| 80 | * @param resources | ||
| 81 | */ | ||
| 82 | public void asyncUpdateMemberProfileAndSyncMember(MemberProfileAndMemberDTO resources) { | ||
| 83 | log.info("修改会员属性,参数 ==>> {}", resources); | ||
| 86 | 84 | ||
| 87 | public void asyncMemberProfileAndMember(MemberProfileAndMemberDTO resources) { | ||
| 88 | MemberProfileDTO memberProfileDTO = resources.getMemberProfileDTO(); | 85 | MemberProfileDTO memberProfileDTO = resources.getMemberProfileDTO(); |
| 89 | MemberProfileDTO _memberProfileDTO = this.asyncMemberProfile(memberProfileDTO); | 86 | if (Objects.isNull(memberProfileDTO)) { |
| 87 | log.error("修改会员属性异常, 会员属性参数为空"); | ||
| 88 | return; | ||
| 89 | } | ||
| 90 | 90 | ||
| 91 | MemberDTO memberDTO = resources.getMemberDTO(); | 91 | MemberDTO memberDTO = resources.getMemberDTO(); |
| 92 | if (Objects.isNull(memberDTO)) { | ||
| 93 | log.error("修改会员属性异常, 会员信息为空"); | ||
| 94 | return; | ||
| 95 | } | ||
| 96 | |||
| 97 | MemberProfileDTO _memberProfileDTO = this.asyncMemberProfile(memberProfileDTO); | ||
| 92 | String code = memberDTO.getCode(); | 98 | String code = memberDTO.getCode(); |
| 93 | if (!StringUtils.isEmpty(code)) { | 99 | if (!StringUtils.isEmpty(code)) { |
| 94 | MemberDTO memberDTO1 = this.memberService.findByCode(code); | 100 | MemberDTO memberDTO1 = this.memberService.findByCode(code); |
| 95 | 101 | ||
| 96 | Member member = new Member(); | 102 | Member member = new Member(); |
| 97 | BeanUtils.copyProperties(memberDTO1, member); | 103 | member.setId(memberDTO1.getId()); |
| 98 | |||
| 99 | member.setNickname(_memberProfileDTO.getRealname()); | 104 | member.setNickname(_memberProfileDTO.getRealname()); |
| 100 | member.setBirthday(_memberProfileDTO.getBirthday()); | 105 | member.setBirthday(_memberProfileDTO.getBirthday()); |
| 101 | member.setGender(_memberProfileDTO.getGender()); | 106 | member.setGender(_memberProfileDTO.getGender()); |
| 102 | this.memberService.update(member); | 107 | this.memberService.doUpdateMemberAvatarUrlAndNicknameAndGender(member); |
| 103 | } | 108 | } |
| 109 | } | ||
| 110 | |||
| 111 | public MemberProfileDTO asyncMemberProfile(MemberProfileDTO memberProfileDTO){ | ||
| 112 | String memberCode = memberProfileDTO.getMemberCode(); | ||
| 113 | MemberDTO memberDTO = this.memberService.findByCode(memberCode); | ||
| 114 | Long memberId = memberDTO.getId(); | ||
| 104 | 115 | ||
| 116 | MemberProfileDTO _memberProfileDTO = this.memberProfileService.findByMemberId(memberId); | ||
| 117 | memberProfileDTO.setId(_memberProfileDTO.getId()); | ||
| 118 | memberProfileDTO.setMemberId(memberId); | ||
| 105 | 119 | ||
| 120 | MemberProfile memberProfile = new MemberProfile(); | ||
| 121 | BeanUtils.copyProperties(memberProfileDTO, memberProfile); | ||
| 122 | return this.memberProfileService.update(memberProfile); | ||
| 106 | } | 123 | } |
| 107 | 124 | ||
| 108 | } | 125 | } | ... | ... |
| ... | @@ -13,12 +13,12 @@ import javax.naming.ConfigurationException; | ... | @@ -13,12 +13,12 @@ import javax.naming.ConfigurationException; |
| 13 | import java.util.List; | 13 | import java.util.List; |
| 14 | import java.util.Map; | 14 | import java.util.Map; |
| 15 | 15 | ||
| 16 | @Component | 16 | //@Component |
| 17 | public class RabbitMqBindingConfig { | 17 | public class RabbitMqBindingConfig { |
| 18 | 18 | ||
| 19 | /**************************************************数据源选择*************************************************************/ | 19 | /**************************************************数据源选择*************************************************************/ |
| 20 | 20 | ||
| 21 | @Autowired | 21 | /*@Autowired |
| 22 | private RabbitMqSourceConfig rabbitMqSourceConfig; | 22 | private RabbitMqSourceConfig rabbitMqSourceConfig; |
| 23 | @Autowired | 23 | @Autowired |
| 24 | private RabbitMqCustomConfig rabbitMqCustomConfig; | 24 | private RabbitMqCustomConfig rabbitMqCustomConfig; |
| ... | @@ -33,8 +33,6 @@ public class RabbitMqBindingConfig { | ... | @@ -33,8 +33,6 @@ public class RabbitMqBindingConfig { |
| 33 | @PostConstruct | 33 | @PostConstruct |
| 34 | public void initBinding() throws ConfigurationException { | 34 | public void initBinding() throws ConfigurationException { |
| 35 | 35 | ||
| 36 | // String source = rabbitMqSourceConfig.getActiveSource(); | ||
| 37 | |||
| 38 | List<Map<String, String>> list = rabbitMqCustomConfig.getList(); | 36 | List<Map<String, String>> list = rabbitMqCustomConfig.getList(); |
| 39 | if (CollectionUtils.isNotEmpty(list)) { | 37 | if (CollectionUtils.isNotEmpty(list)) { |
| 40 | 38 | ||
| ... | @@ -86,15 +84,7 @@ public class RabbitMqBindingConfig { | ... | @@ -86,15 +84,7 @@ public class RabbitMqBindingConfig { |
| 86 | this.serviceRabbitAdmin.declareQueue(queue_); | 84 | this.serviceRabbitAdmin.declareQueue(queue_); |
| 87 | this.serviceRabbitAdmin.declareBinding(binding_); | 85 | this.serviceRabbitAdmin.declareBinding(binding_); |
| 88 | break; | 86 | break; |
| 89 | /* case "service,management": | ||
| 90 | this.serviceRabbitAdmin.declareExchange(exchange_); | ||
| 91 | this.serviceRabbitAdmin.declareQueue(queue_); | ||
| 92 | this.serviceRabbitAdmin.declareBinding(binding_); | ||
| 93 | 87 | ||
| 94 | this.managementRabbitAdmin.declareExchange(exchange_); | ||
| 95 | this.managementRabbitAdmin.declareQueue(queue_); | ||
| 96 | this.managementRabbitAdmin.declareBinding(binding_); | ||
| 97 | break;*/ | ||
| 98 | default: | 88 | default: |
| 99 | 89 | ||
| 100 | break; | 90 | break; |
| ... | @@ -104,6 +94,6 @@ public class RabbitMqBindingConfig { | ... | @@ -104,6 +94,6 @@ public class RabbitMqBindingConfig { |
| 104 | 94 | ||
| 105 | } | 95 | } |
| 106 | 96 | ||
| 107 | } | 97 | }*/ |
| 108 | 98 | ||
| 109 | } | 99 | } | ... | ... |
| 1 | package com.topdraw.config; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import org.apache.commons.lang3.StringUtils; | ||
| 5 | import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| 6 | import org.springframework.context.annotation.Configuration; | ||
| 7 | import org.springframework.context.annotation.Lazy; | ||
| 8 | |||
| 9 | import java.util.Map; | ||
| 10 | import java.util.Objects; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @author : | ||
| 14 | * @description: | ||
| 15 | * @function : | ||
| 16 | * @date :Created in 2022/5/12 12:37 | ||
| 17 | * @version: : | ||
| 18 | * @modified By: | ||
| 19 | * @since : modified in 2022/5/12 12:37 | ||
| 20 | */ | ||
| 21 | @Data | ||
| 22 | @Configuration | ||
| 23 | @ConfigurationProperties(prefix = "spring.rabbitmq", ignoreInvalidFields = true) | ||
| 24 | public class RabbitMqConfig { | ||
| 25 | |||
| 26 | @Lazy | ||
| 27 | private Map<String, String> uce; | ||
| 28 | @Lazy | ||
| 29 | private Map<String, String> memberInfo; | ||
| 30 | @Lazy | ||
| 31 | private Map<String, String> eventBus; | ||
| 32 | @Lazy | ||
| 33 | private Map<String, String> event; | ||
| 34 | @Lazy | ||
| 35 | private Map<String, String> viewRecord; | ||
| 36 | @Lazy | ||
| 37 | private Map<String, String> addCollction; | ||
| 38 | @Lazy | ||
| 39 | private Map<String, String> deleteCollction; | ||
| 40 | @Lazy | ||
| 41 | private Map<String, String> deleteAllCollction; | ||
| 42 | @Lazy | ||
| 43 | private Map<String, String> ucgCollection; | ||
| 44 | @Lazy | ||
| 45 | private Map<String, String> wechat; | ||
| 46 | @Lazy | ||
| 47 | private Map<String, String> growthReport; | ||
| 48 | |||
| 49 | /** | ||
| 50 | * uce | ||
| 51 | * @return | ||
| 52 | */ | ||
| 53 | public String getGrowthReportQueue() { | ||
| 54 | if (Objects.isNull(growthReport)) { | ||
| 55 | return "growthReport.queue"; | ||
| 56 | } | ||
| 57 | String queue = this.growthReport.get("queue"); | ||
| 58 | return StringUtils.isBlank(queue) ? "growthReport.queue" : queue; | ||
| 59 | } | ||
| 60 | |||
| 61 | /** | ||
| 62 | * uce | ||
| 63 | * @return | ||
| 64 | */ | ||
| 65 | public String getUceQueue() { | ||
| 66 | if (Objects.isNull(uce)) { | ||
| 67 | return "uce.queue"; | ||
| 68 | } | ||
| 69 | String queue = this.uce.get("queue"); | ||
| 70 | return StringUtils.isBlank(queue) ? "uce.queue" : queue; | ||
| 71 | } | ||
| 72 | |||
| 73 | /** | ||
| 74 | * memberInfo | ||
| 75 | * @return | ||
| 76 | */ | ||
| 77 | public String getMemberInfoQueue() { | ||
| 78 | if (Objects.isNull(memberInfo)) { | ||
| 79 | return "queue.MemberInfoSync"; | ||
| 80 | } | ||
| 81 | String queue = this.memberInfo.get("queue"); | ||
| 82 | return StringUtils.isBlank(queue) ? "queue.MemberInfoSync" : queue; | ||
| 83 | } | ||
| 84 | |||
| 85 | /** | ||
| 86 | * uce | ||
| 87 | * @return | ||
| 88 | */ | ||
| 89 | public String getEventBusQueue() { | ||
| 90 | if (Objects.isNull(eventBus)) { | ||
| 91 | return "uc.eventbus"; | ||
| 92 | } | ||
| 93 | String queue = this.eventBus.get("queue"); | ||
| 94 | return StringUtils.isBlank(queue) ? "uc.eventbus" : queue; | ||
| 95 | } | ||
| 96 | |||
| 97 | /** | ||
| 98 | * uce | ||
| 99 | * @return | ||
| 100 | */ | ||
| 101 | public String getUcgEventQueue() { | ||
| 102 | if (event != null) { | ||
| 103 | String queue = this.event.get("queue"); | ||
| 104 | return StringUtils.isBlank(queue) ? "event.queue" : queue; | ||
| 105 | } | ||
| 106 | return "event.queue"; | ||
| 107 | } | ||
| 108 | |||
| 109 | /** | ||
| 110 | * memberInfo | ||
| 111 | * @return | ||
| 112 | */ | ||
| 113 | public String getViewRecordQueue() { | ||
| 114 | if (viewRecord != null) { | ||
| 115 | String queue = this.viewRecord.get("queue"); | ||
| 116 | return StringUtils.isBlank(queue) ? "viewRecord.queue" : queue; | ||
| 117 | } | ||
| 118 | return "viewRecord.queue"; | ||
| 119 | } | ||
| 120 | |||
| 121 | /** | ||
| 122 | * uce | ||
| 123 | * @return | ||
| 124 | */ | ||
| 125 | public String getUcgCollectionQueueAdd() { | ||
| 126 | if (addCollction != null) { | ||
| 127 | String queue = this.addCollction.get("queue"); | ||
| 128 | return StringUtils.isBlank(queue) ? "queue.collection.add" : queue; | ||
| 129 | } | ||
| 130 | return "queue.collection.add"; | ||
| 131 | } | ||
| 132 | |||
| 133 | /** | ||
| 134 | * memberInfo | ||
| 135 | * @return | ||
| 136 | */ | ||
| 137 | public String getUcgCollectionQueueDelete() { | ||
| 138 | if (deleteCollction != null) { | ||
| 139 | String queue = this.deleteCollction.get("queue"); | ||
| 140 | return StringUtils.isBlank(queue) ? "queue.collection.delete" : queue; | ||
| 141 | } | ||
| 142 | return "queue.collection.delete"; | ||
| 143 | } | ||
| 144 | |||
| 145 | /** | ||
| 146 | * uce | ||
| 147 | * @return | ||
| 148 | */ | ||
| 149 | public String getUcgCollectionQueueDeleteAll() { | ||
| 150 | if (deleteAllCollction != null) { | ||
| 151 | String queue = this.deleteAllCollction.get("queue"); | ||
| 152 | return StringUtils.isBlank(queue) ? "queue.collection.deleteall" : queue; | ||
| 153 | } | ||
| 154 | return "queue.collection.deleteall"; | ||
| 155 | } | ||
| 156 | |||
| 157 | |||
| 158 | public String getUcgCollectionQueue() { | ||
| 159 | if (ucgCollection != null) { | ||
| 160 | String queue = this.ucgCollection.get("queue"); | ||
| 161 | return StringUtils.isBlank(queue) ? "collection.queue" : queue; | ||
| 162 | } | ||
| 163 | return "collection.queue"; | ||
| 164 | } | ||
| 165 | |||
| 166 | /** | ||
| 167 | * memberInfo | ||
| 168 | * @return | ||
| 169 | */ | ||
| 170 | public String getWechatQueue() { | ||
| 171 | if (wechat != null) { | ||
| 172 | String queue = this.wechat.get("queue"); | ||
| 173 | return StringUtils.isBlank(queue) ? "weixin.subOrUnSub.queue" : queue; | ||
| 174 | } | ||
| 175 | return "weixin.subOrUnSub.queue"; | ||
| 176 | } | ||
| 177 | } |
| ... | @@ -9,13 +9,33 @@ import java.util.List; | ... | @@ -9,13 +9,33 @@ import java.util.List; |
| 9 | import java.util.Map; | 9 | import java.util.Map; |
| 10 | 10 | ||
| 11 | @Data | 11 | @Data |
| 12 | @Configuration | 12 | //@Configuration |
| 13 | @ConfigurationProperties(prefix = "service.mq") | 13 | //@ConfigurationProperties(prefix = "service.mq") |
| 14 | public class RabbitMqCustomConfig { | 14 | public class RabbitMqCustomConfig { |
| 15 | 15 | ||
| 16 | private List<Map<String, String>> list; | 16 | private List<Map<String, String>> list; |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | * growthReport | ||
| 20 | * @return | ||
| 21 | */ | ||
| 22 | public Map<String, String> ucgGrowthReportInfo() { | ||
| 23 | |||
| 24 | if (CollectionUtils.isNotEmpty(list)) { | ||
| 25 | |||
| 26 | for (Map<String, String> map : list) { | ||
| 27 | String type = map.get("source"); | ||
| 28 | if (type.equalsIgnoreCase("growthReport")) { | ||
| 29 | return map; | ||
| 30 | } | ||
| 31 | } | ||
| 32 | |||
| 33 | } | ||
| 34 | |||
| 35 | return null; | ||
| 36 | } | ||
| 37 | |||
| 38 | /** | ||
| 19 | * viewRecord | 39 | * viewRecord |
| 20 | * @return | 40 | * @return |
| 21 | */ | 41 | */ | ... | ... |
| ... | @@ -18,8 +18,8 @@ import java.util.Map; | ... | @@ -18,8 +18,8 @@ import java.util.Map; |
| 18 | * @since : modified in 2022/5/12 12:37 | 18 | * @since : modified in 2022/5/12 12:37 |
| 19 | */ | 19 | */ |
| 20 | @Data | 20 | @Data |
| 21 | @Configuration | 21 | //@Configuration |
| 22 | @ConfigurationProperties(prefix = "service.mq.error.logs") | 22 | //@ConfigurationProperties(prefix = "service.mq.error.logs") |
| 23 | public class RabbitMqErrorLogConfig { | 23 | public class RabbitMqErrorLogConfig { |
| 24 | 24 | ||
| 25 | private List<Map<String, String>> list; | 25 | private List<Map<String, String>> list; | ... | ... |
| ... | @@ -21,10 +21,10 @@ import java.util.Map; | ... | @@ -21,10 +21,10 @@ import java.util.Map; |
| 21 | import java.util.Objects; | 21 | import java.util.Objects; |
| 22 | 22 | ||
| 23 | @Data | 23 | @Data |
| 24 | @Configuration | 24 | //@Configuration |
| 25 | public class RabbitMqSourceConfig { | 25 | public class RabbitMqSourceConfig { |
| 26 | 26 | ||
| 27 | @Value("${mutil-mq.service.host}") | 27 | /*@Value("${mutil-mq.service.host}") |
| 28 | private String serviceHost; | 28 | private String serviceHost; |
| 29 | @Value("${mutil-mq.service.port}") | 29 | @Value("${mutil-mq.service.port}") |
| 30 | private Integer servicePort; | 30 | private Integer servicePort; |
| ... | @@ -119,13 +119,13 @@ public class RabbitMqSourceConfig { | ... | @@ -119,13 +119,13 @@ public class RabbitMqSourceConfig { |
| 119 | RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory); | 119 | RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory); |
| 120 | rabbitAdmin.setAutoStartup(true); | 120 | rabbitAdmin.setAutoStartup(true); |
| 121 | return rabbitAdmin; | 121 | return rabbitAdmin; |
| 122 | } | 122 | }*/ |
| 123 | 123 | ||
| 124 | 124 | ||
| 125 | /**************************************************数据源*************************************************************/ | 125 | /**************************************************数据源*************************************************************/ |
| 126 | 126 | ||
| 127 | 127 | ||
| 128 | /*@Value("${service.platform}") | 128 | /* @Value("${service.platform}") |
| 129 | private String platform; | 129 | private String platform; |
| 130 | @Value("${service.active}") | 130 | @Value("${service.active}") |
| 131 | private String active; | 131 | private String active; |
| ... | @@ -143,7 +143,7 @@ public class RabbitMqSourceConfig { | ... | @@ -143,7 +143,7 @@ public class RabbitMqSourceConfig { |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | return active; | 145 | return active; |
| 146 | }*/ | 146 | } |
| 147 | 147 | ||
| 148 | private String chargeSource(String active) { | 148 | private String chargeSource(String active) { |
| 149 | 149 | ||
| ... | @@ -156,10 +156,57 @@ public class RabbitMqSourceConfig { | ... | @@ -156,10 +156,57 @@ public class RabbitMqSourceConfig { |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | return null; | 158 | return null; |
| 159 | } | 159 | }*/ |
| 160 | 160 | ||
| 161 | /**************************************************uc-getaway 2 uc-consumer*************************************************************/ | 161 | /**************************************************uc-getaway 2 uc-consumer*************************************************************/ |
| 162 | 162 | ||
| 163 | |||
| 164 | |||
| 165 | /*@Value("#{rabbitMqCustomConfig.ucgGrowthReportInfo()}") | ||
| 166 | private Map<String, String> ucgGrowthReportInfo; | ||
| 167 | |||
| 168 | public static final String GROWTH_REPORT_EXCHANGE = "growthReport.exchange"; | ||
| 169 | public static final String GROWTH_REPORT_QUEUE = "growthReport.queue"; | ||
| 170 | |||
| 171 | public String getGrowthReportQueue(){ | ||
| 172 | if (Objects.nonNull(ucgGrowthReportInfo)) { | ||
| 173 | if (MapUtils.isNotEmpty(ucgGrowthReportInfo)) { | ||
| 174 | String queue = ucgGrowthReportInfo.get("queue"); | ||
| 175 | return queue; | ||
| 176 | } | ||
| 177 | } | ||
| 178 | |||
| 179 | return GROWTH_REPORT_QUEUE; | ||
| 180 | } | ||
| 181 | |||
| 182 | public String getGrowthReportSource(){ | ||
| 183 | if (Objects.nonNull(ucgGrowthReportInfo)) { | ||
| 184 | if (MapUtils.isNotEmpty(ucgGrowthReportInfo)) { | ||
| 185 | String source = ucgGrowthReportInfo.get("active"); | ||
| 186 | if (StringUtils.isNotBlank(source)) { | ||
| 187 | return this.chargeSource(source); | ||
| 188 | } else { | ||
| 189 | return SERVICE_; | ||
| 190 | } | ||
| 191 | } | ||
| 192 | } | ||
| 193 | |||
| 194 | return SERVICE_; | ||
| 195 | } | ||
| 196 | |||
| 197 | public String getGrowthReportStartUp(){ | ||
| 198 | if (Objects.nonNull(ucgGrowthReportInfo)) { | ||
| 199 | if (MapUtils.isNotEmpty(ucgGrowthReportInfo)) { | ||
| 200 | String source = ucgGrowthReportInfo.get("active"); | ||
| 201 | if (StringUtils.isNotBlank(source)) { | ||
| 202 | return "true"; | ||
| 203 | } | ||
| 204 | } | ||
| 205 | } | ||
| 206 | |||
| 207 | return "false"; | ||
| 208 | } | ||
| 209 | |||
| 163 | public static final String EVENT_EXCHANGE = "event.exchange"; | 210 | public static final String EVENT_EXCHANGE = "event.exchange"; |
| 164 | public static final String EVENT_QUEUE = "event.queue"; | 211 | public static final String EVENT_QUEUE = "event.queue"; |
| 165 | 212 | ||
| ... | @@ -205,10 +252,6 @@ public class RabbitMqSourceConfig { | ... | @@ -205,10 +252,6 @@ public class RabbitMqSourceConfig { |
| 205 | return "false"; | 252 | return "false"; |
| 206 | } | 253 | } |
| 207 | 254 | ||
| 208 | /* public static final String COLLECTION_DELETE_ALL_QUEUE = "queue.collection.deleteall"; | ||
| 209 | public static final String COLLECTION_ADD_QUEUE = "queue.collection.add"; | ||
| 210 | public static final String COLLECTION_DELETE_QUEUE = "queue.collection.delete";*/ | ||
| 211 | |||
| 212 | public static final String COLLECTION_EXCHANGE = "collection.exchange"; | 255 | public static final String COLLECTION_EXCHANGE = "collection.exchange"; |
| 213 | public static final String COLLECTION_QUEUE = "collection.queue"; | 256 | public static final String COLLECTION_QUEUE = "collection.queue"; |
| 214 | 257 | ||
| ... | @@ -309,11 +352,11 @@ public class RabbitMqSourceConfig { | ... | @@ -309,11 +352,11 @@ public class RabbitMqSourceConfig { |
| 309 | } | 352 | } |
| 310 | 353 | ||
| 311 | return "false"; | 354 | return "false"; |
| 312 | } | 355 | }*/ |
| 313 | 356 | ||
| 314 | /**************************************************uc-engine 2 uc-consumer*************************************************************/ | 357 | /**************************************************uc-engine 2 uc-consumer*************************************************************/ |
| 315 | 358 | ||
| 316 | public static final String UCE_EXCHANGE = "uce.exchange"; | 359 | /*public static final String UCE_EXCHANGE = "uce.exchange"; |
| 317 | public static final String UCE_QUEUE = "uce.queue"; | 360 | public static final String UCE_QUEUE = "uce.queue"; |
| 318 | 361 | ||
| 319 | @Value("#{rabbitMqCustomConfig.getUceInfo()}") | 362 | @Value("#{rabbitMqCustomConfig.getUceInfo()}") |
| ... | @@ -360,12 +403,13 @@ public class RabbitMqSourceConfig { | ... | @@ -360,12 +403,13 @@ public class RabbitMqSourceConfig { |
| 360 | 403 | ||
| 361 | 404 | ||
| 362 | 405 | ||
| 406 | |||
| 363 | public String getMemberInfoAsyncQueue(){ | 407 | public String getMemberInfoAsyncQueue(){ |
| 364 | return "queue.MemberInfoSync"; | 408 | return "queue.MemberInfoSync"; |
| 365 | } | 409 | }*/ |
| 366 | 410 | ||
| 367 | /**************************************************eventBus*************************************************************/ | 411 | /**************************************************eventBus*************************************************************/ |
| 368 | public static final String UC_EVENTBUS_EXCHANGE = "uc.eventbus"; | 412 | /*public static final String UC_EVENTBUS_EXCHANGE = "uc.eventbus"; |
| 369 | public static final String UC_EVENTBUS_KEY = "uc.eventbus.*.topic"; | 413 | public static final String UC_EVENTBUS_KEY = "uc.eventbus.*.topic"; |
| 370 | public static final String UC_EVENTBUS_QUEUE = "uc.eventbus"; | 414 | public static final String UC_EVENTBUS_QUEUE = "uc.eventbus"; |
| 371 | 415 | ||
| ... | @@ -407,11 +451,11 @@ public class RabbitMqSourceConfig { | ... | @@ -407,11 +451,11 @@ public class RabbitMqSourceConfig { |
| 407 | } | 451 | } |
| 408 | } | 452 | } |
| 409 | return "false"; | 453 | return "false"; |
| 410 | } | 454 | }*/ |
| 411 | 455 | ||
| 412 | /**************************************************wechat*************************************************************/ | 456 | /**************************************************wechat*************************************************************/ |
| 413 | 457 | ||
| 414 | public static final String WEIXIN_EXCHANGE = "weixin.subOrUnSub.direct"; | 458 | /*public static final String WEIXIN_EXCHANGE = "weixin.subOrUnSub.direct"; |
| 415 | public static final String WEIXIN_SUBORUNSUB_QUEUE = "weixin.subOrUnSub.queue"; | 459 | public static final String WEIXIN_SUBORUNSUB_QUEUE = "weixin.subOrUnSub.queue"; |
| 416 | 460 | ||
| 417 | @Value("#{rabbitMqCustomConfig.getWechatInfo()}") | 461 | @Value("#{rabbitMqCustomConfig.getWechatInfo()}") |
| ... | @@ -453,5 +497,5 @@ public class RabbitMqSourceConfig { | ... | @@ -453,5 +497,5 @@ public class RabbitMqSourceConfig { |
| 453 | } | 497 | } |
| 454 | 498 | ||
| 455 | return "false"; | 499 | return "false"; |
| 456 | } | 500 | }*/ |
| 457 | } | 501 | } | ... | ... |
| ... | @@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; | ... | @@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; |
| 9 | import org.apache.commons.collections4.MapUtils; | 9 | import org.apache.commons.collections4.MapUtils; |
| 10 | import org.springframework.amqp.core.Message; | 10 | import org.springframework.amqp.core.Message; |
| 11 | import org.springframework.amqp.rabbit.annotation.*; | 11 | import org.springframework.amqp.rabbit.annotation.*; |
| 12 | import org.springframework.amqp.rabbit.core.RabbitTemplate; | ||
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.beans.factory.annotation.Value; | 14 | import org.springframework.beans.factory.annotation.Value; |
| 14 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| ... | @@ -28,18 +29,25 @@ public class UcEngineManagement2IptvConsumer { | ... | @@ -28,18 +29,25 @@ public class UcEngineManagement2IptvConsumer { |
| 28 | @Autowired | 29 | @Autowired |
| 29 | RestTemplateClient restTemplateClient; | 30 | RestTemplateClient restTemplateClient; |
| 30 | 31 | ||
| 31 | @Value("#{rabbitMqErrorLogConfig.getUceError()}") | 32 | @Autowired |
| 32 | private Map<String, String> error; | 33 | private RabbitTemplate rabbitTemplate; |
| 33 | 34 | ||
| 34 | @RabbitHandler | 35 | // @Value("#{rabbitMqErrorLogConfig.getUceError()}") |
| 36 | // private Map<String, String> error; | ||
| 37 | |||
| 38 | /*@RabbitHandler | ||
| 35 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getMemberInfoAsyncQueue()}", | 39 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getMemberInfoAsyncQueue()}", |
| 36 | containerFactory = "#{rabbitMqSourceConfig.getUceSource()}", | 40 | //containerFactory = "#{rabbitMqSourceConfig.getUceSource()}", |
| 37 | autoStartup = "#{rabbitMqSourceConfig.getUceStartUp()}", | 41 | // autoStartup = "#{rabbitMqSourceConfig.getUceStartUp()}", |
| 42 | ackMode = "AUTO")*/ | ||
| 43 | @RabbitHandler | ||
| 44 | @RabbitListener(queues = "#{rabbitMqConfig.getMemberInfoQueue()}", | ||
| 38 | ackMode = "AUTO") | 45 | ackMode = "AUTO") |
| 39 | public void ucEventConsumer2(Channel channel, Message message, String content) throws IOException { | 46 | public void memberInfoConsumer(Channel channel, Message message, String content) throws IOException { |
| 40 | log.info(" receive MemberInfoAsync msg , content is : {} ", content); | 47 | log.info(" receive MemberInfoAsync msg , content is : {} ", content); |
| 41 | 48 | ||
| 42 | try { | 49 | try { |
| 50 | |||
| 43 | TableOperationMsg tableOperationMsg = this.parseContent(content); | 51 | TableOperationMsg tableOperationMsg = this.parseContent(content); |
| 44 | 52 | ||
| 45 | autoUser.route(tableOperationMsg); | 53 | autoUser.route(tableOperationMsg); |
| ... | @@ -47,10 +55,10 @@ public class UcEngineManagement2IptvConsumer { | ... | @@ -47,10 +55,10 @@ public class UcEngineManagement2IptvConsumer { |
| 47 | // channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); | 55 | // channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); |
| 48 | 56 | ||
| 49 | } catch (Exception e) { | 57 | } catch (Exception e) { |
| 58 | log.error("消费uc-engine消息失败, cause ==>> [memberInfoConsumer#{}]", e.getMessage()); | ||
| 59 | // channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | ||
| 50 | 60 | ||
| 51 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | 61 | /*if (MapUtils.isNotEmpty(error)) { |
| 52 | |||
| 53 | if (MapUtils.isNotEmpty(error)) { | ||
| 54 | String errorStart = this.error.get("start"); | 62 | String errorStart = this.error.get("start"); |
| 55 | 63 | ||
| 56 | if (errorStart.equalsIgnoreCase("true")) { | 64 | if (errorStart.equalsIgnoreCase("true")) { |
| ... | @@ -60,9 +68,9 @@ public class UcEngineManagement2IptvConsumer { | ... | @@ -60,9 +68,9 @@ public class UcEngineManagement2IptvConsumer { |
| 60 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | 68 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 61 | } | 69 | } |
| 62 | 70 | ||
| 63 | } | 71 | }*/ |
| 72 | |||
| 64 | 73 | ||
| 65 | e.printStackTrace(); | ||
| 66 | } | 74 | } |
| 67 | 75 | ||
| 68 | log.info("ucEventConsumer ====>>>> end"); | 76 | log.info("ucEventConsumer ====>>>> end"); |
| ... | @@ -75,26 +83,28 @@ public class UcEngineManagement2IptvConsumer { | ... | @@ -75,26 +83,28 @@ public class UcEngineManagement2IptvConsumer { |
| 75 | * @author Hongyan Wang | 83 | * @author Hongyan Wang |
| 76 | * @date 2021/9/7 11:26 上午 | 84 | * @date 2021/9/7 11:26 上午 |
| 77 | */ | 85 | */ |
| 78 | @RabbitHandler | 86 | /*@RabbitHandler |
| 79 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUceQueue()}", | 87 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUceQueue()}", |
| 80 | containerFactory = "#{rabbitMqSourceConfig.getUceSource()}", | 88 | containerFactory = "#{rabbitMqSourceConfig.getUceSource()}", |
| 81 | autoStartup = "#{rabbitMqSourceConfig.getUceStartUp()}", | 89 | autoStartup = "#{rabbitMqSourceConfig.getUceStartUp()}", |
| 82 | ackMode = "MANUAL") | 90 | ackMode = "MANUAL")*/ |
| 83 | public void ucEventConsumer(Channel channel, Message message, String content) throws IOException { | 91 | @RabbitHandler |
| 84 | log.info(" receive ucEventConsumer msg , content is : {} ", content); | 92 | @RabbitListener(queues = "#{rabbitMqConfig.getUceQueue()}", ackMode = "AUTO") |
| 93 | public void ucEngineConsumer(Channel channel, Message message, String content) throws IOException { | ||
| 94 | log.info(" receive ucEngineConsumer msg , content is : {} ", content); | ||
| 85 | 95 | ||
| 86 | try { | 96 | try { |
| 87 | TableOperationMsg tableOperationMsg = this.parseContent(content); | 97 | TableOperationMsg tableOperationMsg = this.parseContent(content); |
| 88 | 98 | ||
| 89 | autoUser.route(tableOperationMsg); | 99 | autoUser.route(tableOperationMsg); |
| 90 | 100 | ||
| 91 | channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); | 101 | // channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); |
| 92 | 102 | ||
| 93 | } catch (Exception e) { | 103 | } catch (Exception e) { |
| 94 | 104 | log.error("消费uc-engine消息失败, cause ==>> [ucEngineConsumer#{}]", e.getMessage()); | |
| 95 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | 105 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); |
| 96 | 106 | ||
| 97 | if (MapUtils.isNotEmpty(error)) { | 107 | /*if (MapUtils.isNotEmpty(error)) { |
| 98 | String errorStart = this.error.get("start"); | 108 | String errorStart = this.error.get("start"); |
| 99 | 109 | ||
| 100 | if (errorStart.equalsIgnoreCase("true")) { | 110 | if (errorStart.equalsIgnoreCase("true")) { |
| ... | @@ -104,7 +114,7 @@ public class UcEngineManagement2IptvConsumer { | ... | @@ -104,7 +114,7 @@ public class UcEngineManagement2IptvConsumer { |
| 104 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | 114 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 105 | } | 115 | } |
| 106 | 116 | ||
| 107 | } | 117 | }*/ |
| 108 | 118 | ||
| 109 | e.printStackTrace(); | 119 | e.printStackTrace(); |
| 110 | } | 120 | } | ... | ... |
| 1 | package com.topdraw.mq.consumer; | 1 | package com.topdraw.mq.consumer; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.rabbitmq.client.Channel; | 4 | import com.rabbitmq.client.Channel; |
| 6 | import com.topdraw.business.module.member.service.MemberService; | 5 | import com.topdraw.business.module.task.template.constant.TaskEventName; |
| 7 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 6 | import com.topdraw.business.module.task.template.constant.TaskEventType; |
| 8 | import com.topdraw.business.module.task.attribute.service.TaskAttrService; | 7 | import com.topdraw.exception.BadRequestException; |
| 9 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; | ||
| 10 | import com.topdraw.business.module.task.domain.Task; | ||
| 11 | import com.topdraw.business.module.task.service.TaskService; | ||
| 12 | import com.topdraw.business.module.task.template.service.TaskTemplateService; | ||
| 13 | import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO; | ||
| 14 | import com.topdraw.business.module.user.iptv.service.UserTvService; | ||
| 15 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | ||
| 16 | import com.topdraw.exception.EntityNotFoundException; | ||
| 17 | import com.topdraw.mq.domain.DataSyncMsg; | 8 | import com.topdraw.mq.domain.DataSyncMsg; |
| 18 | import com.topdraw.resttemplate.RestTemplateClient; | 9 | import com.topdraw.resttemplate.RestTemplateClient; |
| 19 | import com.topdraw.util.DateUtil; | ||
| 20 | import com.topdraw.util.FileUtil; | 10 | import com.topdraw.util.FileUtil; |
| 21 | import com.topdraw.util.JSONUtil; | 11 | import com.topdraw.util.JSONUtil; |
| 22 | import com.topdraw.util.TimestampUtil; | ||
| 23 | import com.topdraw.utils.RedisUtils; | ||
| 24 | import lombok.Data; | 12 | import lombok.Data; |
| 25 | import lombok.extern.slf4j.Slf4j; | 13 | import lombok.extern.slf4j.Slf4j; |
| 26 | import org.apache.commons.collections4.CollectionUtils; | ||
| 27 | import org.apache.commons.collections4.MapUtils; | 14 | import org.apache.commons.collections4.MapUtils; |
| 28 | import org.apache.commons.lang3.StringUtils; | 15 | import org.apache.commons.lang3.StringUtils; |
| 29 | import org.springframework.amqp.core.Message; | 16 | import org.springframework.amqp.core.Message; |
| ... | @@ -33,7 +20,6 @@ import org.springframework.beans.factory.annotation.Value; | ... | @@ -33,7 +20,6 @@ import org.springframework.beans.factory.annotation.Value; |
| 33 | import org.springframework.stereotype.Component; | 20 | import org.springframework.stereotype.Component; |
| 34 | 21 | ||
| 35 | import java.io.IOException; | 22 | import java.io.IOException; |
| 36 | import java.text.ParseException; | ||
| 37 | import java.time.LocalDate; | 23 | import java.time.LocalDate; |
| 38 | import java.time.LocalDateTime; | 24 | import java.time.LocalDateTime; |
| 39 | import java.util.*; | 25 | import java.util.*; |
| ... | @@ -43,23 +29,10 @@ import java.util.*; | ... | @@ -43,23 +29,10 @@ import java.util.*; |
| 43 | public class UcEventBusIptv2ManagementUcEngine { | 29 | public class UcEventBusIptv2ManagementUcEngine { |
| 44 | 30 | ||
| 45 | @Autowired | 31 | @Autowired |
| 46 | private TaskService taskService; | ||
| 47 | @Autowired | ||
| 48 | private UserTvService userTvService; | ||
| 49 | @Autowired | ||
| 50 | private MemberService memberService; | ||
| 51 | @Autowired | ||
| 52 | private TaskAttrService taskAttrService; | ||
| 53 | @Autowired | ||
| 54 | private TaskTemplateService taskTemplateService; | ||
| 55 | @Autowired | ||
| 56 | private RestTemplateClient restTemplateClient; | 32 | private RestTemplateClient restTemplateClient; |
| 57 | @Autowired | ||
| 58 | private RedisUtils redisUtils; | ||
| 59 | |||
| 60 | 33 | ||
| 61 | @Value("#{rabbitMqErrorLogConfig.getEventBusError()}") | 34 | /*@Value("#{rabbitMqErrorLogConfig.getEventBusError()}") |
| 62 | private Map<String, String> error; | 35 | private Map<String, String> error;*/ |
| 63 | 36 | ||
| 64 | /** | 37 | /** |
| 65 | * 事件 | 38 | * 事件 |
| ... | @@ -68,287 +41,97 @@ public class UcEventBusIptv2ManagementUcEngine { | ... | @@ -68,287 +41,97 @@ public class UcEventBusIptv2ManagementUcEngine { |
| 68 | * @author Hongyan Wang | 41 | * @author Hongyan Wang |
| 69 | * @date 2021/9/7 11:26 上午 | 42 | * @date 2021/9/7 11:26 上午 |
| 70 | */ | 43 | */ |
| 71 | @RabbitHandler | 44 | /*@RabbitHandler |
| 72 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getEventBusQueue()}", | 45 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getEventBusQueue()}", |
| 73 | containerFactory = "#{rabbitMqSourceConfig.getEventBusSource()}", | 46 | containerFactory = "#{rabbitMqSourceConfig.getEventBusSource()}", |
| 74 | autoStartup = "#{rabbitMqSourceConfig.getEventBusStartUp()}", | 47 | autoStartup = "#{rabbitMqSourceConfig.getEventBusStartUp()}", |
| 48 | ackMode = "AUTO")*/ | ||
| 49 | @RabbitHandler | ||
| 50 | @RabbitListener(queues = "#{rabbitMqConfig.getEventBusQueue()}", | ||
| 75 | ackMode = "AUTO") | 51 | ackMode = "AUTO") |
| 76 | public void eventBusConsumer(Channel channel, Message message, String content) throws ParseException, IOException { | 52 | public void eventBusConsumer(Channel channel, Message message, String content) throws Exception { |
| 77 | log.info(" receive dataSync msg , content is : {} ", content); | 53 | log.info(" receive dataSync msg , content is ==>> {} ", content); |
| 78 | try { | 54 | try { |
| 79 | 55 | ||
| 80 | this.parseContent(content); | 56 | DataSyncMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, DataSyncMsg.class); |
| 57 | log.info("解析后的参数 , playContent ==>> {} ", dataSyncMsg); | ||
| 81 | 58 | ||
| 82 | // channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); | 59 | if (Objects.nonNull(dataSyncMsg)) { |
| 83 | |||
| 84 | } catch (Exception e) { | ||
| 85 | |||
| 86 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | ||
| 87 | |||
| 88 | if (MapUtils.isNotEmpty(error)) { | ||
| 89 | String errorStart = this.error.get("start"); | ||
| 90 | 60 | ||
| 91 | if (errorStart.equalsIgnoreCase("true")) { | 61 | String evt = dataSyncMsg.getEvt(); |
| 92 | String fileName = this.error.get("fileName")+"_"+LocalDate.now() +".log"; | 62 | if (StringUtils.isBlank(evt)) { |
| 93 | String filePath = this.error.get("filePath"); | 63 | log.error("eventBus事件类型(evt)为空"); |
| 94 | String filePath1 = filePath+fileName; | 64 | throw new BadRequestException("参数错误,事件类型 evt不存在"); |
| 95 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | ||
| 96 | } | 65 | } |
| 97 | 66 | ||
| 98 | } | 67 | LocalDateTime time = dataSyncMsg.getTime(); |
| 99 | 68 | if (Objects.isNull(time)) { | |
| 100 | e.printStackTrace(); | 69 | log.error("参数错误,事件发送时间(time)不存在"); |
| 101 | } | 70 | throw new BadRequestException("参数错误,事件发送时间(time)不存在"); |
| 102 | log.info("ucEventConsumer ====>>>> end"); | 71 | } /*else { |
| 103 | } | 72 | if (time.isAfter(LocalDateTime.now()) || time.toLocalDate().compareTo(LocalDate.now()) != 0) { |
| 104 | 73 | log.error("参数错误,事件发送时间(time)非法 ==>> {}", time); | |
| 105 | 74 | throw new BadRequestException("参数错误,事件发送时间非法 "); | |
| 106 | /** | ||
| 107 | * 数据解析 | ||
| 108 | * @param content | ||
| 109 | * @return | ||
| 110 | */ | ||
| 111 | private void parseContent(String content) throws ParseException { | ||
| 112 | |||
| 113 | PlayContent commonMsg = JSONUtil.parseMsg2Object(content, PlayContent.class); | ||
| 114 | |||
| 115 | String evt = commonMsg.getEvt(); | ||
| 116 | switch (evt.toUpperCase()) { | ||
| 117 | |||
| 118 | case "PLAY": | ||
| 119 | PlayContent playContent = JSONUtil.parseMsg2Object(content, PlayContent.class); | ||
| 120 | |||
| 121 | PlayContent.MsgData msgData = playContent.getMsgData(); | ||
| 122 | if (Objects.nonNull(msgData)) { | ||
| 123 | String time = playContent.getTime(); | ||
| 124 | String formatDate = DateUtil.formatDate(time); | ||
| 125 | Integer deviceType = playContent.getDeviceType(); | ||
| 126 | String platformAccount = msgData.getPlatformAccount(); | ||
| 127 | |||
| 128 | String mediaCode = msgData.getMediaCode(); | ||
| 129 | Long mediaId = msgData.getMediaId(); | ||
| 130 | String mediaName = msgData.getMediaName(); | ||
| 131 | Integer playDuration = msgData.getPlayDuration(); | ||
| 132 | if (Objects.isNull(playDuration) || playDuration == 0) { | ||
| 133 | return; | ||
| 134 | } | 75 | } |
| 135 | log.info("playDuration ==>> {}", playDuration); | 76 | }*/ |
| 136 | |||
| 137 | DataSyncMsg dataSyncMsg = new DataSyncMsg(); | ||
| 138 | dataSyncMsg.setEvt(evt); | ||
| 139 | DataSyncMsg.MsgData msg = new DataSyncMsg.MsgData(); | ||
| 140 | |||
| 141 | Integer playDurationValueTotal = 0; | ||
| 142 | if (StringUtils.isNotBlank(platformAccount)) { | ||
| 143 | |||
| 144 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
| 145 | |||
| 146 | if(Objects.nonNull(userTvDTO)) { | ||
| 147 | // 用大屏账号+日期做为key,并判断这个key是否存在 ,数据类型为hash eg:<total,1>,<1,playDuration>,<2,playDuration> | ||
| 148 | String key = platformAccount+"|"+formatDate; | ||
| 149 | Map<Object, Object> hmget = | ||
| 150 | this.redisUtils.hmget(key); | ||
| 151 | |||
| 152 | if (MapUtils.isEmpty(hmget)) { | ||
| 153 | |||
| 154 | // 初始化播放总时长<total>和第一个播放时间 | ||
| 155 | playDurationValueTotal = playDuration; | ||
| 156 | Map<String, Object> map = new HashMap<>(); | ||
| 157 | map.put("total", playDurationValueTotal); | ||
| 158 | map.put("1", playDuration); | ||
| 159 | this.redisUtils.hmset(key, map, 129600); | ||
| 160 | |||
| 161 | } else { | ||
| 162 | |||
| 163 | // 计算播放总时长 total = 播放总时长+当前播放时长 | ||
| 164 | Integer total = this.getRedisTotal(hmget); | ||
| 165 | playDurationValueTotal = total + playDuration; | ||
| 166 | |||
| 167 | } | ||
| 168 | |||
| 169 | Integer totalKey = this.getRedisTotalKey(hmget); | ||
| 170 | Integer maxSize = totalKey + 1; | ||
| 171 | |||
| 172 | Map<String, Object> map = new HashMap<>(); | ||
| 173 | map.put(String.valueOf(maxSize), playDuration); | ||
| 174 | map.put("total", playDurationValueTotal); | ||
| 175 | this.redisUtils.hmset(key, map); | ||
| 176 | |||
| 177 | this.checkTask(playDurationValueTotal, time, deviceType, | ||
| 178 | mediaCode, mediaId, mediaName, dataSyncMsg, msg, userTvDTO); | ||
| 179 | |||
| 180 | } | ||
| 181 | |||
| 182 | } | ||
| 183 | |||
| 184 | } | ||
| 185 | |||
| 186 | break; | ||
| 187 | |||
| 188 | } | ||
| 189 | |||
| 190 | //return null; | ||
| 191 | } | ||
| 192 | |||
| 193 | private DataSyncMsg checkTask(Integer playDurationValueTotal, String time, Integer deviceType, String mediaCode, | ||
| 194 | Long mediaId, String mediaName, DataSyncMsg dataSyncMsg, | ||
| 195 | DataSyncMsg.MsgData msgData, UserTvDTO userTvDTO) { | ||
| 196 | 77 | ||
| 197 | // 检查播放记录任务 | 78 | String msgData = dataSyncMsg.getMsgData(); |
| 198 | List<TaskAttrDTO> taskAttrDTOList = new ArrayList<>(); | 79 | if (StringUtils.isBlank(msgData)) { |
| 199 | TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findByType(8); | 80 | log.error("eventBus事件消息体(msgData)为空"); |
| 200 | if (Objects.nonNull(taskTemplateDTO.getId())) { | 81 | throw new BadRequestException("参数错误,事件类型 evt不存在"); |
| 201 | List<Task> taskList = this.taskService.findByTemplateId(taskTemplateDTO.getId()); | ||
| 202 | if (CollectionUtils.isNotEmpty(taskList)) { | ||
| 203 | |||
| 204 | for (Task task : taskList) { | ||
| 205 | TaskAttrDTO taskAttrDTO = this.taskAttrService.findByTaskId(task.getId()); | ||
| 206 | taskAttrDTOList.add(taskAttrDTO); | ||
| 207 | } | 82 | } |
| 208 | 83 | ||
| 209 | } else { | 84 | switch (dataSyncMsg.getEvt().toUpperCase()) { |
| 210 | |||
| 211 | return null; | ||
| 212 | |||
| 213 | } | ||
| 214 | |||
| 215 | } else { | ||
| 216 | 85 | ||
| 217 | return null; | 86 | // 播放记录 |
| 87 | case TaskEventName.PLAY: | ||
| 88 | this.doPlayEvent(dataSyncMsg); | ||
| 89 | break; | ||
| 218 | 90 | ||
| 219 | } | 91 | default: |
| 220 | 92 | log.info("无可处理的任务"); | |
| 221 | List<List<Integer>> attrList = new ArrayList<>(); | 93 | break; |
| 222 | if (CollectionUtils.isNotEmpty(taskAttrDTOList)) { | ||
| 223 | |||
| 224 | for (TaskAttrDTO taskAttrDTO : taskAttrDTOList) { | ||
| 225 | |||
| 226 | String attrStr = taskAttrDTO.getAttrStr(); | ||
| 227 | if (StringUtils.isNotBlank(attrStr)) { | ||
| 228 | |||
| 229 | JSONObject parse = JSONObject.parseObject(attrStr, JSONObject.class); | ||
| 230 | List<Integer> value = (List<Integer>) parse.get("value"); | ||
| 231 | attrList.add(value); | ||
| 232 | } | 94 | } |
| 233 | 95 | ||
| 234 | } | 96 | } |
| 235 | 97 | ||
| 236 | } else { | 98 | } catch (Exception e) { |
| 237 | |||
| 238 | return null; | ||
| 239 | |||
| 240 | } | ||
| 241 | |||
| 242 | int size = attrList.size(); | ||
| 243 | |||
| 244 | DataSyncMsg dataSyncMsg1 = null; | ||
| 245 | |||
| 246 | if (size > 0) { | ||
| 247 | 99 | ||
| 248 | for (int i = size-1; i >= 0; i--) { | 100 | log.error("eventBus 消费异常 ==>> {}",e.getMessage()); |
| 249 | 101 | ||
| 250 | Integer integer = attrList.get(i).get(0); | 102 | // TODO使用slf4j记录日志 |
| 103 | /*if (MapUtils.isNotEmpty(error)) { | ||
| 104 | String errorStart = this.error.get("start"); | ||
| 251 | 105 | ||
| 252 | if (playDurationValueTotal >= integer) { | 106 | if (errorStart.equalsIgnoreCase("true")) { |
| 253 | dataSyncMsg1 = getDataSyncMsg(time, mediaCode, mediaId, mediaName, integer, dataSyncMsg, | 107 | String fileName = this.error.get("fileName")+"_"+LocalDate.now() +".log"; |
| 254 | msgData, userTvDTO); | 108 | String filePath = this.error.get("filePath"); |
| 255 | dataSyncMsg1.setEvt("PLAY"); | 109 | String filePath1 = filePath+fileName; |
| 256 | dataSyncMsg1.setEvent(8); | 110 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 257 | dataSyncMsg1.setTime(LocalDateTime.now()); | ||
| 258 | dataSyncMsg1.setDeviceType(deviceType); | ||
| 259 | this.taskDeal(dataSyncMsg1); | ||
| 260 | } | 111 | } |
| 261 | 112 | ||
| 262 | } | 113 | }*/ |
| 263 | |||
| 264 | } | ||
| 265 | |||
| 266 | return dataSyncMsg1; | ||
| 267 | } | ||
| 268 | |||
| 269 | private Integer getRedisTotalKey(Map<Object, Object> hmget) { | ||
| 270 | Set<Object> objects = hmget.keySet(); | ||
| 271 | return objects.size(); | ||
| 272 | } | ||
| 273 | |||
| 274 | private Integer getRedisTotal(Map<Object, Object> hmget) { | ||
| 275 | Set<Object> objects = hmget.keySet(); | ||
| 276 | |||
| 277 | Integer playDurationValueTotal_ = 0; | ||
| 278 | |||
| 279 | for (Object key_ : objects) { | ||
| 280 | |||
| 281 | if (key_.toString().equalsIgnoreCase("total")) { | ||
| 282 | playDurationValueTotal_ = Integer.valueOf(hmget.get(key_).toString()); | ||
| 283 | return playDurationValueTotal_; | ||
| 284 | |||
| 285 | } else { | ||
| 286 | |||
| 287 | continue; | ||
| 288 | |||
| 289 | } | ||
| 290 | 114 | ||
| 291 | } | 115 | } |
| 292 | 116 | log.info("eventBusConsumer ====>>>> end"); | |
| 293 | return playDurationValueTotal_; | ||
| 294 | |||
| 295 | } | ||
| 296 | |||
| 297 | private DataSyncMsg getDataSyncMsg(String time, String mediaCode, Long mediaId, String mediaName, | ||
| 298 | Integer playDuration, DataSyncMsg dataSyncMsg, DataSyncMsg.MsgData msgData1, UserTvDTO userTvDTO) { | ||
| 299 | String priorityMemberCode = userTvDTO.getPriorityMemberCode(); | ||
| 300 | String memberCode = ""; | ||
| 301 | if (StringUtils.isNotBlank(priorityMemberCode)) { | ||
| 302 | memberCode = priorityMemberCode; | ||
| 303 | } else { | ||
| 304 | memberCode = this.memberService.findById(userTvDTO.getMemberId()).getCode(); | ||
| 305 | } | ||
| 306 | |||
| 307 | if (StringUtils.isBlank(memberCode)) | ||
| 308 | throw new EntityNotFoundException(MemberDTO.class, "memberCode", "memberCode is null"); | ||
| 309 | |||
| 310 | msgData1.setMemberCode(memberCode); | ||
| 311 | |||
| 312 | msgData1.setMediaId(mediaId); | ||
| 313 | |||
| 314 | JSONObject param = new JSONObject(); | ||
| 315 | // 增量 | ||
| 316 | param.put("playDuration", playDuration); | ||
| 317 | msgData1.setParam(JSON.toJSONString(param)); | ||
| 318 | JSONObject description = new JSONObject(); | ||
| 319 | description.put("mediaId", mediaId); | ||
| 320 | description.put("mediaName", mediaName); | ||
| 321 | description.put("playDuration", playDuration); | ||
| 322 | description.put("mediaCode", mediaCode); | ||
| 323 | description.put("time", time); | ||
| 324 | msgData1.setDescription(JSON.toJSONString(description)); | ||
| 325 | dataSyncMsg.setMsgData(JSONObject.toJSONString(msgData1)); | ||
| 326 | return dataSyncMsg; | ||
| 327 | } | 117 | } |
| 328 | 118 | ||
| 329 | /** | 119 | /** |
| 330 | * 任务处理 | 120 | * |
| 331 | * @param dataSyncMsg | 121 | * @param playContent |
| 332 | */ | 122 | */ |
| 333 | private void taskDeal(DataSyncMsg dataSyncMsg) { | 123 | private void doPlayEvent(DataSyncMsg playContent) { |
| 334 | this.restTemplateClient.dealTask(dataSyncMsg); | 124 | playContent.setEvent(TaskEventType.PLAY); |
| 335 | } | 125 | String msgData = playContent.getMsgData(); |
| 336 | 126 | JSONObject jsonObject = JSONObject.parseObject(msgData, JSONObject.class); | |
| 337 | @Data | 127 | Object platformAccount = jsonObject.get("platformAccount"); |
| 338 | static class PlayContent { | 128 | if (Objects.nonNull(platformAccount)) { |
| 339 | private String evt; | 129 | boolean response = this.restTemplateClient.dealTask(playContent); |
| 340 | private Integer event; | 130 | if (!response) { |
| 341 | private Integer deviceType; | 131 | log.error("uc-engine响应超时,请检查uc-engine服务"); |
| 342 | private String time; | 132 | throw new BadRequestException("uc-engine响应超时"); |
| 343 | private MsgData msgData; | 133 | } |
| 344 | |||
| 345 | @Data | ||
| 346 | static class MsgData { | ||
| 347 | private String platformAccount; | ||
| 348 | private Integer playDuration; | ||
| 349 | private Long mediaId; | ||
| 350 | private String mediaCode; | ||
| 351 | private String mediaName; | ||
| 352 | } | 134 | } |
| 353 | } | 135 | } |
| 136 | |||
| 354 | } | 137 | } | ... | ... |
| ... | @@ -3,10 +3,7 @@ package com.topdraw.mq.consumer; | ... | @@ -3,10 +3,7 @@ package com.topdraw.mq.consumer; |
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.rabbitmq.client.Channel; | 5 | import com.rabbitmq.client.Channel; |
| 6 | import com.topdraw.business.module.member.service.MemberService; | 6 | import com.topdraw.exception.BadRequestException; |
| 7 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 8 | import com.topdraw.business.module.user.iptv.service.UserTvService; | ||
| 9 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | ||
| 10 | import com.topdraw.mq.domain.DataSyncMsg; | 7 | import com.topdraw.mq.domain.DataSyncMsg; |
| 11 | import com.topdraw.resttemplate.RestTemplateClient; | 8 | import com.topdraw.resttemplate.RestTemplateClient; |
| 12 | import com.topdraw.util.FileUtil; | 9 | import com.topdraw.util.FileUtil; |
| ... | @@ -19,9 +16,7 @@ import org.springframework.amqp.rabbit.annotation.*; | ... | @@ -19,9 +16,7 @@ import org.springframework.amqp.rabbit.annotation.*; |
| 19 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | import org.springframework.beans.factory.annotation.Value; | 17 | import org.springframework.beans.factory.annotation.Value; |
| 21 | import org.springframework.stereotype.Component; | 18 | import org.springframework.stereotype.Component; |
| 22 | import org.springframework.util.Assert; | ||
| 23 | 19 | ||
| 24 | import javax.validation.constraints.NotNull; | ||
| 25 | import java.io.IOException; | 20 | import java.io.IOException; |
| 26 | import java.time.LocalDate; | 21 | import java.time.LocalDate; |
| 27 | import java.util.Map; | 22 | import java.util.Map; |
| ... | @@ -34,44 +29,41 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -34,44 +29,41 @@ public class UcGatewayIptv2IptvConsumer { |
| 34 | @Autowired | 29 | @Autowired |
| 35 | RestTemplateClient restTemplateClient; | 30 | RestTemplateClient restTemplateClient; |
| 36 | 31 | ||
| 37 | @Autowired | 32 | /*@Value("#{rabbitMqErrorLogConfig.getUcgError()}") |
| 38 | AutoRoute autoUser; | 33 | private Map<String, String> error;*/ |
| 39 | |||
| 40 | @Autowired | ||
| 41 | private MemberService memberService; | ||
| 42 | @Autowired | ||
| 43 | private UserTvService userTvService; | ||
| 44 | |||
| 45 | @Value("#{rabbitMqErrorLogConfig.getUcgError()}") | ||
| 46 | private Map<String, String> error; | ||
| 47 | 34 | ||
| 48 | /** | 35 | /** |
| 49 | * 事件 | 36 | * 事件 |
| 50 | * @param content | 37 | * @param content |
| 51 | * @description 基础数据同步 | 38 | * @description 普通权益事件 |
| 52 | * @author Hongyan Wang | 39 | * @author Hongyan Wang |
| 53 | * @date 2021/9/7 11:26 上午 | 40 | * @date 2021/9/7 11:26 上午 |
| 54 | */ | 41 | */ |
| 55 | @RabbitHandler | 42 | /*@RabbitHandler |
| 56 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgEventQueue()}", | 43 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgEventQueue()}", |
| 57 | containerFactory = "#{rabbitMqSourceConfig.getUcgEventSource()}", | 44 | containerFactory = "#{rabbitMqSourceConfig.getUcgEventSource()}", |
| 58 | autoStartup = "#{rabbitMqSourceConfig.getUcgEventStartUp()}", | 45 | autoStartup = "#{rabbitMqSourceConfig.getUcgEventStartUp()}", |
| 59 | ackMode = "MANUAL") | 46 | ackMode = "AUTO")*/ |
| 47 | @RabbitHandler | ||
| 48 | @RabbitListener(queues = "#{rabbitMqConfig.getUcgEventQueue()}", | ||
| 49 | ackMode = "AUTO") | ||
| 60 | public void eventConsumer(Channel channel, Message message, String content) throws IOException { | 50 | public void eventConsumer(Channel channel, Message message, String content) throws IOException { |
| 61 | log.info(" receive dataSync msg , content is : {} ", content); | 51 | log.info(" eventConsumer receive dataSync msg , content is : {} ", content); |
| 62 | try { | 52 | try { |
| 63 | DataSyncMsg dataSyncMsg = this.parseContent(content); | 53 | DataSyncMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, DataSyncMsg.class); |
| 54 | |||
| 64 | if (Objects.nonNull(dataSyncMsg)) { | 55 | if (Objects.nonNull(dataSyncMsg)) { |
| 65 | this.taskDeal(dataSyncMsg); | 56 | boolean jsonObject = this.restTemplateClient.dealTask(dataSyncMsg); |
| 57 | if (!jsonObject) { | ||
| 58 | throw new BadRequestException("uce处理任务响应超时"); | ||
| 59 | } | ||
| 66 | } | 60 | } |
| 67 | 61 | ||
| 68 | channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); | ||
| 69 | |||
| 70 | } catch (Exception e) { | 62 | } catch (Exception e) { |
| 71 | 63 | ||
| 72 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | 64 | log.error("普通权益事件处理异常, ==>> {}", e.getMessage()); |
| 73 | 65 | ||
| 74 | if (MapUtils.isNotEmpty(error)) { | 66 | /*if (MapUtils.isNotEmpty(error)) { |
| 75 | String errorStart = this.error.get("start"); | 67 | String errorStart = this.error.get("start"); |
| 76 | 68 | ||
| 77 | if (StringUtils.isEmpty(errorStart) || errorStart.equalsIgnoreCase("true")) { | 69 | if (StringUtils.isEmpty(errorStart) || errorStart.equalsIgnoreCase("true")) { |
| ... | @@ -81,77 +73,62 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -81,77 +73,62 @@ public class UcGatewayIptv2IptvConsumer { |
| 81 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | 73 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 82 | } | 74 | } |
| 83 | 75 | ||
| 84 | } | 76 | }*/ |
| 85 | |||
| 86 | e.printStackTrace(); | ||
| 87 | } | 77 | } |
| 88 | log.info("ucEventConsumer ====>>>> end"); | 78 | log.info("ucEventConsumer ====>>>> end"); |
| 89 | } | 79 | } |
| 90 | 80 | ||
| 81 | |||
| 82 | |||
| 91 | /** | 83 | /** |
| 92 | * 数据解析 | 84 | * @description 删除全部收藏记录 |
| 93 | * @param content | 85 | * @param content 消息内容 |
| 94 | * @return | ||
| 95 | */ | 86 | */ |
| 96 | private DataSyncMsg parseContent(String content) { | 87 | /*@RabbitHandler |
| 97 | DataSyncMsg dataSyncMsg = JSONUtil.parseMsg2Object(content,DataSyncMsg.class); | 88 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getGrowthReportQueue()}", |
| 98 | Assert.notNull(dataSyncMsg,"ERROR -->> operationConsumer -->> parseContent -->> 【dataSyncMsg】 not be null !!"); | 89 | containerFactory = "#{rabbitMqSourceConfig.getGrowthReportSource()}", |
| 99 | String msgDataStr = dataSyncMsg.getMsgData(); | 90 | autoStartup = "#{rabbitMqSourceConfig.getGrowthReportStartUp()}", |
| 100 | DataSyncMsg.MsgData msgData = null; | 91 | ackMode = "AUTO")*/ |
| 101 | if (StringUtils.isNotBlank(msgDataStr)) { | 92 | @RabbitHandler |
| 102 | msgData = JSONObject.parseObject(msgDataStr, DataSyncMsg.MsgData.class); | 93 | @RabbitListener(queues = "#{rabbitMqConfig.getGrowthReportQueue()}", |
| 103 | }else { | 94 | ackMode = "AUTO") |
| 104 | return null; | 95 | public void dealGrowthReport(Channel channel, Message message, String content) throws IOException { |
| 105 | } | 96 | log.info("receive dealGrowthReport add message, content {}", content); |
| 106 | Long memberId = msgData.getMemberId(); | ||
| 107 | String memberCode = msgData.getMemberCode(); | ||
| 108 | if (Objects.nonNull(memberId) && StringUtils.isBlank(memberCode)) { | ||
| 109 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
| 110 | String code = memberDTO.getCode(); | ||
| 111 | msgData.setMemberCode(code); | ||
| 112 | } | ||
| 113 | 97 | ||
| 114 | String platformAccount = msgData.getPlatformAccount(); | 98 | try { |
| 115 | if (StringUtils.isNotBlank(platformAccount)) { | 99 | |
| 116 | UserTvDTO userTvDTO = userTvService.findByPlatformAccount(platformAccount); | 100 | JSONObject jsonObject = JSON.parseObject(content, JSONObject.class); |
| 117 | if (Objects.nonNull(userTvDTO)) { | 101 | if (Objects.nonNull(content)) { |
| 118 | String priorityMemberCode = userTvDTO.getPriorityMemberCode(); | 102 | Object msgData = jsonObject.get("msgData"); |
| 119 | if (StringUtils.isNotBlank(priorityMemberCode)) { | 103 | Boolean response = this.restTemplateClient.saveGrowthReport(JSON.toJSONString(msgData)); |
| 120 | msgData.setMemberCode(priorityMemberCode); | 104 | if (!response) { |
| 121 | } else { | 105 | log.error("同步大屏成长报告失败,uce接口响应超时"); |
| 122 | MemberDTO memberDTO = this.memberService.findById(userTvDTO.getMemberId()); | ||
| 123 | msgData.setMemberCode(memberDTO.getCode()); | ||
| 124 | } | 106 | } |
| 125 | } | 107 | } |
| 126 | } | ||
| 127 | 108 | ||
| 128 | if(Objects.isNull(msgData.getMemberCode()) && Objects.isNull(msgData.getMemberId())) { | 109 | } catch (Exception e) { |
| 129 | log.error("会员信息不存在,msgData =>> {}", msgData); | 110 | log.error("同步大屏成长报告失败,cause ==>> {}", e.getMessage()); |
| 130 | return null; | ||
| 131 | } | ||
| 132 | 111 | ||
| 133 | dataSyncMsg.setMsgData(JSONObject.toJSONString(msgData)); | 112 | /*if (MapUtils.isNotEmpty(error)) { |
| 134 | return dataSyncMsg; | 113 | String errorStart = this.error.get("start"); |
| 135 | } | ||
| 136 | 114 | ||
| 137 | /** | 115 | if (errorStart.equalsIgnoreCase("true")) { |
| 138 | * 任务处理 | 116 | String fileName = this.error.get("fileName")+"_"+ LocalDate.now() +".log"; |
| 139 | * @param dataSyncMsg | 117 | String filePath = this.error.get("filePath"); |
| 140 | */ | 118 | String filePath1 = filePath+fileName; |
| 141 | private void taskDeal(DataSyncMsg dataSyncMsg) { | 119 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 142 | this.restTemplateClient.dealTask(dataSyncMsg); | 120 | } |
| 143 | } | ||
| 144 | 121 | ||
| 122 | }*/ | ||
| 123 | } | ||
| 124 | } | ||
| 145 | 125 | ||
| 146 | /** | 126 | /** |
| 147 | * @description 添加收藏记录 | 127 | * @description 添加收藏记录 |
| 148 | * @param content 消息内容 | 128 | * @param content 消息内容 |
| 149 | */ | 129 | */ |
| 150 | @RabbitHandler | 130 | @RabbitHandler |
| 151 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueue()}", | 131 | @RabbitListener(queues = "#{rabbitMqConfig.getUcgCollectionQueue()}", ackMode = "AUTO") |
| 152 | containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}", | ||
| 153 | autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}", | ||
| 154 | ackMode = "MANUAL") | ||
| 155 | public void collectionConsumer(Channel channel, Message message, String content) throws IOException { | 132 | public void collectionConsumer(Channel channel, Message message, String content) throws IOException { |
| 156 | log.info("receive UserCollection add message, content {}", content); | 133 | log.info("receive UserCollection add message, content {}", content); |
| 157 | 134 | ||
| ... | @@ -180,13 +157,11 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -180,13 +157,11 @@ public class UcGatewayIptv2IptvConsumer { |
| 180 | } | 157 | } |
| 181 | } | 158 | } |
| 182 | 159 | ||
| 183 | channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); | ||
| 184 | |||
| 185 | } catch (Exception e) { | 160 | } catch (Exception e) { |
| 186 | 161 | ||
| 187 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | 162 | log.error("收藏事件处理异常,cause ==>> {}", e.getMessage()); |
| 188 | 163 | ||
| 189 | if (MapUtils.isNotEmpty(error)) { | 164 | /*if (MapUtils.isNotEmpty(error)) { |
| 190 | String errorStart = this.error.get("start"); | 165 | String errorStart = this.error.get("start"); |
| 191 | 166 | ||
| 192 | if (errorStart.equalsIgnoreCase("true")) { | 167 | if (errorStart.equalsIgnoreCase("true")) { |
| ... | @@ -196,9 +171,8 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -196,9 +171,8 @@ public class UcGatewayIptv2IptvConsumer { |
| 196 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | 171 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 197 | } | 172 | } |
| 198 | 173 | ||
| 199 | } | 174 | }*/ |
| 200 | 175 | ||
| 201 | e.printStackTrace(); | ||
| 202 | } | 176 | } |
| 203 | } | 177 | } |
| 204 | 178 | ||
| ... | @@ -206,13 +180,15 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -206,13 +180,15 @@ public class UcGatewayIptv2IptvConsumer { |
| 206 | * @description 处理观影记录 | 180 | * @description 处理观影记录 |
| 207 | * @param content 消息内容 | 181 | * @param content 消息内容 |
| 208 | */ | 182 | */ |
| 209 | @RabbitHandler | 183 | /*@RabbitHandler |
| 210 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getViewRecordQueue()}", | 184 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getViewRecordQueue()}", |
| 211 | containerFactory = "#{rabbitMqSourceConfig.getViewRecordSource()}", | 185 | containerFactory = "#{rabbitMqSourceConfig.getViewRecordSource()}", |
| 212 | autoStartup = "#{rabbitMqSourceConfig.getViewRecordStartUp()}", | 186 | autoStartup = "#{rabbitMqSourceConfig.getViewRecordStartUp()}", |
| 213 | ackMode = "MANUAL") | 187 | ackMode = "AUTO")*/ |
| 188 | @RabbitHandler | ||
| 189 | @RabbitListener(queues = "#{rabbitMqConfig.getViewRecordQueue()}", ackMode = "AUTO") | ||
| 214 | public void viewRecordConsumer(Channel channel, Message message, String content) throws IOException { | 190 | public void viewRecordConsumer(Channel channel, Message message, String content) throws IOException { |
| 215 | log.info("receive ViewRecord add message, content {}", content); | 191 | log.info("viewRecordConsumer receive ViewRecord add message, content {}", content); |
| 216 | 192 | ||
| 217 | try { | 193 | try { |
| 218 | 194 | ||
| ... | @@ -227,17 +203,13 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -227,17 +203,13 @@ public class UcGatewayIptv2IptvConsumer { |
| 227 | break; | 203 | break; |
| 228 | default: | 204 | default: |
| 229 | break; | 205 | break; |
| 230 | |||
| 231 | } | 206 | } |
| 232 | } | 207 | } |
| 233 | 208 | ||
| 234 | channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); | ||
| 235 | |||
| 236 | } catch (Exception e) { | 209 | } catch (Exception e) { |
| 210 | log.error("观影事件处理异常,cause ==>> {}", e.getMessage()); | ||
| 237 | 211 | ||
| 238 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | 212 | /*if (MapUtils.isNotEmpty(error)) { |
| 239 | |||
| 240 | if (MapUtils.isNotEmpty(error)) { | ||
| 241 | String errorStart = this.error.get("start"); | 213 | String errorStart = this.error.get("start"); |
| 242 | 214 | ||
| 243 | if (errorStart.equalsIgnoreCase("true")) { | 215 | if (errorStart.equalsIgnoreCase("true")) { |
| ... | @@ -247,25 +219,25 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -247,25 +219,25 @@ public class UcGatewayIptv2IptvConsumer { |
| 247 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | 219 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 248 | } | 220 | } |
| 249 | 221 | ||
| 250 | } | 222 | }*/ |
| 223 | |||
| 251 | 224 | ||
| 252 | e.printStackTrace(); | ||
| 253 | } | 225 | } |
| 254 | } | 226 | } |
| 255 | 227 | ||
| 256 | 228 | ||
| 257 | |||
| 258 | |||
| 259 | |||
| 260 | /** | 229 | /** |
| 261 | * @description 添加收藏记录 | 230 | * @description 添加收藏记录 |
| 262 | * @param content 消息内容 | 231 | * @param content 消息内容 |
| 263 | */ | 232 | */ |
| 264 | @RabbitHandler | 233 | /*@RabbitHandler |
| 265 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueAdd()}", | 234 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueAdd()}", |
| 266 | containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}", | 235 | containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}", |
| 267 | autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}", | 236 | autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}", |
| 268 | ackMode = "MANUAL") | 237 | ackMode = "AUTO")*/ |
| 238 | @RabbitHandler | ||
| 239 | @RabbitListener(queues = "#{rabbitMqConfig.getUcgCollectionQueueAdd()}", | ||
| 240 | ackMode = "AUTO") | ||
| 269 | public void collectionConsumerAdd(Channel channel, Message message, String content) throws IOException { | 241 | public void collectionConsumerAdd(Channel channel, Message message, String content) throws IOException { |
| 270 | log.info("receive collectionConsumerAdd add message, content {}", content); | 242 | log.info("receive collectionConsumerAdd add message, content {}", content); |
| 271 | 243 | ||
| ... | @@ -294,13 +266,12 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -294,13 +266,12 @@ public class UcGatewayIptv2IptvConsumer { |
| 294 | } | 266 | } |
| 295 | } | 267 | } |
| 296 | 268 | ||
| 297 | // channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); | ||
| 298 | 269 | ||
| 299 | } catch (Exception e) { | 270 | } catch (Exception e) { |
| 300 | 271 | ||
| 301 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | 272 | log.error("添加收藏记录事件处理异常,cause ==>> {}", e.getMessage()); |
| 302 | 273 | ||
| 303 | if (MapUtils.isNotEmpty(error)) { | 274 | /*if (MapUtils.isNotEmpty(error)) { |
| 304 | String errorStart = this.error.get("start"); | 275 | String errorStart = this.error.get("start"); |
| 305 | 276 | ||
| 306 | if (errorStart.equalsIgnoreCase("true")) { | 277 | if (errorStart.equalsIgnoreCase("true")) { |
| ... | @@ -310,26 +281,26 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -310,26 +281,26 @@ public class UcGatewayIptv2IptvConsumer { |
| 310 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | 281 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 311 | } | 282 | } |
| 312 | 283 | ||
| 313 | } | 284 | }*/ |
| 314 | 285 | ||
| 315 | e.printStackTrace(); | ||
| 316 | } | 286 | } |
| 317 | } | 287 | } |
| 318 | 288 | ||
| 319 | /** | 289 | /** |
| 320 | * @description 添加收藏记录 | 290 | * @description 删除收藏记录 |
| 321 | * @param content 消息内容 | 291 | * @param content 消息内容 |
| 322 | */ | 292 | */ |
| 323 | @RabbitHandler | 293 | /* @RabbitHandler |
| 324 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueDelete()}", | 294 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueDelete()}", |
| 325 | containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}", | 295 | containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}", |
| 326 | autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}", | 296 | autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}", |
| 327 | ackMode = "MANUAL") | 297 | ackMode = "AUTO")*/ |
| 298 | @RabbitHandler | ||
| 299 | @RabbitListener(queues = "#{rabbitMqConfig.getUcgCollectionQueueDelete()}", ackMode = "AUTO") | ||
| 328 | public void collectionConsumerDelete(Channel channel, Message message, String content) throws IOException { | 300 | public void collectionConsumerDelete(Channel channel, Message message, String content) throws IOException { |
| 329 | log.info("receive collectionConsumerDelete add message, content {}", content); | 301 | log.info("receive collectionConsumerDelete add message, content {}", content); |
| 330 | 302 | ||
| 331 | try { | 303 | try { |
| 332 | |||
| 333 | JSONObject jsonObject = JSON.parseObject(content, JSONObject.class); | 304 | JSONObject jsonObject = JSON.parseObject(content, JSONObject.class); |
| 334 | if (Objects.nonNull(content)) { | 305 | if (Objects.nonNull(content)) { |
| 335 | String evt = jsonObject.get("evt").toString(); | 306 | String evt = jsonObject.get("evt").toString(); |
| ... | @@ -353,13 +324,11 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -353,13 +324,11 @@ public class UcGatewayIptv2IptvConsumer { |
| 353 | } | 324 | } |
| 354 | } | 325 | } |
| 355 | 326 | ||
| 356 | // channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); | ||
| 357 | |||
| 358 | } catch (Exception e) { | 327 | } catch (Exception e) { |
| 359 | 328 | ||
| 360 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | 329 | log.error("删除收藏记录事件处理异常,cause ==>> {}", e.getMessage()); |
| 361 | 330 | ||
| 362 | if (MapUtils.isNotEmpty(error)) { | 331 | /* if (MapUtils.isNotEmpty(error)) { |
| 363 | String errorStart = this.error.get("start"); | 332 | String errorStart = this.error.get("start"); |
| 364 | 333 | ||
| 365 | if (errorStart.equalsIgnoreCase("true")) { | 334 | if (errorStart.equalsIgnoreCase("true")) { |
| ... | @@ -369,21 +338,24 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -369,21 +338,24 @@ public class UcGatewayIptv2IptvConsumer { |
| 369 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | 338 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 370 | } | 339 | } |
| 371 | 340 | ||
| 372 | } | 341 | }*/ |
| 342 | |||
| 373 | 343 | ||
| 374 | e.printStackTrace(); | ||
| 375 | } | 344 | } |
| 376 | } | 345 | } |
| 377 | 346 | ||
| 378 | /** | 347 | /** |
| 379 | * @description 添加收藏记录 | 348 | * @description 删除全部收藏记录 |
| 380 | * @param content 消息内容 | 349 | * @param content 消息内容 |
| 381 | */ | 350 | */ |
| 382 | @RabbitHandler | 351 | /*@RabbitHandler |
| 383 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueDeleteAll()}", | 352 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueDeleteAll()}", |
| 384 | containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}", | 353 | containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}", |
| 385 | autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}", | 354 | autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}", |
| 386 | ackMode = "MANUAL") | 355 | ackMode = "MANUAL")*/ |
| 356 | @RabbitHandler | ||
| 357 | @RabbitListener(queues = "#{rabbitMqConfig.getUcgCollectionQueueDeleteAll()}", | ||
| 358 | ackMode = "AUTO") | ||
| 387 | public void collectionConsumerDeleteAll(Channel channel, Message message, String content) throws IOException { | 359 | public void collectionConsumerDeleteAll(Channel channel, Message message, String content) throws IOException { |
| 388 | log.info("receive collectionConsumerDeleteAll add message, content {}", content); | 360 | log.info("receive collectionConsumerDeleteAll add message, content {}", content); |
| 389 | 361 | ||
| ... | @@ -412,13 +384,10 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -412,13 +384,10 @@ public class UcGatewayIptv2IptvConsumer { |
| 412 | } | 384 | } |
| 413 | } | 385 | } |
| 414 | 386 | ||
| 415 | // channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); | ||
| 416 | |||
| 417 | } catch (Exception e) { | 387 | } catch (Exception e) { |
| 388 | log.error("删除全部收藏记录事件处理异常,cause ==>> {}", e.getMessage()); | ||
| 418 | 389 | ||
| 419 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | 390 | /*if (MapUtils.isNotEmpty(error)) { |
| 420 | |||
| 421 | if (MapUtils.isNotEmpty(error)) { | ||
| 422 | String errorStart = this.error.get("start"); | 391 | String errorStart = this.error.get("start"); |
| 423 | 392 | ||
| 424 | if (errorStart.equalsIgnoreCase("true")) { | 393 | if (errorStart.equalsIgnoreCase("true")) { |
| ... | @@ -428,9 +397,13 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -428,9 +397,13 @@ public class UcGatewayIptv2IptvConsumer { |
| 428 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | 397 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 429 | } | 398 | } |
| 430 | 399 | ||
| 431 | } | 400 | }*/ |
| 432 | |||
| 433 | e.printStackTrace(); | ||
| 434 | } | 401 | } |
| 435 | } | 402 | } |
| 403 | |||
| 404 | |||
| 405 | |||
| 406 | |||
| 407 | |||
| 408 | |||
| 436 | } | 409 | } | ... | ... |
| ... | @@ -29,10 +29,8 @@ public class WeiXinEventConsumer { | ... | @@ -29,10 +29,8 @@ public class WeiXinEventConsumer { |
| 29 | @Autowired | 29 | @Autowired |
| 30 | private RestTemplateClient restTemplateClient; | 30 | private RestTemplateClient restTemplateClient; |
| 31 | 31 | ||
| 32 | private static final String QR_CODE_URL = "QR_CODE_URL_"; | 32 | /*@Value("#{rabbitMqErrorLogConfig.getWechatError()}") |
| 33 | 33 | private Map<String, String> error;*/ | |
| 34 | @Value("#{rabbitMqErrorLogConfig.getWechatError()}") | ||
| 35 | private Map<String, String> error; | ||
| 36 | 34 | ||
| 37 | 35 | ||
| 38 | /** | 36 | /** |
| ... | @@ -44,11 +42,12 @@ public class WeiXinEventConsumer { | ... | @@ -44,11 +42,12 @@ public class WeiXinEventConsumer { |
| 44 | * } | 42 | * } |
| 45 | * @param content | 43 | * @param content |
| 46 | */ | 44 | */ |
| 47 | @RabbitHandler | 45 | /*@RabbitHandler |
| 48 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getWechatQueue()}", | 46 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getWechatQueue()}", |
| 49 | containerFactory = "#{rabbitMqSourceConfig.getWechatSource()}", | 47 | containerFactory = "#{rabbitMqSourceConfig.getWechatSource()}", |
| 50 | autoStartup = "#{rabbitMqSourceConfig.getWechatStartUp()}", ackMode = "AUTO") | 48 | autoStartup = "#{rabbitMqSourceConfig.getWechatStartUp()}", ackMode = "AUTO")*/ |
| 51 | @Transactional | 49 | @RabbitHandler |
| 50 | @RabbitListener(queues = "#{rabbitMqConfig.getWechatQueue()}", ackMode = "AUTO") | ||
| 52 | public void subOrUnSubEvent(Channel channel, Message message, String content) throws IOException { | 51 | public void subOrUnSubEvent(Channel channel, Message message, String content) throws IOException { |
| 53 | try { | 52 | try { |
| 54 | log.info("receive wxu subOrUnSub message, content {}", content); | 53 | log.info("receive wxu subOrUnSub message, content {}", content); |
| ... | @@ -92,7 +91,7 @@ public class WeiXinEventConsumer { | ... | @@ -92,7 +91,7 @@ public class WeiXinEventConsumer { |
| 92 | } catch (Exception e) { | 91 | } catch (Exception e) { |
| 93 | log.error("WXSubscribeConsumer || subOrUnSub msg error || {} || {}", content, e.getMessage()); | 92 | log.error("WXSubscribeConsumer || subOrUnSub msg error || {} || {}", content, e.getMessage()); |
| 94 | 93 | ||
| 95 | channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); | 94 | /*channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); |
| 96 | 95 | ||
| 97 | if (MapUtils.isNotEmpty(error)) { | 96 | if (MapUtils.isNotEmpty(error)) { |
| 98 | String errorStart = this.error.get("start"); | 97 | String errorStart = this.error.get("start"); |
| ... | @@ -104,9 +103,8 @@ public class WeiXinEventConsumer { | ... | @@ -104,9 +103,8 @@ public class WeiXinEventConsumer { |
| 104 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | 103 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); |
| 105 | } | 104 | } |
| 106 | 105 | ||
| 107 | } | 106 | }*/ |
| 108 | 107 | ||
| 109 | e.printStackTrace(); | ||
| 110 | log.info("ucEventConsumer ====>>>> end"); | 108 | log.info("ucEventConsumer ====>>>> end"); |
| 111 | } | 109 | } |
| 112 | 110 | ... | ... |
| ... | @@ -28,23 +28,4 @@ public class DataSyncMsg implements Serializable { | ... | @@ -28,23 +28,4 @@ public class DataSyncMsg implements Serializable { |
| 28 | // 消息体 | 28 | // 消息体 |
| 29 | private String msgData; | 29 | private String msgData; |
| 30 | 30 | ||
| 31 | /** | ||
| 32 | * 消息体 | ||
| 33 | */ | ||
| 34 | @Data | ||
| 35 | @AllArgsConstructor | ||
| 36 | @NoArgsConstructor | ||
| 37 | public static class MsgData { | ||
| 38 | private Long memberId; // 会员id | ||
| 39 | private String memberCode; | ||
| 40 | private Long orderId; | ||
| 41 | private Long activityId; | ||
| 42 | private Long mediaId; | ||
| 43 | private Long itemId; | ||
| 44 | private String description; | ||
| 45 | |||
| 46 | private String param; | ||
| 47 | private String platformAccount; | ||
| 48 | } | ||
| 49 | |||
| 50 | } | 31 | } | ... | ... |
| ... | @@ -2,16 +2,16 @@ package com.topdraw.resttemplate; | ... | @@ -2,16 +2,16 @@ package com.topdraw.resttemplate; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 5 | import com.topdraw.business.ResponseStatus; |
| 6 | import com.topdraw.mq.domain.DataSyncMsg; | 6 | import com.topdraw.mq.domain.DataSyncMsg; |
| 7 | import com.topdraw.mq.domain.SubscribeBean; | 7 | import com.topdraw.mq.domain.SubscribeBean; |
| 8 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| 9 | import org.apache.commons.lang3.StringUtils; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.core.env.Environment; | 10 | import org.springframework.core.env.Environment; |
| 12 | import org.springframework.http.ResponseEntity; | 11 | import org.springframework.http.ResponseEntity; |
| 13 | import org.springframework.http.client.SimpleClientHttpRequestFactory; | 12 | import org.springframework.http.client.SimpleClientHttpRequestFactory; |
| 14 | import org.springframework.stereotype.Component; | 13 | import org.springframework.stereotype.Component; |
| 14 | import org.springframework.util.Base64Utils; | ||
| 15 | import org.springframework.web.client.RestTemplate; | 15 | import org.springframework.web.client.RestTemplate; |
| 16 | 16 | ||
| 17 | import javax.annotation.PostConstruct; | 17 | import javax.annotation.PostConstruct; |
| ... | @@ -41,158 +41,194 @@ public class RestTemplateClient { | ... | @@ -41,158 +41,194 @@ public class RestTemplateClient { |
| 41 | restTemplate = new RestTemplate(factory); | 41 | restTemplate = new RestTemplate(factory); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | public JSONObject dealTask(DataSyncMsg dataSyncMsg) { | 44 | public boolean dealTask(DataSyncMsg dataSyncMsg) { |
| 45 | String url = BASE_URL + "/uce/taskOperation/dealTask"; | 45 | try { |
| 46 | log.info("request uc : url is " + url + ", dataSyncMsg is " + dataSyncMsg); | 46 | String url = BASE_URL + "/uce/taskOperation/dealTask"; |
| 47 | String content = JSON.toJSONString(dataSyncMsg); | 47 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); |
| 48 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); | 48 | objectObjectHashMap.put("content", JSON.toJSONString(dataSyncMsg)); |
| 49 | objectObjectHashMap.put("content", content); | 49 | |
| 50 | log.info("===>>>" + content); | 50 | log.info("request url is ==>> {} || param is ==>> {} ", url, objectObjectHashMap); |
| 51 | restTemplate.postForEntity(url, objectObjectHashMap, String.class); | 51 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); |
| 52 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); | 52 | log.info("response ==>> {}", responseEntity); |
| 53 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 53 | |
| 54 | String entityBody = responseEntity.getBody();444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444被44444444444444 444444 44444 44444 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 | 54 | if (responseEntity.getStatusCode().is2xxSuccessful()) { |
| 55 | JSONObject jsonObject = JSONObject.parseObject(entityBody); | 55 | String entityBody = responseEntity.getBody(); |
| 56 | if (jsonObject.getInteger("businessCode").equals(200)) { | 56 | JSONObject jsonObject = JSONObject.parseObject(entityBody); |
| 57 | resultSet = jsonObject.getJSONArray("resultSet").getJSONObject(0); | 57 | if (jsonObject.getInteger("businessCode").equals(ResponseStatus.OK)) { |
| 58 | return true; | ||
| 59 | } | ||
| 58 | } | 60 | } |
| 61 | |||
| 62 | } catch (Exception e) { | ||
| 63 | log.error("处理普通权益任务(ApiUti.dealTask)信息时出现异常,cause ==>> {}", e.getMessage()); | ||
| 59 | } | 64 | } |
| 60 | log.info("uc response: " + resultSet.toJSONString()); | 65 | |
| 61 | return resultSet;*/ | 66 | return false; |
| 62 | return null; | ||
| 63 | } | 67 | } |
| 64 | 68 | ||
| 65 | public JSONObject getMemberInfo(Long memberId) { | 69 | public Boolean unsubscribe(SubscribeBean subscribeBean) { |
| 66 | JSONObject resultSet = null; | 70 | try { |
| 67 | String url = BASE_URL + "/uce/member/findById/" + memberId; | 71 | String url = BASE_URL + "/uce/userOperation/unsubscribe"; |
| 68 | log.info("request uc : url is " + url + ", memberId is " + memberId); | 72 | String content = JSON.toJSONString(subscribeBean); |
| 69 | ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); | 73 | |
| 70 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 74 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); |
| 71 | String entityBody = responseEntity.getBody(); | 75 | objectObjectHashMap.put("content", content); |
| 72 | JSONObject jsonObject = JSONObject.parseObject(entityBody); | 76 | |
| 73 | if (jsonObject.getInteger("businessCode").equals(200)) { | 77 | log.info("request url is ==>> {} || param is ==>> {} ", url, objectObjectHashMap); |
| 74 | resultSet = jsonObject.getJSONArray("resultSet").getJSONObject(0); | 78 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); |
| 75 | } | 79 | log.info("response ==>> {}", responseEntity); |
| 80 | |||
| 81 | return getParseResponseResultBoolean(responseEntity); | ||
| 82 | |||
| 83 | } catch (Exception e) { | ||
| 84 | log.error("处理微信取关(ApiUti.unsubscribe)信息时出现异常,cause ==>> {}", e.getMessage()); | ||
| 76 | } | 85 | } |
| 77 | log.info("uc response: " + resultSet.toJSONString()); | 86 | |
| 78 | return resultSet; | 87 | return null; |
| 79 | } | 88 | } |
| 80 | 89 | ||
| 81 | public String createMemberAddress(MemberAddress member) { | 90 | public Boolean subscribe(SubscribeBean subscribeBean) { |
| 82 | String url = BASE_URL + "/uce/memberAddress/create"; | 91 | try { |
| 83 | log.info("request uc : url is " + url + ", memberId is " + JSONObject.toJSONString(member)); | 92 | String url = BASE_URL + "/uce/userOperation/subscribe"; |
| 84 | restTemplate.postForEntity(url, member, String.class); | 93 | String content = JSON.toJSONString(subscribeBean); |
| 85 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, member, String.class); | 94 | |
| 86 | String entityBody = ""; | 95 | HashMap<String, String> objectObjectHashMap = new HashMap<>(); |
| 87 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 96 | objectObjectHashMap.put("content", content); |
| 88 | entityBody = responseEntity.getBody(); | 97 | |
| 98 | log.info("request url is ==>> {} || param is ==>> {} ", url, objectObjectHashMap); | ||
| 99 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); | ||
| 100 | log.info("response ==>> {}", responseEntity); | ||
| 101 | |||
| 102 | return getParseResponseResultBoolean(responseEntity); | ||
| 103 | |||
| 104 | } catch (Exception e) { | ||
| 105 | log.error("处理微信关注(ApiUti.subscribe)信息时出现异常,cause ==>> {}", e.getMessage()); | ||
| 89 | } | 106 | } |
| 90 | log.info("uc response: " + entityBody);*/ | 107 | |
| 91 | return null; | 108 | return null; |
| 92 | } | 109 | } |
| 93 | 110 | ||
| 94 | public String unsubscribe(SubscribeBean subscribeBean) { | 111 | public JSONObject addCollection(String content) { |
| 95 | String url = BASE_URL + "/uce/userOperation/unsubscribe"; | 112 | try { |
| 96 | String content = JSON.toJSONString(subscribeBean); | 113 | String url = BASE_URL + "/uce/userOperation/addCollection"; |
| 97 | 114 | //处理接口调用 中文不显示问题 | |
| 98 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); | 115 | content = new String(Base64.getEncoder().encode(content.getBytes(StandardCharsets.UTF_8))); |
| 99 | objectObjectHashMap.put("content", content); | 116 | |
| 100 | log.info("reobjectObjectHashMap ===>> [{}]",objectObjectHashMap); | 117 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); |
| 101 | restTemplate.postForEntity(url, objectObjectHashMap, String.class); | 118 | log.info("response ==>> {}", responseEntity); |
| 102 | log.info("unsubscribe ===>> success"); | 119 | |
| 103 | /*ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, subscribeBean, String.class); | 120 | return getParseResponseResult(responseEntity); |
| 104 | String entityBody = ""; | 121 | } catch (Exception e) { |
| 105 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 122 | log.error("添加观影记录(ApiUti.addCollection)信息时出现异常,cause ==>> {}", e.getMessage()); |
| 106 | entityBody = responseEntity.getBody(); | ||
| 107 | } | 123 | } |
| 108 | log.info("uc response: " + entityBody);*/ | 124 | |
| 109 | return null; | 125 | return null; |
| 110 | } | 126 | } |
| 111 | 127 | ||
| 112 | public String subscribe(SubscribeBean subscribeBean) { | 128 | public JSONObject deleteCollection(String content) { |
| 113 | String url = BASE_URL + "/uce/userOperation/subscribe"; | 129 | try { |
| 114 | String content = JSON.toJSONString(subscribeBean); | 130 | String url = BASE_URL + "/uce/userOperation/deleteCollection"; |
| 115 | 131 | //处理接口调用 中文不显示问题 | |
| 116 | HashMap<String, String> objectObjectHashMap = new HashMap<>(); | 132 | content = new String(Base64.getEncoder().encode(content.getBytes(StandardCharsets.UTF_8))); |
| 117 | objectObjectHashMap.put("content", content); | 133 | |
| 118 | log.info("reobjectObjectHashMap ===>> [{}]",objectObjectHashMap); | 134 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); |
| 119 | restTemplate.postForEntity(url, objectObjectHashMap, String.class); | 135 | log.info("response ==>> {}", responseEntity); |
| 120 | log.info("send subscribe request ===>> success"); | 136 | |
| 121 | /*ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, subscribeBean, String.class); | 137 | return getParseResponseResult(responseEntity); |
| 122 | String entityBody = ""; | 138 | |
| 123 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 139 | } catch (Exception e) { |
| 124 | entityBody = responseEntity.getBody(); | 140 | log.error("删除一条观影记录(ApiUti.deleteCollection)信息时出现异常,cause ==>> {}", e.getMessage()); |
| 125 | } | 141 | } |
| 126 | log.info("uc response: " + entityBody);*/ | 142 | |
| 127 | return null; | 143 | return null; |
| 128 | } | 144 | } |
| 129 | 145 | ||
| 130 | public String sendQrCodeMessage(String content) { | 146 | public JSONObject deleteAllCollection(String content) { |
| 131 | String url = BASE_URL + "/uce/userOperation/sendQrCodeMessage"; | 147 | try { |
| 132 | restTemplate.postForEntity(url, content, String.class); | 148 | String url = BASE_URL + "/uce/userOperation/deleteAllCollection"; |
| 133 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); | 149 | |
| 134 | String entityBody = ""; | 150 | log.info("request url is ==>> {} || param is ==>> {} ", url, content); |
| 135 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 151 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); |
| 136 | entityBody = responseEntity.getBody(); | 152 | log.info("response ==>> {}", responseEntity); |
| 153 | |||
| 154 | return getParseResponseResult(responseEntity); | ||
| 155 | |||
| 156 | } catch (Exception e) { | ||
| 157 | log.error("删除所有观影记录(ApiUti.deleteAllCollection)信息时出现异常,cause ==>> {}", e.getMessage()); | ||
| 137 | } | 158 | } |
| 138 | log.info("uc response: " + entityBody);*/ | 159 | |
| 139 | return null; | 160 | return null; |
| 140 | } | 161 | } |
| 141 | 162 | ||
| 142 | public String addCollection(String content) { | 163 | public boolean saveGrowthReport(String content) { |
| 143 | String url = BASE_URL + "/uce/userOperation/addCollection"; | 164 | try { |
| 144 | //处理接口调用 中文不显示问题 | 165 | String url = BASE_URL + "/uce/userOperation/saveGrowthReport"; |
| 145 | content = new String(Base64.getEncoder().encode(content.getBytes(StandardCharsets.UTF_8))); | 166 | String encode = Base64Utils.encodeToString(content.getBytes()); |
| 167 | log.info("request url is ==>> {} || param is ==>> {} ", url, encode); | ||
| 168 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, encode, String.class); | ||
| 169 | log.info("response ==>> {}", responseEntity); | ||
| 146 | 170 | ||
| 147 | restTemplate.postForEntity(url, content, String.class); | 171 | return getParseResponseResultBoolean(responseEntity); |
| 148 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); | 172 | |
| 149 | String entityBody = ""; | 173 | } catch (Exception e) { |
| 150 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 174 | log.error("保存成长报告(ApiUti.saveGrowthReport)信息时出现异常,cause ==>> {}", e.getMessage()); |
| 151 | entityBody = responseEntity.getBody(); | ||
| 152 | } | 175 | } |
| 153 | log.info("uc response: " + entityBody);*/ | 176 | |
| 154 | return null; | 177 | return false; |
| 155 | } | 178 | } |
| 156 | 179 | ||
| 157 | public String deleteCollection(String content) { | 180 | public JSONObject dealViewRecord(String content) { |
| 158 | String url = BASE_URL + "/uce/userOperation/deleteCollection"; | 181 | try { |
| 159 | //处理接口调用 中文不显示问题 | 182 | String url = BASE_URL + "/uce/userOperation/addCollection"; |
| 160 | content = new String(Base64.getEncoder().encode(content.getBytes(StandardCharsets.UTF_8))); | 183 | //处理接口调用 中文不显示问题 |
| 184 | content = new String(Base64.getEncoder().encode(content.getBytes(StandardCharsets.UTF_8))); | ||
| 185 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); | ||
| 186 | log.info("response ==>> {}", responseEntity); | ||
| 161 | 187 | ||
| 162 | restTemplate.postForEntity(url, content, String.class); | 188 | return getParseResponseResult(responseEntity); |
| 163 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); | 189 | |
| 164 | String entityBody = ""; | 190 | } catch (Exception e) { |
| 165 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 191 | log.error("处理观影记录(ApiUti.dealViewRecord)信息时出现异常,cause ==>> {}", e.getMessage()); |
| 166 | entityBody = responseEntity.getBody(); | ||
| 167 | } | 192 | } |
| 168 | log.info("uc response: " + entityBody);*/ | 193 | |
| 169 | return null; | 194 | return null; |
| 170 | } | 195 | } |
| 171 | 196 | ||
| 172 | public String deleteAllCollection(String content) { | 197 | /** |
| 173 | String url = BASE_URL + "/uce/userOperation/deleteAllCollection"; | 198 | * |
| 174 | restTemplate.postForEntity(url, content, String.class); | 199 | * @param responseEntity |
| 175 | /*ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); | 200 | * @return |
| 176 | String entityBody = ""; | 201 | */ |
| 202 | private static Boolean getParseResponseResultBoolean(ResponseEntity<String> responseEntity) { | ||
| 203 | |||
| 204 | Boolean resultSet = null; | ||
| 177 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 205 | if (responseEntity.getStatusCode().is2xxSuccessful()) { |
| 178 | entityBody = responseEntity.getBody(); | 206 | String entityBody = responseEntity.getBody(); |
| 207 | JSONObject jsonObject = JSONObject.parseObject(entityBody); | ||
| 208 | if (jsonObject.getInteger("businessCode").equals(ResponseStatus.OK)) { | ||
| 209 | resultSet = jsonObject.getJSONArray("resultSet").getBoolean(0); | ||
| 210 | } | ||
| 179 | } | 211 | } |
| 180 | log.info("uc response: " + entityBody);*/ | 212 | log.info("result ==>> {}", resultSet); |
| 181 | return null; | 213 | return resultSet; |
| 182 | } | 214 | } |
| 183 | 215 | ||
| 184 | public String dealViewRecord(String content) { | 216 | /** |
| 185 | String url = BASE_URL + "/uce/userOperation/addCollection"; | 217 | * |
| 186 | //处理接口调用 中文不显示问题 | 218 | * @param responseEntity |
| 187 | content = new String(Base64.getEncoder().encode(content.getBytes(StandardCharsets.UTF_8))); | 219 | * @return |
| 220 | */ | ||
| 221 | private static JSONObject getParseResponseResult(ResponseEntity<String> responseEntity) { | ||
| 188 | 222 | ||
| 189 | restTemplate.postForEntity(url, content, String.class); | 223 | JSONObject resultSet = null; |
| 190 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); | ||
| 191 | String entityBody = ""; | ||
| 192 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 224 | if (responseEntity.getStatusCode().is2xxSuccessful()) { |
| 193 | entityBody = responseEntity.getBody(); | 225 | String entityBody = responseEntity.getBody(); |
| 226 | JSONObject jsonObject = JSONObject.parseObject(entityBody); | ||
| 227 | if (jsonObject.getInteger("businessCode").equals(ResponseStatus.OK)) { | ||
| 228 | resultSet = jsonObject.getJSONArray("resultSet").getJSONObject(0); | ||
| 229 | } | ||
| 194 | } | 230 | } |
| 195 | log.info("uc response: " + entityBody);*/ | 231 | log.info("result ==>> {}", resultSet); |
| 196 | return null; | 232 | return resultSet; |
| 197 | } | 233 | } |
| 198 | } | 234 | } | ... | ... |
| ... | @@ -2,6 +2,7 @@ package com.topdraw.util; | ... | @@ -2,6 +2,7 @@ package com.topdraw.util; |
| 2 | 2 | ||
| 3 | import java.text.ParseException; | 3 | import java.text.ParseException; |
| 4 | import java.text.SimpleDateFormat; | 4 | import java.text.SimpleDateFormat; |
| 5 | import java.util.Calendar; | ||
| 5 | import java.util.Date; | 6 | import java.util.Date; |
| 6 | 7 | ||
| 7 | public class DateUtil { | 8 | public class DateUtil { |
| ... | @@ -27,4 +28,28 @@ public class DateUtil { | ... | @@ -27,4 +28,28 @@ public class DateUtil { |
| 27 | 28 | ||
| 28 | return null; | 29 | return null; |
| 29 | } | 30 | } |
| 31 | |||
| 32 | public static String getWeekFirstDay() { | ||
| 33 | SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd"); | ||
| 34 | |||
| 35 | Calendar calendar1=Calendar.getInstance(); | ||
| 36 | |||
| 37 | calendar1.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); | ||
| 38 | |||
| 39 | System.out.println("本周日: "+sdf.format(calendar1.getTime())); | ||
| 40 | |||
| 41 | return sdf.format(calendar1.getTime()); | ||
| 42 | } | ||
| 43 | |||
| 44 | public static String getWeekLastDay() { | ||
| 45 | SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd"); | ||
| 46 | |||
| 47 | Calendar calendar1=Calendar.getInstance(); | ||
| 48 | calendar1.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); | ||
| 49 | |||
| 50 | System.out.println("本周六: "+sdf.format(calendar1.getTime())); | ||
| 51 | |||
| 52 | return sdf.format(calendar1.getTime()); | ||
| 53 | } | ||
| 54 | |||
| 30 | } | 55 | } | ... | ... |
| 1 | package com.topdraw.util; | ||
| 2 | |||
| 3 | public class WeChatConstants { | ||
| 4 | |||
| 5 | public static String HTTPS_AUTHORIZE_WITH_SNSAPI_USERINFO = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; | ||
| 6 | |||
| 7 | public static final String HTTPS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token"; | ||
| 8 | |||
| 9 | public static final String HTTPS_TICKET_GETTICKET = "https://api.weixin.qq.com/cgi-bin/ticket/getticket"; | ||
| 10 | |||
| 11 | public static final String HTTPS_SNS_OAUTH2_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token"; | ||
| 12 | |||
| 13 | public static final String HTTPS_SNS_USERINFO = "https://api.weixin.qq.com/sns/userinfo"; | ||
| 14 | |||
| 15 | public static final String CODE2SESSION = "https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code"; | ||
| 16 | |||
| 17 | /** | ||
| 18 | * 把媒体文件上传到微信服务器。目前仅支持图片。用于发送客服消息或被动回复用户消息。 | ||
| 19 | */ | ||
| 20 | public static String UPLOAD_URL = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token={0}&type=image"; | ||
| 21 | |||
| 22 | /** | ||
| 23 | * 获取客服消息内的临时素材。即下载临时的多媒体文件。 | ||
| 24 | */ | ||
| 25 | public static String GET_MEDIA = "https://api.weixin.qq.com/cgi-bin/media/get?access_token={0}&media_id={1}"; | ||
| 26 | |||
| 27 | /** | ||
| 28 | * 用于向微信服务端申请二维码的url | ||
| 29 | */ | ||
| 30 | public static String URL_QR_CODE = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={0}"; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * 用于聊天时向用户发送消息的url | ||
| 34 | */ | ||
| 35 | public static String CUSTOM_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}"; | ||
| 36 | |||
| 37 | /** | ||
| 38 | * 发送小程序订阅消息 | ||
| 39 | */ | ||
| 40 | public static final String SUBSCRIBE_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token={0}"; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * 生成带参数二维码 | ||
| 44 | */ | ||
| 45 | public static final String QR_CODE_URL = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={0}"; | ||
| 46 | |||
| 47 | /** | ||
| 48 | * 获取用户基本信息 | ||
| 49 | */ | ||
| 50 | public static final String GET_USER_INFO = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN"; | ||
| 51 | |||
| 52 | |||
| 53 | // 批量获取关注者列表 | ||
| 54 | public static final String GET_USER_LIST = "https://api.weixin.qq.com/cgi-bin/user/get?access_token={0}&next_openid={1}"; | ||
| 55 | |||
| 56 | /** | ||
| 57 | * 成功 | ||
| 58 | */ | ||
| 59 | public static String SUCCESS = "SUCCESS"; | ||
| 60 | |||
| 61 | /** | ||
| 62 | * 微信系统错误 | ||
| 63 | */ | ||
| 64 | public static String SYSTEMERROR = "SYSTEMERROR"; | ||
| 65 | |||
| 66 | /** | ||
| 67 | * 失败 (注意:微信有的接口返回的失败用FAIL字符串表示,有的接口用FAILED表示) | ||
| 68 | */ | ||
| 69 | public static String FAIL = "FAIL"; | ||
| 70 | |||
| 71 | /** | ||
| 72 | * 微信企业付款到个人失败 (注意:微信有的接口返回的失败用FAIL字符串表示,有的接口用FAILED表示) | ||
| 73 | */ | ||
| 74 | public static String FAILED = "FAILED"; | ||
| 75 | |||
| 76 | public static String ACCESS_TOKEN = "access_token"; | ||
| 77 | |||
| 78 | public static String ERR_CODE = "errcode"; | ||
| 79 | |||
| 80 | /** | ||
| 81 | * 微信请求时,返回ACCESS_TOKEN错误码 | ||
| 82 | */ | ||
| 83 | public static final String ACCESS_TOKEN_INVALID_CODE = "40001"; | ||
| 84 | |||
| 85 | |||
| 86 | /** | ||
| 87 | * 文本消息 | ||
| 88 | */ | ||
| 89 | public static String MSG_TYPE_TEXT = "text"; | ||
| 90 | |||
| 91 | public static String MSG_TYPE_MINIPROGRAMPAGE = "miniprogrampage"; | ||
| 92 | |||
| 93 | public static String MSG_TYPE_LINK = "link"; | ||
| 94 | |||
| 95 | public static String MSG_TYPE_IMAGE = "image"; | ||
| 96 | |||
| 97 | /** | ||
| 98 | * 事件消息 | ||
| 99 | */ | ||
| 100 | public static String MSG_TYPE_EVENT = "event"; | ||
| 101 | |||
| 102 | |||
| 103 | /** | ||
| 104 | * 二维码类型,临时的整型参数值 | ||
| 105 | */ | ||
| 106 | public static String QR_SCENE = "QR_SCENE"; | ||
| 107 | |||
| 108 | /** | ||
| 109 | * 二维码类型,临时的字符串参数值 | ||
| 110 | */ | ||
| 111 | public static String QR_STR_SCENE = "QR_STR_SCENE"; | ||
| 112 | |||
| 113 | /** | ||
| 114 | * 二维码类型,永久的整型参数值 | ||
| 115 | */ | ||
| 116 | public static String QR_LIMIT_SCENE = "QR_LIMIT_SCENE"; | ||
| 117 | |||
| 118 | /** | ||
| 119 | * 二维码类型,永久的字符串参数值 | ||
| 120 | */ | ||
| 121 | public static String QR_LIMIT_STR_SCENE = "QR_LIMIT_STR_SCENE"; | ||
| 122 | |||
| 123 | |||
| 124 | /******** 事件推送事件类型BEGIN********/ | ||
| 125 | |||
| 126 | /** | ||
| 127 | * 取消订阅 | ||
| 128 | */ | ||
| 129 | public static final String EVENT_UNSUBSCRIBE = "unsubscribe"; | ||
| 130 | |||
| 131 | |||
| 132 | /** | ||
| 133 | * 订阅 | ||
| 134 | */ | ||
| 135 | public static final String EVENT_SUBSCRIBE = "subscribe"; | ||
| 136 | |||
| 137 | /** | ||
| 138 | * 扫描带参数二维码事件,用户已关注时的事件推送 | ||
| 139 | */ | ||
| 140 | public static final String EVENT_SCAN = "SCAN"; | ||
| 141 | |||
| 142 | /** | ||
| 143 | * 上报地理位置事件 | ||
| 144 | */ | ||
| 145 | public static final String EVENT_LOCATION = "LOCATION"; | ||
| 146 | |||
| 147 | /** | ||
| 148 | * 自定义菜单事件 | ||
| 149 | */ | ||
| 150 | public static final String EVENT_CLICK = "CLICK"; | ||
| 151 | |||
| 152 | /******** 事件推送事件类型END********/ | ||
| 153 | |||
| 154 | |||
| 155 | /** | ||
| 156 | * 微信ACCESS_TOKEN缓存KEY | ||
| 157 | */ | ||
| 158 | public static final String TOKEN_KEY = "GLOBAL_WX_ACCESS_TOKEN_"; | ||
| 159 | |||
| 160 | |||
| 161 | /** | ||
| 162 | * 微信临时素材缓存KEY | ||
| 163 | */ | ||
| 164 | public static final String WEIXIN_MEDIA_KEY = "WEIXIN_MEDIA_KEY_"; | ||
| 165 | |||
| 166 | // 微信应用类型 小程序 服务号 订阅号 | ||
| 167 | // 小程序 | ||
| 168 | public static final String WX_APPLET = "applet"; | ||
| 169 | // 服务号 | ||
| 170 | public static final String WX_SERVICE = "service"; | ||
| 171 | // 订阅号 | ||
| 172 | public static final String WX_SUBSCRIPTION = "subscription"; | ||
| 173 | |||
| 174 | |||
| 175 | } |
| 1 | spring: | ||
| 2 | # 数据源 | ||
| 3 | datasource: | ||
| 4 | url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user_iptv?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
| 5 | username: root | ||
| 6 | password: root | ||
| 7 | # 驱动程序 | ||
| 8 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy | ||
| 9 | # Druid | ||
| 10 | type: com.alibaba.druid.pool.DruidDataSource | ||
| 11 | druid: | ||
| 12 | # 初始化配置 | ||
| 13 | initial-size: 3 | ||
| 14 | # 最小连接数 | ||
| 15 | min-idle: 3 | ||
| 16 | # 最大连接数 | ||
| 17 | max-active: 15 | ||
| 18 | # 获取连接超时时间 | ||
| 19 | max-wait: 5000 | ||
| 20 | # 连接有效性检测时间 | ||
| 21 | time-between-eviction-runs-millis: 90000 | ||
| 22 | # 最大空闲时间 | ||
| 23 | min-evictable-idle-time-millis: 1800000 | ||
| 24 | test-while-idle: true | ||
| 25 | test-on-borrow: false | ||
| 26 | test-on-return: false | ||
| 27 | validation-query: select 1 | ||
| 28 | # 配置监控统计拦截的filters | ||
| 29 | filters: stat | ||
| 30 | stat-view-servlet: | ||
| 31 | url-pattern: /druid/* | ||
| 32 | reset-enable: false | ||
| 33 | # 过滤器 | ||
| 34 | web-stat-filter: | ||
| 35 | url-pattern: /* | ||
| 36 | exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*" | ||
| 37 | |||
| 38 | # jpa | ||
| 39 | jpa: | ||
| 40 | properties: | ||
| 41 | hibernate: | ||
| 42 | # 数据库类型 | ||
| 43 | dialect: org.hibernate.dialect.MySQL5InnoDBDialect | ||
| 44 | hibernate: | ||
| 45 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 | ||
| 46 | ddl-auto: none | ||
| 47 | open-in-view: true | ||
| 48 | |||
| 49 | # redis | ||
| 50 | redis: | ||
| 51 | #数据库索引 | ||
| 52 | database: 0 | ||
| 53 | host: 122.112.214.149 | ||
| 54 | port: 6379 | ||
| 55 | password: redis123 | ||
| 56 | #连接超时时间 | ||
| 57 | timeout: 5000 | ||
| 58 | |||
| 59 | |||
| 60 | ###########################################自定义属性################################################################# | ||
| 61 | # 多mq配置 | ||
| 62 | mutil-mq: | ||
| 63 | # 服务侧 | ||
| 64 | service: | ||
| 65 | # ip | ||
| 66 | host: 122.112.214.149 | ||
| 67 | # host: 139.196.145.150 | ||
| 68 | # 端口 | ||
| 69 | port: 5672 | ||
| 70 | # 用户名 | ||
| 71 | username: guest | ||
| 72 | # username: admin | ||
| 73 | # 密码 | ||
| 74 | password: guest | ||
| 75 | # password: Topdraw1qaz | ||
| 76 | # 虚拟空间 | ||
| 77 | virtual-host: member_center_chongshu | ||
| 78 | publisher-confirms: true #如果对异步消息需要回调必须设置为true | ||
| 79 | |||
| 80 | # 管理侧 | ||
| 81 | management: | ||
| 82 | # host: 122.112.214.149 # rabbitmq的连接地址 | ||
| 83 | host: 122.112.214.149 # rabbitmq的连接地址 | ||
| 84 | port: 5672 # rabbitmq的连接端口号 | ||
| 85 | virtual-host: member_center # rabbitmq的虚拟host | ||
| 86 | username: guest # rabbitmq的用户名 | ||
| 87 | password: guest # rabbitmq的密码 | ||
| 88 | # username: admin # rabbitmq的用户名 | ||
| 89 | # password: Topdraw1qaz # rabbitmq的密码 | ||
| 90 | publisher-confirms: true #如果对异步消息需要回调必须设置为true | ||
| 91 | |||
| 92 | # 服务属性 | ||
| 93 | service: | ||
| 94 | mq: | ||
| 95 | list: | ||
| 96 | - source: event | ||
| 97 | exchange: event.exchange | ||
| 98 | queue: event.queue | ||
| 99 | exchange-type: direct | ||
| 100 | routing-key: | ||
| 101 | active: service | ||
| 102 | - source: collection | ||
| 103 | exchange: collection.exchange | ||
| 104 | queue: collection.queue | ||
| 105 | exchange-type: direct | ||
| 106 | routing-key: | ||
| 107 | active: service | ||
| 108 | - source: viewRecord | ||
| 109 | exchange: viewRecord.exchange | ||
| 110 | queue: viewRecord.queue | ||
| 111 | exchange-type: direct | ||
| 112 | routing-key: | ||
| 113 | active: service | ||
| 114 | - source: eventBus | ||
| 115 | exchange: uc.eventbus | ||
| 116 | queue: uc.eventbus | ||
| 117 | exchange-type: topic | ||
| 118 | routing-key: uc.eventbus.*.topic | ||
| 119 | active: service | ||
| 120 | - source: uce | ||
| 121 | exchange: uce.exchange | ||
| 122 | queue: uce.queue | ||
| 123 | exchange-type: direct | ||
| 124 | routing-key: | ||
| 125 | active: management | ||
| 126 | - source: wechat | ||
| 127 | exchange: weixin.exchange.direct | ||
| 128 | queue: weixin.subOrUnSub.queue | ||
| 129 | exchange-type: direct | ||
| 130 | routing-key: | ||
| 131 | active: | ||
| 132 | error: | ||
| 133 | logs: | ||
| 134 | list: | ||
| 135 | - type: eventBus | ||
| 136 | filePath: /logs/mq/eventBus/ | ||
| 137 | fileName: error | ||
| 138 | start: on | ||
| 139 | - type: ucg | ||
| 140 | filePath: /logs/mq/ucg/ | ||
| 141 | fileName: error | ||
| 142 | start: on | ||
| 143 | - type: uce | ||
| 144 | filePath: /logs/mq/uce/ | ||
| 145 | fileName: error | ||
| 146 | start: on | ||
| 147 | - type: wechat | ||
| 148 | filePath: /logs/mq/wechat/ | ||
| 149 | fileName: error | ||
| 150 | start: on | ||
| 151 | |||
| 152 | api: | ||
| 153 | baseUrl: http://127.0.0.1:8447 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | spring: | 1 | spring: |
| 2 | # 数据源 | 2 | # 数据源 |
| 3 | datasource: | 3 | datasource: |
| 4 | url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user_iptv?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | 4 | # url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user_iptv?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false |
| 5 | username: root | ||
| 6 | password: root | ||
| 7 | # url: jdbc:log4jdbc:mysql://139.196.145.150:3306/ucs_iptv_sichuan?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
| 8 | # username: root | 5 | # username: root |
| 9 | # password: Tjlh@2021 | 6 | # password: root |
| 7 | url: jdbc:log4jdbc:mysql://139.196.145.150:3306/ucs_stage_vis?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
| 8 | username: root | ||
| 9 | password: Tjlh@2021 | ||
| 10 | # 驱动程序 | 10 | # 驱动程序 |
| 11 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy | 11 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy |
| 12 | # Druid | 12 | # Druid |
| ... | @@ -48,6 +48,7 @@ spring: | ... | @@ -48,6 +48,7 @@ spring: |
| 48 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 | 48 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 |
| 49 | ddl-auto: none | 49 | ddl-auto: none |
| 50 | open-in-view: true | 50 | open-in-view: true |
| 51 | # 不打印sql语句 | ||
| 51 | show-sql: false | 52 | show-sql: false |
| 52 | 53 | ||
| 53 | # redis | 54 | # redis |
| ... | @@ -60,125 +61,13 @@ spring: | ... | @@ -60,125 +61,13 @@ spring: |
| 60 | #连接超时时间 | 61 | #连接超时时间 |
| 61 | timeout: 5000 | 62 | timeout: 5000 |
| 62 | 63 | ||
| 63 | 64 | rabbitmq: | |
| 64 | ###########################################自定义属性################################################################# | ||
| 65 | # 多mq配置 | ||
| 66 | mutil-mq: | ||
| 67 | # 服务侧 | ||
| 68 | service: | ||
| 69 | # ip | ||
| 70 | host: 122.112.214.149 | 65 | host: 122.112.214.149 |
| 71 | # host: 139.196.145.150 | ||
| 72 | # 端口 | ||
| 73 | port: 5672 | 66 | port: 5672 |
| 74 | # 用户名 | 67 | virtual-host: member_center_iptv_sichuan |
| 75 | username: guest | 68 | username: guest |
| 76 | # username: admin | ||
| 77 | # 密码 | ||
| 78 | password: guest | 69 | password: guest |
| 79 | # password: Topdraw1qaz | ||
| 80 | # 虚拟空间 | ||
| 81 | virtual-host: member_center_iptv_sichuan | ||
| 82 | # virtual-host: member_center_small_sichuan | ||
| 83 | publisher-confirms: true #如果对异步消息需要回调必须设置为true | ||
| 84 | |||
| 85 | # 管理侧 | ||
| 86 | management: | ||
| 87 | # host: 122.112.214.149 # rabbitmq的连接地址 | ||
| 88 | host: 122.112.214.149 # rabbitmq的连接地址 | ||
| 89 | port: 5672 # rabbitmq的连接端口号 | ||
| 90 | virtual-host: member_center_small_sichuan # rabbitmq的虚拟host | ||
| 91 | # virtual-host: member_center_small_chongshu # rabbitmq的虚拟host | ||
| 92 | username: guest # rabbitmq的用户名 | ||
| 93 | password: guest # rabbitmq的密码 | ||
| 94 | # username: admin # rabbitmq的用户名 | ||
| 95 | # password: Topdraw1qaz # rabbitmq的密码 | ||
| 96 | publisher-confirms: true #如果对异步消息需要回调必须设置为true | ||
| 97 | |||
| 98 | # 服务属性 | ||
| 99 | service: | ||
| 100 | mq: | ||
| 101 | list: | ||
| 102 | - source: event | ||
| 103 | exchange: event.exchange | ||
| 104 | queue: event.queue | ||
| 105 | exchange-type: direct | ||
| 106 | routing-key: | ||
| 107 | active: service | ||
| 108 | - source: collection | ||
| 109 | exchange: exchange.collection | ||
| 110 | queue: collection.queue | ||
| 111 | exchange-type: direct | ||
| 112 | routing-key: | ||
| 113 | active: service | ||
| 114 | - source: collection | ||
| 115 | exchange: userCenter_exchange | ||
| 116 | queue: queue.collection.add | ||
| 117 | exchange-type: direct | ||
| 118 | routing-key: route.UserCollection.add | ||
| 119 | active: service | ||
| 120 | - source: collection | ||
| 121 | exchange: userCenter_exchange | ||
| 122 | queue: queue.collection.delete | ||
| 123 | exchange-type: direct | ||
| 124 | routing-key: route.UserCollection.delete | ||
| 125 | active: service | ||
| 126 | - source: collection | ||
| 127 | exchange: userCenter_exchange | ||
| 128 | queue: queue.collection.deleteall | ||
| 129 | exchange-type: direct | ||
| 130 | routing-key: route.UserCollection.deleteall | ||
| 131 | active: service | ||
| 132 | |||
| 133 | # - source: viewRecord | ||
| 134 | # exchange: viewRecord.exchange | ||
| 135 | # queue: viewRecord.queue | ||
| 136 | # exchange-type: direct | ||
| 137 | # routing-key: | ||
| 138 | # active: service | ||
| 139 | - source: eventBus | ||
| 140 | exchange: uc.eventbus | ||
| 141 | queue: uc.eventbus | ||
| 142 | exchange-type: topic | ||
| 143 | routing-key: uc.eventbus.*.topic | ||
| 144 | active: service | ||
| 145 | - source: uce | ||
| 146 | exchange: uc.direct | ||
| 147 | queue: uc.route.key.direct.event.bbb | ||
| 148 | exchange-type: direct | ||
| 149 | routing-key: | ||
| 150 | active: management | ||
| 151 | - source: uce | ||
| 152 | exchange: exchange.MemberInfoSync | ||
| 153 | queue: queue.MemberInfoSync | ||
| 154 | exchange-type: direct | ||
| 155 | routing-key: | ||
| 156 | active: management | ||
| 157 | # - source: wechat | ||
| 158 | # exchange: weixin.subOrUnSub.direct | ||
| 159 | # queue: weixin.subOrUnSub.queue | ||
| 160 | # exchange-type: direct | ||
| 161 | # routing-key: | ||
| 162 | # active: active | ||
| 163 | error: | ||
| 164 | logs: | ||
| 165 | list: | ||
| 166 | - type: eventBus | ||
| 167 | filePath: /logs/mq/eventBus/ | ||
| 168 | fileName: error | ||
| 169 | start: on | ||
| 170 | - type: ucg | ||
| 171 | filePath: /logs/mq/ucg/ | ||
| 172 | fileName: error | ||
| 173 | start: on | ||
| 174 | - type: uce | ||
| 175 | filePath: /logs/mq/uce/ | ||
| 176 | fileName: error | ||
| 177 | start: on | ||
| 178 | - type: wechat | ||
| 179 | filePath: /logs/mq/wechat/ | ||
| 180 | fileName: error | ||
| 181 | start: on | ||
| 182 | |||
| 183 | api: | ||
| 184 | baseUrl: http://127.0.0.1:8447 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 70 | publisher-confirms: true | ||
| 71 | listener: | ||
| 72 | direct: | ||
| 73 | auto-startup: false | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | # 服务器 | ||
| 2 | server: | 1 | server: |
| 3 | # 服务端口号 | 2 | # >>> |
| 4 | port: 8448 | 3 | port: 8448 |
| 5 | 4 | ||
| 6 | spring: | 5 | spring: |
| 7 | # 服务 | ||
| 8 | application: | 6 | application: |
| 9 | # 服务名 | ||
| 10 | name: uc-consumer | 7 | name: uc-consumer |
| 11 | # 配置文件 | ||
| 12 | profiles: | 8 | profiles: |
| 13 | # 启动具体的配置文件 | ||
| 14 | active: dev | 9 | active: dev |
| 15 | 10 | ||
| 11 | # 第三方接口 | ||
| 12 | api: | ||
| 13 | baseUrl: http://127.0.0.1:8447 | ||
| 16 | 14 | ||
| 17 | 15 | ... | ... |
| ... | @@ -64,12 +64,12 @@ | ... | @@ -64,12 +64,12 @@ |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | <!--监控sql日志输出 --> | 66 | <!--监控sql日志输出 --> |
| 67 | <logger name="jdbc.sqlonly" level="INFO" additivity="false"> | 67 | <logger name="jdbc.sqlonly" level="OFF" 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> |
| 71 | 71 | ||
| 72 | <logger name="jdbc.resultset" level="ERROR" additivity="false"> | 72 | <logger name="jdbc.resultset" level="OFF" additivity="false"> |
| 73 | <appender-ref ref="console" /> | 73 | <appender-ref ref="console" /> |
| 74 | <appender-ref ref="info" /> | 74 | <appender-ref ref="info" /> |
| 75 | </logger> | 75 | </logger> | ... | ... |
| ... | @@ -18,11 +18,6 @@ public class RestTemplateTest extends BaseTest { | ... | @@ -18,11 +18,6 @@ public class RestTemplateTest extends BaseTest { |
| 18 | @Autowired | 18 | @Autowired |
| 19 | RestTemplateClient apiUtil; | 19 | RestTemplateClient apiUtil; |
| 20 | 20 | ||
| 21 | @Test | ||
| 22 | public void t(){ | ||
| 23 | JSONObject memberInfo = this.apiUtil.getMemberInfo(5L); | ||
| 24 | System.out.println(memberInfo); | ||
| 25 | } | ||
| 26 | 21 | ||
| 27 | @Test | 22 | @Test |
| 28 | public void error(){ | 23 | public void error(){ | ... | ... |
-
Please register or sign in to post a comment