Commit 06370947 06370947156ff752f1642230eee1da7b8de4fd70 by xianghan

1.按照规范修改配置文件,去除列表

1 parent 95065426
Showing 50 changed files with 1586 additions and 957 deletions
1 package com.topdraw.config; 1 package com.topdraw.business;
2 2
3 /** 3 /**
4 * @author : 4 * @author :
......
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 }
...@@ -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
......
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.resttemplate; 1 package com.topdraw.business.module.user.app.domain;
2 2
3 /** 3 /**
4 * @author : 4 * @author :
5 * @description: 5 * @description:
6 * @function : 6 * @function :
7 * @date :Created in 2022/6/18 17:45 7 * @date :Created in 2022/6/30 11:42
8 * @version: : 8 * @version: :
9 * @modified By: 9 * @modified By:
10 * @since : modified in 2022/6/18 17:45 10 * @since : modified in 2022/6/30 11:42
11 */ 11 */
12 public interface ResponseStatusConstant { 12 public interface UserAppBindStatusConstant {
13 13 // 绑定状态 0:解绑;1 绑定
14 String OK = "00000"; 14 Integer VALID_STATUS = 1;
15 Integer INVALID_STATUS = 0;
15 16
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.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 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.Optional;
11
12 /**
13 * @author XiangHan
14 * @date 2022-06-27
15 */
16 public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpecificationExecutor<UserApp> {
17
18 @Query(value = "SELECT ua.* FROM uc_user_app ua WHERE ua.`username` = ?1 and ua.`status` IN (0 , 1)", nativeQuery = true)
19 Optional<UserApp> findByUsername(String username);
20
21 Optional<UserApp> findByUsernameAndPassword(String username, String password);
22
23 @Modifying
24 @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `last_active_time` = now() WHERE `username` = ?1 AND `status` = 1 ", nativeQuery = true)
25 Integer updateLastActiveTime(String username);
26
27 @Modifying
28 @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `username` = ?1 AND `status` = 1", nativeQuery = true)
29 Integer updatePasswordByUsername(String username, String password);
30
31 @Modifying
32 @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, " +
33 " `headimgurl` = :#{#resources.headimgurl}, `email` = :#{#resources.email}, `cellphone` = :#{#resources.cellphone}, " +
34 " `gender` = :#{#resources.gender}, `birthday` = :#{#resources.birthday}, `tags` = :#{#resources.tags}, `description` = :#{#resources.description}" +
35 " WHERE `id` = :#{#resources.id}", nativeQuery = true)
36 Integer updateAppInfo(@Param("resources") UserApp resources);
37
38 @Modifying
39 @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `id` = ?1", nativeQuery = true)
40 Integer updatePasswordById(Long id, String password);
41
42 @Modifying
43 @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(),`delete_time` = now(), `status` = -1 WHERE `id` = ?1", nativeQuery = true)
44 Integer appCancellation(Long id);
45
46 @Modifying
47 @Query(value = "UPDATE `uc_user_app` SET `last_active_time` = now(), `nickname` = ?2, `headimgurl` = ?3 " +
48 " WHERE `username` = ?1 and `status` = 1 ", nativeQuery = true)
49 Integer updateAppLastActiveTimeAndNicknameAndHeadImg(String username, String nickname, String headimgurl);
50 }
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.service.dto.UserAppDTO;
6 import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO;
7
8 /**
9 * @author XiangHan
10 * @date 2022-06-27
11 */
12 public interface UserAppService {
13
14 /**
15 * 根据ID查询
16 * @param id ID
17 * @return UserAppDTO
18 */
19 UserAppDTO findById(Long id);
20
21 /**
22 * 检查账号和秘密
23 * @param username
24 * @return
25 */
26 UserAppDTO findByUsername(String username);
27
28
29 /**
30 *
31 * @param resources
32 */
33 UserAppDTO create(UserApp resources);
34
35 /**
36 *
37 * @param resources
38 */
39 UserAppDTO update(UserApp resources);
40
41 /**
42 *
43 * @param id
44 */
45 void delete(Long id);
46
47 /**
48 *
49 * @param resources
50 * @return
51 */
52 boolean updateLastActiveTime(UserAppBind resources);
53
54 /**
55 *
56 * @param resources
57 * @return
58 */
59 boolean updatePasswordByUsername(UserApp resources);
60
61 /**
62 *
63 * @param resources
64 * @return
65 */
66 boolean updatePasswordById(UserApp resources);
67
68 /**
69 *
70 * @param resources
71 * @return
72 */
73 boolean updateAppInfo(UserApp resources);
74
75
76 boolean appCancellation(Long id);
77
78
79 boolean updateAppLastActiveTimeAndNicknameAndHeadImg(UserApp resources);
80 }
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 }
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.user.app.domain.UserApp;
4 import com.topdraw.business.module.user.app.domain.UserAppBind;
5 import com.topdraw.business.module.user.app.repository.UserAppRepository;
6 import com.topdraw.business.module.user.app.repository.UserAppSimpleRepository;
7 import com.topdraw.business.module.user.app.service.UserAppService;
8 import com.topdraw.business.module.user.app.service.dto.UserAppDTO;
9 import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO;
10 import com.topdraw.business.module.user.app.service.mapper.UserAppMapper;
11 import com.topdraw.utils.ValidationUtil;
12 import lombok.extern.slf4j.Slf4j;
13 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.dao.EmptyResultDataAccessException;
15 import org.springframework.stereotype.Service;
16 import org.springframework.transaction.annotation.Propagation;
17 import org.springframework.transaction.annotation.Transactional;
18 import org.springframework.util.Assert;
19
20 import java.util.Objects;
21
22 /**
23 * @author XiangHan
24 * @date 2022-06-27
25 */
26 @Service
27 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
28 @Slf4j
29 public class UserAppServiceImpl implements UserAppService {
30
31 @Autowired
32 private UserAppRepository userAppRepository;
33 @Autowired
34 private UserAppSimpleRepository userAppSimpleRepository;
35 @Autowired
36 private UserAppMapper userAppMapper;
37
38
39 @Override
40 @Transactional(readOnly = true)
41 public UserAppDTO findById(Long id) {
42 UserApp userApp = this.userAppRepository.findById(id).orElseGet(UserApp::new);
43 ValidationUtil.isNull(userApp.getId(),"UserApp","id",id);
44 return this.userAppMapper.toDto(userApp);
45 }
46
47 @Override
48 @Transactional(readOnly = true)
49 public UserAppDTO findByUsername(String username) {
50 UserApp userApp = this.userAppRepository.findByUsername(username).orElseGet(UserApp::new);
51 return this.userAppMapper.toDto(userApp);
52 }
53
54 @Override
55 @Transactional(rollbackFor = Exception.class)
56 public UserAppDTO create(UserApp resources) {
57 UserApp userApp = this.userAppRepository.save(resources);
58 return this.userAppMapper.toDto(userApp);
59 }
60
61 @Override
62 @Transactional(rollbackFor = Exception.class)
63 public UserAppDTO update(UserApp resources) {
64 UserApp userApp = this.userAppRepository.findById(resources.getId()).orElseGet(UserApp::new);
65 ValidationUtil.isNull( userApp.getId(),"UserApp","id",resources.getId());
66 userApp.copy(resources);
67 UserApp _userApp = this.userAppRepository.save(userApp);
68 if (Objects.nonNull(_userApp.getId())) {
69 return this.userAppMapper.toDto(_userApp);
70 }
71
72 return this.userAppMapper.toDto(resources);
73 }
74
75 @Override
76 @Transactional(rollbackFor = Exception.class)
77 public void delete(Long id) {
78 Assert.notNull(id, "The given id must not be null!");
79 UserApp UserApp = this.userAppRepository.findById(id).orElseThrow(
80 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", UserApp.class, id), 1));
81 this.userAppRepository.delete(UserApp);
82 }
83
84 @Override
85 @Transactional(rollbackFor = Exception.class)
86 public boolean updateLastActiveTime(UserAppBind resources) {
87 return this.userAppRepository.updateLastActiveTime(resources.getUsername()) > 0;
88 }
89
90 @Override
91 @Transactional(rollbackFor = Exception.class)
92 public boolean updatePasswordByUsername(UserApp resources) {
93 return this.userAppRepository.updatePasswordByUsername(resources.getUsername(), resources.getPassword()) > 0;
94 }
95
96 @Override
97 @Transactional(rollbackFor = Exception.class)
98 public boolean updateAppInfo(UserApp resources) {
99
100 Long id = resources.getId();
101 UserApp userApp = this.userAppRepository.findById(id).orElseGet(UserApp::new);
102 if (Objects.isNull(userApp.getId())) {
103 log.error("修改app信息失败,app账号信息不存在[updateAppInfo#]");
104 return false;
105 }
106
107 userApp.copy(resources);
108
109 this.userAppRepository.updateAppInfo(userApp);
110
111 return true;
112 }
113
114 @Override
115 @Transactional(rollbackFor = Exception.class)
116 public boolean appCancellation(Long id) {
117 return this.userAppRepository.appCancellation(id) > 0;
118 }
119
120 @Override
121 @Transactional(rollbackFor = Exception.class)
122 public boolean updateAppLastActiveTimeAndNicknameAndHeadImg(UserApp resources) {
123 return this.userAppRepository.updateAppLastActiveTimeAndNicknameAndHeadImg(resources.getUsername(),
124 resources.getNickname(), resources.getHeadimgurl()) > 0;
125 }
126
127 @Override
128 @Transactional(rollbackFor = Exception.class)
129 public boolean updatePasswordById(UserApp resources) {
130 return this.userAppRepository.updatePasswordById(resources.getId(), resources.getPassword()) > 0;
131 }
132
133
134 }
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 }
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.process.domian;
2
3 public enum RightType {
4 /**积分*/
5 POINTS,
6 /**成长值*/
7 EXP,
8 /**优惠券券*/
9 COUPON,
10 /**权益统称*/
11 RIGHTS
12
13 }
1 package com.topdraw.business.process.domian.result;
2
3
4 import lombok.AllArgsConstructor;
5 import lombok.Data;
6 import lombok.NoArgsConstructor;
7
8 @Data
9 @AllArgsConstructor
10 @NoArgsConstructor
11 public class CustomPointsResult {
12 private boolean result;
13 private Long point;
14 }
1 package com.topdraw.business.process.domian.result;
2
3 public interface TaskTemplateType {
4
5 int TYPE_1 = 1;
6 int TYPE_2 = 2;
7 int TYPE_3 = 3;
8 int TYPE_4 = 4;
9
10 }
1 package com.topdraw.business.process.domian.weixin;
2
3
4 import lombok.Data;
5
6 @Data
7 public class BindBean extends WeiXinUserBean {
8
9 private Long platformUserId;
10
11 private String platformAccount;
12 }
1 package com.topdraw.business.process.domian.weixin;
2
3 import com.fasterxml.jackson.annotation.JsonFormat;
4 import lombok.Data;
5
6 import java.time.LocalDateTime;
7
8 /**
9 * 微信账户信息
10 * @author XiangHan
11 * @date 2021-01-18
12 */
13 @Data
14 public class BuyVipBean extends WeiXinUserBean {
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 }
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 }
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 }
1 package com.topdraw.business.process.service.builder;
2
3 import com.topdraw.business.process.domian.TempCoupon;
4
5 public class TempCouponBuilder {
6
7
8
9 public TempCoupon build(){
10 TempCoupon tempCoupon = new TempCoupon();
11
12 return tempCoupon;
13 }
14
15 }
...@@ -2,11 +2,23 @@ package com.topdraw.business.process.service.impl; ...@@ -2,11 +2,23 @@ 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;
5 import com.topdraw.business.module.member.profile.domain.MemberProfile; 7 import com.topdraw.business.module.member.profile.domain.MemberProfile;
6 import com.topdraw.business.module.member.profile.service.MemberProfileService; 8 import com.topdraw.business.module.member.profile.service.MemberProfileService;
7 import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; 9 import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
8 import com.topdraw.business.module.member.service.MemberService; 10 import com.topdraw.business.module.member.service.MemberService;
9 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;
10 import com.topdraw.business.module.user.iptv.domain.UserTv; 22 import com.topdraw.business.module.user.iptv.domain.UserTv;
11 import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; 23 import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport;
12 import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService; 24 import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService;
...@@ -24,6 +36,7 @@ import com.topdraw.exception.GlobeExceptionMsg; ...@@ -24,6 +36,7 @@ import com.topdraw.exception.GlobeExceptionMsg;
24 import com.topdraw.util.TimestampUtil; 36 import com.topdraw.util.TimestampUtil;
25 import lombok.extern.slf4j.Slf4j; 37 import lombok.extern.slf4j.Slf4j;
26 import org.apache.commons.lang3.StringUtils; 38 import org.apache.commons.lang3.StringUtils;
39 import org.springframework.aop.framework.AopContext;
27 import org.springframework.beans.BeanUtils; 40 import org.springframework.beans.BeanUtils;
28 import org.springframework.beans.factory.annotation.Autowired; 41 import org.springframework.beans.factory.annotation.Autowired;
29 import org.springframework.stereotype.Service; 42 import org.springframework.stereotype.Service;
...@@ -48,7 +61,90 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -48,7 +61,90 @@ public class UserOperationServiceImpl implements UserOperationService {
48 private MemberProfileService memberProfileService; 61 private MemberProfileService memberProfileService;
49 @Autowired 62 @Autowired
50 private GrowthReportService growthReportService; 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 }
51 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 }
52 148
53 public void asyncsaveGrowthReport(GrowthReport growthReport) { 149 public void asyncsaveGrowthReport(GrowthReport growthReport) {
54 String platformAccount = growthReport.getPlatformAccount(); 150 String platformAccount = growthReport.getPlatformAccount();
......
...@@ -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,8 +9,8 @@ import java.util.List; ...@@ -9,8 +9,8 @@ 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;
......
...@@ -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,13 +156,13 @@ public class RabbitMqSourceConfig { ...@@ -156,13 +156,13 @@ 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 163
164 164
165 @Value("#{rabbitMqCustomConfig.ucgGrowthReportInfo()}") 165 /*@Value("#{rabbitMqCustomConfig.ucgGrowthReportInfo()}")
166 private Map<String, String> ucgGrowthReportInfo; 166 private Map<String, String> ucgGrowthReportInfo;
167 167
168 public static final String GROWTH_REPORT_EXCHANGE = "growthReport.exchange"; 168 public static final String GROWTH_REPORT_EXCHANGE = "growthReport.exchange";
...@@ -252,10 +252,6 @@ public class RabbitMqSourceConfig { ...@@ -252,10 +252,6 @@ public class RabbitMqSourceConfig {
252 return "false"; 252 return "false";
253 } 253 }
254 254
255 /* public static final String COLLECTION_DELETE_ALL_QUEUE = "queue.collection.deleteall";
256 public static final String COLLECTION_ADD_QUEUE = "queue.collection.add";
257 public static final String COLLECTION_DELETE_QUEUE = "queue.collection.delete";*/
258
259 public static final String COLLECTION_EXCHANGE = "collection.exchange"; 255 public static final String COLLECTION_EXCHANGE = "collection.exchange";
260 public static final String COLLECTION_QUEUE = "collection.queue"; 256 public static final String COLLECTION_QUEUE = "collection.queue";
261 257
...@@ -356,11 +352,11 @@ public class RabbitMqSourceConfig { ...@@ -356,11 +352,11 @@ public class RabbitMqSourceConfig {
356 } 352 }
357 353
358 return "false"; 354 return "false";
359 } 355 }*/
360 356
361 /**************************************************uc-engine 2 uc-consumer*************************************************************/ 357 /**************************************************uc-engine 2 uc-consumer*************************************************************/
362 358
363 public static final String UCE_EXCHANGE = "uce.exchange"; 359 /*public static final String UCE_EXCHANGE = "uce.exchange";
364 public static final String UCE_QUEUE = "uce.queue"; 360 public static final String UCE_QUEUE = "uce.queue";
365 361
366 @Value("#{rabbitMqCustomConfig.getUceInfo()}") 362 @Value("#{rabbitMqCustomConfig.getUceInfo()}")
...@@ -407,12 +403,13 @@ public class RabbitMqSourceConfig { ...@@ -407,12 +403,13 @@ public class RabbitMqSourceConfig {
407 403
408 404
409 405
406
410 public String getMemberInfoAsyncQueue(){ 407 public String getMemberInfoAsyncQueue(){
411 return "queue.MemberInfoSync"; 408 return "queue.MemberInfoSync";
412 } 409 }*/
413 410
414 /**************************************************eventBus*************************************************************/ 411 /**************************************************eventBus*************************************************************/
415 public static final String UC_EVENTBUS_EXCHANGE = "uc.eventbus"; 412 /*public static final String UC_EVENTBUS_EXCHANGE = "uc.eventbus";
416 public static final String UC_EVENTBUS_KEY = "uc.eventbus.*.topic"; 413 public static final String UC_EVENTBUS_KEY = "uc.eventbus.*.topic";
417 public static final String UC_EVENTBUS_QUEUE = "uc.eventbus"; 414 public static final String UC_EVENTBUS_QUEUE = "uc.eventbus";
418 415
...@@ -454,11 +451,11 @@ public class RabbitMqSourceConfig { ...@@ -454,11 +451,11 @@ public class RabbitMqSourceConfig {
454 } 451 }
455 } 452 }
456 return "false"; 453 return "false";
457 } 454 }*/
458 455
459 /**************************************************wechat*************************************************************/ 456 /**************************************************wechat*************************************************************/
460 457
461 public static final String WEIXIN_EXCHANGE = "weixin.subOrUnSub.direct"; 458 /*public static final String WEIXIN_EXCHANGE = "weixin.subOrUnSub.direct";
462 public static final String WEIXIN_SUBORUNSUB_QUEUE = "weixin.subOrUnSub.queue"; 459 public static final String WEIXIN_SUBORUNSUB_QUEUE = "weixin.subOrUnSub.queue";
463 460
464 @Value("#{rabbitMqCustomConfig.getWechatInfo()}") 461 @Value("#{rabbitMqCustomConfig.getWechatInfo()}")
...@@ -500,5 +497,5 @@ public class RabbitMqSourceConfig { ...@@ -500,5 +497,5 @@ public class RabbitMqSourceConfig {
500 } 497 }
501 498
502 return "false"; 499 return "false";
503 } 500 }*/
504 } 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 }
......
...@@ -31,8 +31,8 @@ public class UcEventBusIptv2ManagementUcEngine { ...@@ -31,8 +31,8 @@ public class UcEventBusIptv2ManagementUcEngine {
31 @Autowired 31 @Autowired
32 private RestTemplateClient restTemplateClient; 32 private RestTemplateClient restTemplateClient;
33 33
34 @Value("#{rabbitMqErrorLogConfig.getEventBusError()}") 34 /*@Value("#{rabbitMqErrorLogConfig.getEventBusError()}")
35 private Map<String, String> error; 35 private Map<String, String> error;*/
36 36
37 /** 37 /**
38 * 事件 38 * 事件
...@@ -41,10 +41,13 @@ public class UcEventBusIptv2ManagementUcEngine { ...@@ -41,10 +41,13 @@ public class UcEventBusIptv2ManagementUcEngine {
41 * @author Hongyan Wang 41 * @author Hongyan Wang
42 * @date 2021/9/7 11:26 上午 42 * @date 2021/9/7 11:26 上午
43 */ 43 */
44 @RabbitHandler 44 /*@RabbitHandler
45 @RabbitListener(queues = "#{rabbitMqSourceConfig.getEventBusQueue()}", 45 @RabbitListener(queues = "#{rabbitMqSourceConfig.getEventBusQueue()}",
46 containerFactory = "#{rabbitMqSourceConfig.getEventBusSource()}", 46 containerFactory = "#{rabbitMqSourceConfig.getEventBusSource()}",
47 autoStartup = "#{rabbitMqSourceConfig.getEventBusStartUp()}", 47 autoStartup = "#{rabbitMqSourceConfig.getEventBusStartUp()}",
48 ackMode = "AUTO")*/
49 @RabbitHandler
50 @RabbitListener(queues = "#{rabbitMqConfig.getEventBusQueue()}",
48 ackMode = "AUTO") 51 ackMode = "AUTO")
49 public void eventBusConsumer(Channel channel, Message message, String content) throws Exception { 52 public void eventBusConsumer(Channel channel, Message message, String content) throws Exception {
50 log.info(" receive dataSync msg , content is ==>> {} ", content); 53 log.info(" receive dataSync msg , content is ==>> {} ", content);
...@@ -97,7 +100,7 @@ public class UcEventBusIptv2ManagementUcEngine { ...@@ -97,7 +100,7 @@ public class UcEventBusIptv2ManagementUcEngine {
97 log.error("eventBus 消费异常 ==>> {}",e.getMessage()); 100 log.error("eventBus 消费异常 ==>> {}",e.getMessage());
98 101
99 // TODO使用slf4j记录日志 102 // TODO使用slf4j记录日志
100 if (MapUtils.isNotEmpty(error)) { 103 /*if (MapUtils.isNotEmpty(error)) {
101 String errorStart = this.error.get("start"); 104 String errorStart = this.error.get("start");
102 105
103 if (errorStart.equalsIgnoreCase("true")) { 106 if (errorStart.equalsIgnoreCase("true")) {
...@@ -107,7 +110,7 @@ public class UcEventBusIptv2ManagementUcEngine { ...@@ -107,7 +110,7 @@ public class UcEventBusIptv2ManagementUcEngine {
107 FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); 110 FileUtil.writeStringToFile2(filePath1, content, e.getMessage());
108 } 111 }
109 112
110 } 113 }*/
111 114
112 } 115 }
113 log.info("eventBusConsumer ====>>>> end"); 116 log.info("eventBusConsumer ====>>>> end");
......
...@@ -29,8 +29,8 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -29,8 +29,8 @@ public class UcGatewayIptv2IptvConsumer {
29 @Autowired 29 @Autowired
30 RestTemplateClient restTemplateClient; 30 RestTemplateClient restTemplateClient;
31 31
32 @Value("#{rabbitMqErrorLogConfig.getUcgError()}") 32 /*@Value("#{rabbitMqErrorLogConfig.getUcgError()}")
33 private Map<String, String> error; 33 private Map<String, String> error;*/
34 34
35 /** 35 /**
36 * 事件 36 * 事件
...@@ -39,10 +39,13 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -39,10 +39,13 @@ public class UcGatewayIptv2IptvConsumer {
39 * @author Hongyan Wang 39 * @author Hongyan Wang
40 * @date 2021/9/7 11:26 上午 40 * @date 2021/9/7 11:26 上午
41 */ 41 */
42 @RabbitHandler 42 /*@RabbitHandler
43 @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgEventQueue()}", 43 @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgEventQueue()}",
44 containerFactory = "#{rabbitMqSourceConfig.getUcgEventSource()}", 44 containerFactory = "#{rabbitMqSourceConfig.getUcgEventSource()}",
45 autoStartup = "#{rabbitMqSourceConfig.getUcgEventStartUp()}", 45 autoStartup = "#{rabbitMqSourceConfig.getUcgEventStartUp()}",
46 ackMode = "AUTO")*/
47 @RabbitHandler
48 @RabbitListener(queues = "#{rabbitMqConfig.getUcgEventQueue()}",
46 ackMode = "AUTO") 49 ackMode = "AUTO")
47 public void eventConsumer(Channel channel, Message message, String content) throws IOException { 50 public void eventConsumer(Channel channel, Message message, String content) throws IOException {
48 log.info(" eventConsumer receive dataSync msg , content is : {} ", content); 51 log.info(" eventConsumer receive dataSync msg , content is : {} ", content);
...@@ -60,7 +63,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -60,7 +63,7 @@ public class UcGatewayIptv2IptvConsumer {
60 63
61 log.error("普通权益事件处理异常, ==>> {}", e.getMessage()); 64 log.error("普通权益事件处理异常, ==>> {}", e.getMessage());
62 65
63 if (MapUtils.isNotEmpty(error)) { 66 /*if (MapUtils.isNotEmpty(error)) {
64 String errorStart = this.error.get("start"); 67 String errorStart = this.error.get("start");
65 68
66 if (StringUtils.isEmpty(errorStart) || errorStart.equalsIgnoreCase("true")) { 69 if (StringUtils.isEmpty(errorStart) || errorStart.equalsIgnoreCase("true")) {
...@@ -70,9 +73,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -70,9 +73,7 @@ public class UcGatewayIptv2IptvConsumer {
70 FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); 73 FileUtil.writeStringToFile2(filePath1, content, e.getMessage());
71 } 74 }
72 75
73 } 76 }*/
74
75
76 } 77 }
77 log.info("ucEventConsumer ====>>>> end"); 78 log.info("ucEventConsumer ====>>>> end");
78 } 79 }
...@@ -83,10 +84,13 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -83,10 +84,13 @@ public class UcGatewayIptv2IptvConsumer {
83 * @description 删除全部收藏记录 84 * @description 删除全部收藏记录
84 * @param content 消息内容 85 * @param content 消息内容
85 */ 86 */
86 @RabbitHandler 87 /*@RabbitHandler
87 @RabbitListener(queues = "#{rabbitMqSourceConfig.getGrowthReportQueue()}", 88 @RabbitListener(queues = "#{rabbitMqSourceConfig.getGrowthReportQueue()}",
88 containerFactory = "#{rabbitMqSourceConfig.getGrowthReportSource()}", 89 containerFactory = "#{rabbitMqSourceConfig.getGrowthReportSource()}",
89 autoStartup = "#{rabbitMqSourceConfig.getGrowthReportStartUp()}", 90 autoStartup = "#{rabbitMqSourceConfig.getGrowthReportStartUp()}",
91 ackMode = "AUTO")*/
92 @RabbitHandler
93 @RabbitListener(queues = "#{rabbitMqConfig.getGrowthReportQueue()}",
90 ackMode = "AUTO") 94 ackMode = "AUTO")
91 public void dealGrowthReport(Channel channel, Message message, String content) throws IOException { 95 public void dealGrowthReport(Channel channel, Message message, String content) throws IOException {
92 log.info("receive dealGrowthReport add message, content {}", content); 96 log.info("receive dealGrowthReport add message, content {}", content);
...@@ -96,8 +100,8 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -96,8 +100,8 @@ public class UcGatewayIptv2IptvConsumer {
96 JSONObject jsonObject = JSON.parseObject(content, JSONObject.class); 100 JSONObject jsonObject = JSON.parseObject(content, JSONObject.class);
97 if (Objects.nonNull(content)) { 101 if (Objects.nonNull(content)) {
98 Object msgData = jsonObject.get("msgData"); 102 Object msgData = jsonObject.get("msgData");
99 JSONObject response = this.restTemplateClient.saveGrowthReport(JSON.toJSONString(msgData)); 103 Boolean response = this.restTemplateClient.saveGrowthReport(JSON.toJSONString(msgData));
100 if (Objects.isNull(response)) { 104 if (!response) {
101 log.error("同步大屏成长报告失败,uce接口响应超时"); 105 log.error("同步大屏成长报告失败,uce接口响应超时");
102 } 106 }
103 } 107 }
...@@ -105,7 +109,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -105,7 +109,7 @@ public class UcGatewayIptv2IptvConsumer {
105 } catch (Exception e) { 109 } catch (Exception e) {
106 log.error("同步大屏成长报告失败,cause ==>> {}", e.getMessage()); 110 log.error("同步大屏成长报告失败,cause ==>> {}", e.getMessage());
107 111
108 if (MapUtils.isNotEmpty(error)) { 112 /*if (MapUtils.isNotEmpty(error)) {
109 String errorStart = this.error.get("start"); 113 String errorStart = this.error.get("start");
110 114
111 if (errorStart.equalsIgnoreCase("true")) { 115 if (errorStart.equalsIgnoreCase("true")) {
...@@ -115,7 +119,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -115,7 +119,7 @@ public class UcGatewayIptv2IptvConsumer {
115 FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); 119 FileUtil.writeStringToFile2(filePath1, content, e.getMessage());
116 } 120 }
117 121
118 } 122 }*/
119 } 123 }
120 } 124 }
121 125
...@@ -124,10 +128,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -124,10 +128,7 @@ public class UcGatewayIptv2IptvConsumer {
124 * @param content 消息内容 128 * @param content 消息内容
125 */ 129 */
126 @RabbitHandler 130 @RabbitHandler
127 @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueue()}", 131 @RabbitListener(queues = "#{rabbitMqConfig.getUcgCollectionQueue()}", ackMode = "AUTO")
128 containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}",
129 autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}",
130 ackMode = "AUTO")
131 public void collectionConsumer(Channel channel, Message message, String content) throws IOException { 132 public void collectionConsumer(Channel channel, Message message, String content) throws IOException {
132 log.info("receive UserCollection add message, content {}", content); 133 log.info("receive UserCollection add message, content {}", content);
133 134
...@@ -160,7 +161,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -160,7 +161,7 @@ public class UcGatewayIptv2IptvConsumer {
160 161
161 log.error("收藏事件处理异常,cause ==>> {}", e.getMessage()); 162 log.error("收藏事件处理异常,cause ==>> {}", e.getMessage());
162 163
163 if (MapUtils.isNotEmpty(error)) { 164 /*if (MapUtils.isNotEmpty(error)) {
164 String errorStart = this.error.get("start"); 165 String errorStart = this.error.get("start");
165 166
166 if (errorStart.equalsIgnoreCase("true")) { 167 if (errorStart.equalsIgnoreCase("true")) {
...@@ -170,7 +171,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -170,7 +171,7 @@ public class UcGatewayIptv2IptvConsumer {
170 FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); 171 FileUtil.writeStringToFile2(filePath1, content, e.getMessage());
171 } 172 }
172 173
173 } 174 }*/
174 175
175 } 176 }
176 } 177 }
...@@ -179,11 +180,13 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -179,11 +180,13 @@ public class UcGatewayIptv2IptvConsumer {
179 * @description 处理观影记录 180 * @description 处理观影记录
180 * @param content 消息内容 181 * @param content 消息内容
181 */ 182 */
182 @RabbitHandler 183 /*@RabbitHandler
183 @RabbitListener(queues = "#{rabbitMqSourceConfig.getViewRecordQueue()}", 184 @RabbitListener(queues = "#{rabbitMqSourceConfig.getViewRecordQueue()}",
184 containerFactory = "#{rabbitMqSourceConfig.getViewRecordSource()}", 185 containerFactory = "#{rabbitMqSourceConfig.getViewRecordSource()}",
185 autoStartup = "#{rabbitMqSourceConfig.getViewRecordStartUp()}", 186 autoStartup = "#{rabbitMqSourceConfig.getViewRecordStartUp()}",
186 ackMode = "AUTO") 187 ackMode = "AUTO")*/
188 @RabbitHandler
189 @RabbitListener(queues = "#{rabbitMqConfig.getViewRecordQueue()}", ackMode = "AUTO")
187 public void viewRecordConsumer(Channel channel, Message message, String content) throws IOException { 190 public void viewRecordConsumer(Channel channel, Message message, String content) throws IOException {
188 log.info("viewRecordConsumer receive ViewRecord add message, content {}", content); 191 log.info("viewRecordConsumer receive ViewRecord add message, content {}", content);
189 192
...@@ -206,7 +209,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -206,7 +209,7 @@ public class UcGatewayIptv2IptvConsumer {
206 } catch (Exception e) { 209 } catch (Exception e) {
207 log.error("观影事件处理异常,cause ==>> {}", e.getMessage()); 210 log.error("观影事件处理异常,cause ==>> {}", e.getMessage());
208 211
209 if (MapUtils.isNotEmpty(error)) { 212 /*if (MapUtils.isNotEmpty(error)) {
210 String errorStart = this.error.get("start"); 213 String errorStart = this.error.get("start");
211 214
212 if (errorStart.equalsIgnoreCase("true")) { 215 if (errorStart.equalsIgnoreCase("true")) {
...@@ -216,7 +219,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -216,7 +219,7 @@ public class UcGatewayIptv2IptvConsumer {
216 FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); 219 FileUtil.writeStringToFile2(filePath1, content, e.getMessage());
217 } 220 }
218 221
219 } 222 }*/
220 223
221 224
222 } 225 }
...@@ -227,10 +230,13 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -227,10 +230,13 @@ public class UcGatewayIptv2IptvConsumer {
227 * @description 添加收藏记录 230 * @description 添加收藏记录
228 * @param content 消息内容 231 * @param content 消息内容
229 */ 232 */
230 @RabbitHandler 233 /*@RabbitHandler
231 @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueAdd()}", 234 @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueAdd()}",
232 containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}", 235 containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}",
233 autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}", 236 autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}",
237 ackMode = "AUTO")*/
238 @RabbitHandler
239 @RabbitListener(queues = "#{rabbitMqConfig.getUcgCollectionQueueAdd()}",
234 ackMode = "AUTO") 240 ackMode = "AUTO")
235 public void collectionConsumerAdd(Channel channel, Message message, String content) throws IOException { 241 public void collectionConsumerAdd(Channel channel, Message message, String content) throws IOException {
236 log.info("receive collectionConsumerAdd add message, content {}", content); 242 log.info("receive collectionConsumerAdd add message, content {}", content);
...@@ -265,7 +271,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -265,7 +271,7 @@ public class UcGatewayIptv2IptvConsumer {
265 271
266 log.error("添加收藏记录事件处理异常,cause ==>> {}", e.getMessage()); 272 log.error("添加收藏记录事件处理异常,cause ==>> {}", e.getMessage());
267 273
268 if (MapUtils.isNotEmpty(error)) { 274 /*if (MapUtils.isNotEmpty(error)) {
269 String errorStart = this.error.get("start"); 275 String errorStart = this.error.get("start");
270 276
271 if (errorStart.equalsIgnoreCase("true")) { 277 if (errorStart.equalsIgnoreCase("true")) {
...@@ -275,7 +281,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -275,7 +281,7 @@ public class UcGatewayIptv2IptvConsumer {
275 FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); 281 FileUtil.writeStringToFile2(filePath1, content, e.getMessage());
276 } 282 }
277 283
278 } 284 }*/
279 285
280 } 286 }
281 } 287 }
...@@ -284,11 +290,13 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -284,11 +290,13 @@ public class UcGatewayIptv2IptvConsumer {
284 * @description 删除收藏记录 290 * @description 删除收藏记录
285 * @param content 消息内容 291 * @param content 消息内容
286 */ 292 */
287 @RabbitHandler 293 /* @RabbitHandler
288 @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueDelete()}", 294 @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueDelete()}",
289 containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}", 295 containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}",
290 autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}", 296 autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}",
291 ackMode = "AUTO") 297 ackMode = "AUTO")*/
298 @RabbitHandler
299 @RabbitListener(queues = "#{rabbitMqConfig.getUcgCollectionQueueDelete()}", ackMode = "AUTO")
292 public void collectionConsumerDelete(Channel channel, Message message, String content) throws IOException { 300 public void collectionConsumerDelete(Channel channel, Message message, String content) throws IOException {
293 log.info("receive collectionConsumerDelete add message, content {}", content); 301 log.info("receive collectionConsumerDelete add message, content {}", content);
294 302
...@@ -320,7 +328,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -320,7 +328,7 @@ public class UcGatewayIptv2IptvConsumer {
320 328
321 log.error("删除收藏记录事件处理异常,cause ==>> {}", e.getMessage()); 329 log.error("删除收藏记录事件处理异常,cause ==>> {}", e.getMessage());
322 330
323 if (MapUtils.isNotEmpty(error)) { 331 /* if (MapUtils.isNotEmpty(error)) {
324 String errorStart = this.error.get("start"); 332 String errorStart = this.error.get("start");
325 333
326 if (errorStart.equalsIgnoreCase("true")) { 334 if (errorStart.equalsIgnoreCase("true")) {
...@@ -330,7 +338,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -330,7 +338,7 @@ public class UcGatewayIptv2IptvConsumer {
330 FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); 338 FileUtil.writeStringToFile2(filePath1, content, e.getMessage());
331 } 339 }
332 340
333 } 341 }*/
334 342
335 343
336 } 344 }
...@@ -340,11 +348,14 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -340,11 +348,14 @@ public class UcGatewayIptv2IptvConsumer {
340 * @description 删除全部收藏记录 348 * @description 删除全部收藏记录
341 * @param content 消息内容 349 * @param content 消息内容
342 */ 350 */
343 @RabbitHandler 351 /*@RabbitHandler
344 @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueDeleteAll()}", 352 @RabbitListener(queues = "#{rabbitMqSourceConfig.getUcgCollectionQueueDeleteAll()}",
345 containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}", 353 containerFactory = "#{rabbitMqSourceConfig.getUcgCollectionSource()}",
346 autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}", 354 autoStartup = "#{rabbitMqSourceConfig.getUcgCollectionStartUp()}",
347 ackMode = "MANUAL") 355 ackMode = "MANUAL")*/
356 @RabbitHandler
357 @RabbitListener(queues = "#{rabbitMqConfig.getUcgCollectionQueueDeleteAll()}",
358 ackMode = "AUTO")
348 public void collectionConsumerDeleteAll(Channel channel, Message message, String content) throws IOException { 359 public void collectionConsumerDeleteAll(Channel channel, Message message, String content) throws IOException {
349 log.info("receive collectionConsumerDeleteAll add message, content {}", content); 360 log.info("receive collectionConsumerDeleteAll add message, content {}", content);
350 361
...@@ -376,7 +387,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -376,7 +387,7 @@ public class UcGatewayIptv2IptvConsumer {
376 } catch (Exception e) { 387 } catch (Exception e) {
377 log.error("删除全部收藏记录事件处理异常,cause ==>> {}", e.getMessage()); 388 log.error("删除全部收藏记录事件处理异常,cause ==>> {}", e.getMessage());
378 389
379 if (MapUtils.isNotEmpty(error)) { 390 /*if (MapUtils.isNotEmpty(error)) {
380 String errorStart = this.error.get("start"); 391 String errorStart = this.error.get("start");
381 392
382 if (errorStart.equalsIgnoreCase("true")) { 393 if (errorStart.equalsIgnoreCase("true")) {
...@@ -386,7 +397,7 @@ public class UcGatewayIptv2IptvConsumer { ...@@ -386,7 +397,7 @@ public class UcGatewayIptv2IptvConsumer {
386 FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); 397 FileUtil.writeStringToFile2(filePath1, content, e.getMessage());
387 } 398 }
388 399
389 } 400 }*/
390 } 401 }
391 } 402 }
392 403
......
...@@ -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
......
...@@ -2,11 +2,9 @@ package com.topdraw.resttemplate; ...@@ -2,11 +2,9 @@ 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.config.ResponseStatus; 5 import com.topdraw.business.ResponseStatus;
6 import com.topdraw.mq.consumer.UcEventBusIptv2ManagementUcEngine;
7 import com.topdraw.mq.domain.DataSyncMsg; 6 import com.topdraw.mq.domain.DataSyncMsg;
8 import com.topdraw.mq.domain.SubscribeBean; 7 import com.topdraw.mq.domain.SubscribeBean;
9 import com.topdraw.util.Base64Util;
10 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
11 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.core.env.Environment; 10 import org.springframework.core.env.Environment;
...@@ -155,7 +153,7 @@ public class RestTemplateClient { ...@@ -155,7 +153,7 @@ public class RestTemplateClient {
155 return null; 153 return null;
156 } 154 }
157 155
158 public JSONObject saveGrowthReport(String content) { 156 public boolean saveGrowthReport(String content) {
159 try { 157 try {
160 String url = BASE_URL + "/uce/userOperation/saveGrowthReport"; 158 String url = BASE_URL + "/uce/userOperation/saveGrowthReport";
161 String encode = Base64Utils.encodeToString(content.getBytes()); 159 String encode = Base64Utils.encodeToString(content.getBytes());
...@@ -163,13 +161,13 @@ public class RestTemplateClient { ...@@ -163,13 +161,13 @@ public class RestTemplateClient {
163 ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, encode, String.class); 161 ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, encode, String.class);
164 log.info("response ==>> {}", responseEntity); 162 log.info("response ==>> {}", responseEntity);
165 163
166 return getParseResponseResult(responseEntity); 164 return getParseResponseResultBoolean(responseEntity);
167 165
168 } catch (Exception e) { 166 } catch (Exception e) {
169 log.error("删除所有观影记录(ApiUti.deleteAllCollection)信息时出现异常,cause ==>> {}", e.getMessage()); 167 log.error("保存成长报告(ApiUti.saveGrowthReport)信息时出现异常,cause ==>> {}", e.getMessage());
170 } 168 }
171 169
172 return null; 170 return false;
173 } 171 }
174 172
175 public JSONObject dealViewRecord(String content) { 173 public JSONObject dealViewRecord(String content) {
...@@ -194,6 +192,25 @@ public class RestTemplateClient { ...@@ -194,6 +192,25 @@ public class RestTemplateClient {
194 * @param responseEntity 192 * @param responseEntity
195 * @return 193 * @return
196 */ 194 */
195 private static Boolean getParseResponseResultBoolean(ResponseEntity<String> responseEntity) {
196
197 Boolean resultSet = null;
198 if (responseEntity.getStatusCode().is2xxSuccessful()) {
199 String entityBody = responseEntity.getBody();
200 JSONObject jsonObject = JSONObject.parseObject(entityBody);
201 if (jsonObject.getInteger("businessCode").equals(ResponseStatus.OK)) {
202 resultSet = jsonObject.getJSONArray("resultSet").getBoolean(0);
203 }
204 }
205 log.info("result ==>> {}", resultSet);
206 return resultSet;
207 }
208
209 /**
210 *
211 * @param responseEntity
212 * @return
213 */
197 private static JSONObject getParseResponseResult(ResponseEntity<String> responseEntity) { 214 private static JSONObject getParseResponseResult(ResponseEntity<String> responseEntity) {
198 215
199 JSONObject resultSet = null; 216 JSONObject resultSet = null;
......
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
...@@ -60,131 +60,35 @@ spring: ...@@ -60,131 +60,35 @@ spring:
60 #连接超时时间 60 #连接超时时间
61 timeout: 5000 61 timeout: 5000
62 62
63 63 rabbitmq:
64 ###########################################自定义属性#################################################################
65 # 多mq配置
66 mutil-mq:
67 # 服务侧
68 service:
69 # ip
70 host: 122.112.214.149 64 host: 122.112.214.149
71 # host: 139.196.145.150
72 # 端口
73 port: 5672 65 port: 5672
74 # 用户名 66 virtual-host: member_center_small_sichuan
75 username: guest 67 username: guest
76 # username: admin
77 # 密码
78 password: guest 68 password: guest
79 # password: Topdraw1qaz 69 publisher-confirms: true
80 # 虚拟空间 70 listener:
81 virtual-host: member_center_iptv_sichuan 71 direct:
82 # virtual-host: member_center_small_sichuan 72 auto-startup: false
83 publisher-confirms: true #如果对异步消息需要回调必须设置为true 73 uce:
84 74 queue: uce.queue
85 # 管理侧 75 memberInfo:
86 management: 76 queue: queue.MemberInfoSync
87 # host: 122.112.214.149 # rabbitmq的连接地址 77 event:
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: growthReport
103 exchange: growthReport.exchange
104 queue: growthReport.queue
105 exchange-type: direct
106 routing-key:
107 active: service
108 - source: event
109 exchange: event.exchange
110 queue: event.queue 78 queue: event.queue
111 exchange-type: direct 79 collection:
112 routing-key:
113 active: service
114 - source: collection
115 exchange: exchange.collection
116 queue: collection.queue 80 queue: collection.queue
117 exchange-type: direct 81 addCollection:
118 routing-key: 82 queue: collection.queue
119 active: service 83 deleteCollection:
120 - source: collection 84 queue: collection.queue
121 exchange: userCenter_exchange 85 deleteAllCollection:
122 queue: queue.collection.add 86 queue: collection.queue
123 exchange-type: direct 87 viewRecord:
124 routing-key: route.UserCollection.add 88 queue: viewRecord.queue
125 active: service 89 eventBus:
126 - source: collection
127 exchange: userCenter_exchange
128 queue: queue.collection.delete
129 exchange-type: direct
130 routing-key: route.UserCollection.delete
131 active: service
132 - source: collection
133 exchange: userCenter_exchange
134 queue: queue.collection.deleteall
135 exchange-type: direct
136 routing-key: route.UserCollection.deleteall
137 active: service
138
139 # - source: viewRecord
140 # exchange: viewRecord.exchange
141 # queue: viewRecord.queue
142 # exchange-type: direct
143 # routing-key:
144 # active: service
145 - source: eventBus
146 exchange: uc.eventbus
147 queue: uc.eventbus 90 queue: uc.eventbus
148 exchange-type: topic
149 routing-key: uc.eventbus.*.topic
150 active: service
151 - source: uce
152 exchange: uce.exchange
153 queue: uce.queue
154 exchange-type: direct
155 routing-key:
156 active: management
157 - source: uce
158 exchange: exchange.MemberInfoSync
159 queue: queue.MemberInfoSync
160 exchange-type: direct
161 routing-key:
162 active: management
163 # - source: wechat
164 # exchange: weixin.subOrUnSub.direct
165 # queue: weixin.subOrUnSub.queue
166 # exchange-type: direct
167 # routing-key:
168 # active: active
169 error:
170 logs:
171 list:
172 - type: eventBus
173 filePath: /logs/mq/eventBus/
174 fileName: error
175 start: on
176 - type: ucg
177 filePath: /logs/mq/ucg/
178 fileName: error
179 start: on
180 - type: uce
181 filePath: /logs/mq/uce/
182 fileName: error
183 start: on
184 - type: wechat
185 filePath: /logs/mq/wechat/
186 fileName: error
187 start: on
188
189 api:
190 baseUrl: http://127.0.0.1:8447
...\ No newline at end of file ...\ No newline at end of file
91 wechat:
92 queue: weixin.subOrUnSub.queue
93 growthReport:
94 queue: growthReport.queue
...\ 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
......