1.添加公众号关注、取关消费者
Showing
12 changed files
with
556 additions
and
487 deletions
... | @@ -16,6 +16,35 @@ import org.springframework.context.annotation.Primary; | ... | @@ -16,6 +16,35 @@ import org.springframework.context.annotation.Primary; |
16 | @Configuration | 16 | @Configuration |
17 | public class RabbitMqConfig { | 17 | public class RabbitMqConfig { |
18 | 18 | ||
19 | |||
20 | //////////////////////////////////////////////////////// OMO 小屏/////////////////////////////////////////////////////////////// | ||
21 | |||
22 | /** 获取带参二维码(大屏->小屏) */ | ||
23 | public static final String GET_QR_CODE_QUEUE = "queue.qrCode.get"; | ||
24 | |||
25 | /** 删除全部收藏队列(大屏->小屏) */ | ||
26 | public static final String COLLECTION_DELETE_ALL_QUEUE = "queue.collection.deleteall"; | ||
27 | |||
28 | /** 添加收藏队列(大屏->小屏) */ | ||
29 | public static final String COLLECTION_ADD_QUEUE = "queue.collection.add"; | ||
30 | |||
31 | /** 删除收藏队列(大屏->小屏) */ | ||
32 | public static final String COLLECTION_DELETE_QUEUE = "queue.collection.delete"; | ||
33 | |||
34 | /** 微信侧 公众号关注与取消关注 */ | ||
35 | public static final String WEIXIN_SUBORUNSUB_QUEUE = "weixin.subOrUnSub.queue"; | ||
36 | |||
37 | |||
38 | |||
39 | |||
40 | |||
41 | |||
42 | |||
43 | |||
44 | |||
45 | |||
46 | //////////////////////////////////////////////////////// 重数 /////////////////////////////////////////////////////////////// | ||
47 | |||
19 | /** 路由(事件)--direct route.key*/ | 48 | /** 路由(事件)--direct route.key*/ |
20 | // 事件,uc-gateway | 49 | // 事件,uc-gateway |
21 | public static final String UC_ROUTE_KEY_DIRECT_EVENT_AAA = "uc.route.key.direct.event.aaa"; | 50 | public static final String UC_ROUTE_KEY_DIRECT_EVENT_AAA = "uc.route.key.direct.event.aaa"; |
... | @@ -123,4 +152,6 @@ public class RabbitMqConfig { | ... | @@ -123,4 +152,6 @@ public class RabbitMqConfig { |
123 | public Queue eventDirect() { | 152 | public Queue eventDirect() { |
124 | return new Queue(UC_ROUTE_KEY_DIRECT_EVENT_AAA); | 153 | return new Queue(UC_ROUTE_KEY_DIRECT_EVENT_AAA); |
125 | } | 154 | } |
155 | |||
156 | |||
126 | } | 157 | } | ... | ... |
1 | package com.topdraw.mq.consumer; | ||
2 | |||
3 | import lombok.extern.slf4j.Slf4j; | ||
4 | import org.slf4j.Logger; | ||
5 | import org.slf4j.LoggerFactory; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.stereotype.Component; | ||
8 | |||
9 | @Component | ||
10 | @Slf4j | ||
11 | public class UcEngineEventConsumer { | ||
12 | |||
13 | private static final Logger LOG = LoggerFactory.getLogger(UcEngineEventConsumer.class); | ||
14 | |||
15 | @Autowired | ||
16 | AutoRoute autoUser; | ||
17 | |||
18 | |||
19 | } |
1 | package com.topdraw.mq.consumer; | ||
2 | |||
3 | import com.topdraw.config.RabbitMqConfig; | ||
4 | import com.topdraw.mq.domain.TableOperationMsg; | ||
5 | import com.topdraw.util.JSONUtil; | ||
6 | import lombok.extern.slf4j.Slf4j; | ||
7 | import org.slf4j.Logger; | ||
8 | import org.slf4j.LoggerFactory; | ||
9 | import org.springframework.amqp.core.ExchangeTypes; | ||
10 | import org.springframework.amqp.rabbit.annotation.*; | ||
11 | import org.springframework.beans.factory.annotation.Autowired; | ||
12 | import org.springframework.stereotype.Component; | ||
13 | |||
14 | @Component | ||
15 | @Slf4j | ||
16 | public class UcEngineManageConsumer { | ||
17 | |||
18 | private static final Logger LOG = LoggerFactory.getLogger(UcEngineManageConsumer.class); | ||
19 | |||
20 | @Autowired | ||
21 | AutoRoute autoUser; | ||
22 | |||
23 | /** | ||
24 | * @param content | ||
25 | * @description 基础数据同步 | ||
26 | * @author Hongyan Wang | ||
27 | * @date 2021/9/7 11:26 上午 | ||
28 | */ | ||
29 | /*@RabbitHandler | ||
30 | @RabbitListener(bindings = { | ||
31 | @QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_CCC), | ||
32 | exchange = @Exchange(value = ExchangeTypes.DIRECT)) | ||
33 | }, containerFactory = "managementRabbitListenerContainerFactory") | ||
34 | public void memberServiceFanoutConsumer(String content) { | ||
35 | try { | ||
36 | log.info(" receive dataSync msg , content is : {} ", content); | ||
37 | TableOperationMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, TableOperationMsg.class); | ||
38 | autoUser.route(dataSyncMsg); | ||
39 | LOG.info("memberServiceFanoutConsumer ====>>>> "+dataSyncMsg); | ||
40 | } catch (Exception e) { | ||
41 | log.error(" LocalDataSyncMsg || msg:{} || error:{} ", content, e.getMessage()); | ||
42 | } | ||
43 | }*/ | ||
44 | } |
1 | package com.topdraw.mq.consumer; | ||
2 | |||
3 | import com.topdraw.config.RabbitMqConfig; | ||
4 | import com.topdraw.mq.domain.TableOperationMsg; | ||
5 | import com.topdraw.resttemplate.RestTemplateClient; | ||
6 | import com.topdraw.util.JSONUtil; | ||
7 | import lombok.extern.slf4j.Slf4j; | ||
8 | import org.springframework.amqp.core.ExchangeTypes; | ||
9 | import org.springframework.amqp.rabbit.annotation.*; | ||
10 | import org.springframework.beans.factory.annotation.Autowired; | ||
11 | import org.springframework.stereotype.Component; | ||
12 | |||
13 | @Component | ||
14 | @Slf4j | ||
15 | public class UcEngineServiceConsumer { | ||
16 | |||
17 | @Autowired | ||
18 | RestTemplateClient restTemplateClient; | ||
19 | |||
20 | @Autowired | ||
21 | AutoRoute autoUser; | ||
22 | |||
23 | /** | ||
24 | * 事件 | ||
25 | * @param content | ||
26 | * @description 基础数据同步 | ||
27 | * @author Hongyan Wang | ||
28 | * @date 2021/9/7 11:26 上午 | ||
29 | */ | ||
30 | @RabbitHandler | ||
31 | @RabbitListener(bindings = { | ||
32 | @QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_BBB), | ||
33 | exchange = @Exchange(value = ExchangeTypes.DIRECT)) | ||
34 | }, containerFactory = "serviceRabbitListenerContainerFactory") | ||
35 | public void ucEventConsumer(String content) { | ||
36 | log.info(" receive dataSync msg , content is : {} ", content); | ||
37 | TableOperationMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, TableOperationMsg.class); | ||
38 | autoUser.route(dataSyncMsg); | ||
39 | log.info("ucEventConsumer ====>>>> end"); | ||
40 | } | ||
41 | |||
42 | } |
... | @@ -13,7 +13,7 @@ import org.springframework.util.Assert; | ... | @@ -13,7 +13,7 @@ import org.springframework.util.Assert; |
13 | 13 | ||
14 | @Component | 14 | @Component |
15 | @Slf4j | 15 | @Slf4j |
16 | public class UcGatewayConsumer { | 16 | public class UcGatewayEventConsumer { |
17 | 17 | ||
18 | @Autowired | 18 | @Autowired |
19 | RestTemplateClient restTemplateClient; | 19 | RestTemplateClient restTemplateClient; |
... | @@ -28,7 +28,7 @@ public class UcGatewayConsumer { | ... | @@ -28,7 +28,7 @@ public class UcGatewayConsumer { |
28 | * @author Hongyan Wang | 28 | * @author Hongyan Wang |
29 | * @date 2021/9/7 11:26 上午 | 29 | * @date 2021/9/7 11:26 上午 |
30 | */ | 30 | */ |
31 | /*@RabbitHandler | 31 | @RabbitHandler |
32 | @RabbitListener(bindings = { | 32 | @RabbitListener(bindings = { |
33 | @QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_AAA), | 33 | @QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_AAA), |
34 | exchange = @Exchange(value = ExchangeTypes.DIRECT)) | 34 | exchange = @Exchange(value = ExchangeTypes.DIRECT)) |
... | @@ -38,7 +38,7 @@ public class UcGatewayConsumer { | ... | @@ -38,7 +38,7 @@ public class UcGatewayConsumer { |
38 | DataSyncMsg dataSyncMsg = this.parseContent(content); | 38 | DataSyncMsg dataSyncMsg = this.parseContent(content); |
39 | this.taskDeal(dataSyncMsg); | 39 | this.taskDeal(dataSyncMsg); |
40 | log.info("ucEventConsumer ====>>>> end"); | 40 | log.info("ucEventConsumer ====>>>> end"); |
41 | }*/ | 41 | } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * 数据解析 | 44 | * 数据解析 | ... | ... |
1 | package com.topdraw.mq.consumer; | ||
2 | |||
3 | |||
4 | import com.alibaba.fastjson.JSONObject; | ||
5 | import com.topdraw.config.RabbitMqConfig; | ||
6 | import com.topdraw.mq.domain.SubscribeBean; | ||
7 | import com.topdraw.resttemplate.RestTemplateClient; | ||
8 | import com.topdraw.utils.RedisUtils; | ||
9 | import com.topdraw.utils.StringUtils; | ||
10 | import lombok.extern.slf4j.Slf4j; | ||
11 | import org.springframework.amqp.core.ExchangeTypes; | ||
12 | import org.springframework.amqp.rabbit.annotation.*; | ||
13 | import org.springframework.beans.factory.annotation.Autowired; | ||
14 | import org.springframework.beans.factory.annotation.Value; | ||
15 | import org.springframework.stereotype.Component; | ||
16 | import org.springframework.transaction.annotation.Transactional; | ||
17 | |||
18 | /** | ||
19 | * 微信事件 | ||
20 | */ | ||
21 | @Component | ||
22 | @Slf4j | ||
23 | public class WeiXinEventConsumer { | ||
24 | |||
25 | |||
26 | @Autowired | ||
27 | private RestTemplateClient restTemplateClient; | ||
28 | |||
29 | @Value("${subAppId:wx05f35931270014be}") | ||
30 | private String subAppId; | ||
31 | |||
32 | @Autowired | ||
33 | private RedisUtils redisUtils; | ||
34 | |||
35 | private static final String QR_CODE_URL = "QR_CODE_URL_"; | ||
36 | |||
37 | /** | ||
38 | * @description 删除用户收藏记录 | ||
39 | * @param content 消息内容 | ||
40 | */ | ||
41 | @RabbitHandler | ||
42 | @RabbitListener(bindings = { | ||
43 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_QUEUE), | ||
44 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}) | ||
45 | public void deleteCollection(String content) { | ||
46 | try { | ||
47 | log.info("receive UserCollection delete message, content {}", content); | ||
48 | JSONObject jsonObject = JSONObject.parseObject(content); | ||
49 | String platformAccount = jsonObject.getString("platformAccount"); | ||
50 | String data = jsonObject.getString("data"); | ||
51 | if (StringUtils.isBlank(data) || !data.startsWith("[")) { | ||
52 | // return; | ||
53 | } | ||
54 | /*Optional<TvUser> userOptional = tvUserRepository.findByPlatformAccount(platformAccount); | ||
55 | if (!userOptional.isPresent()) { | ||
56 | return; | ||
57 | } | ||
58 | Long id = userOptional.get().getId(); | ||
59 | List<UserCollectionMq> userCollectionMqList = JSONObject.parseArray(data, UserCollectionMq.class); | ||
60 | if (userCollectionMqList == null || userCollectionMqList.isEmpty()) { | ||
61 | return; | ||
62 | } | ||
63 | Map<Long, List<UserCollectionMq>> collect = userCollectionMqList.stream().collect(Collectors.groupingBy(UserCollectionMq::getUserCollectionId)); | ||
64 | for (Map.Entry<Long, List<UserCollectionMq>> entry : collect.entrySet()) { | ||
65 | List<UserCollectionMq> value = entry.getValue(); | ||
66 | UserCollectionMq userCollectionMq = value.get(0); | ||
67 | if (StringUtils.isBlank(userCollectionMq.getName())) { | ||
68 | userCollectionMq.setName("DEFAULT"); | ||
69 | } | ||
70 | Optional<UserCollection> userCollectionOptional = userCollectionRepository.findFirstByUserIdAndTypeAndName(id, userCollectionMq.getType(), userCollectionMq.getName()); | ||
71 | UserCollection userCollection = userCollectionOptional.orElseGet(UserCollection::new); | ||
72 | int count = 0; | ||
73 | for (UserCollectionMq collectionMq : value) { | ||
74 | collectionMq.setUserCollectionId(userCollection.getId()); | ||
75 | List<UserCollectionDetail> userCollectionDetailOptional = userCollectionDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, collectionMq, criteriaBuilder)); | ||
76 | if (!userCollectionDetailOptional.isEmpty()) { | ||
77 | userCollectionDetailRepository.deleteAll(userCollectionDetailOptional); | ||
78 | count++; | ||
79 | } | ||
80 | } | ||
81 | userCollection.setAppId(userCollectionMq.getAppId()) | ||
82 | .setUserId(id) | ||
83 | .setName(userCollectionMq.getName()) | ||
84 | .setType(userCollectionMq.getType()) | ||
85 | .setCount(userCollection.getCount() - count); | ||
86 | userCollectionRepository.save(userCollection); | ||
87 | }*/ | ||
88 | this.restTemplateClient.deleteCollection(content); | ||
89 | } catch (Exception e) { | ||
90 | log.error("CollectionDeleteConsumer || UserCollection delete error || {}", e.toString(), e); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | /** | ||
95 | * @description 删除全部收藏记录 | ||
96 | * @param content 消息内容 | ||
97 | */ | ||
98 | @RabbitHandler | ||
99 | @RabbitListener(bindings = { | ||
100 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_ALL_QUEUE), | ||
101 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}) | ||
102 | @Transactional | ||
103 | public void deleteAllCollection(String content) { | ||
104 | try { | ||
105 | log.info("receive UserCollection delete all message, content {}", content); | ||
106 | JSONObject jsonObject = JSONObject.parseObject(content); | ||
107 | String platformAccount = jsonObject.getString("platformAccount"); | ||
108 | Integer type = jsonObject.getInteger("collectionType"); | ||
109 | /* Optional<TvUser> userOptional = tvUserRepository.findByPlatformAccount(platformAccount); | ||
110 | if (!userOptional.isPresent()) { | ||
111 | return; | ||
112 | } | ||
113 | Long id = userOptional.get().getId(); | ||
114 | List<UserCollection> userCollections = userCollectionRepository.findByUserIdAndType(id, type); | ||
115 | if (userCollections == null || userCollections.isEmpty()) { | ||
116 | return; | ||
117 | } | ||
118 | for (UserCollection userCollection : userCollections) { | ||
119 | userCollectionDetailRepository.deleteAllByUserCollectionId(userCollection.getId()); | ||
120 | }*/ | ||
121 | this.restTemplateClient.deleteAllCollection(content); | ||
122 | } catch (Exception e) { | ||
123 | log.error("CollectionDeleteConsumer || UserCollection delete all error || {}", e.toString(), e); | ||
124 | } | ||
125 | } | ||
126 | |||
127 | /** | ||
128 | * 处理带参的二维码事件 | ||
129 | * @param content 消息内容 | ||
130 | * @description 获取公众号带参二维码 | ||
131 | */ | ||
132 | @RabbitHandler | ||
133 | @RabbitListener(bindings = { | ||
134 | @QueueBinding(value = @Queue(value = RabbitMqConfig.GET_QR_CODE_QUEUE), | ||
135 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}) | ||
136 | public void getQrCode(String content) { | ||
137 | try { | ||
138 | log.info("receive get qrCode message, content {}", content); | ||
139 | JSONObject jsonObject = JSONObject.parseObject(content); | ||
140 | /*String appid = jsonObject.getString("appid"); | ||
141 | String IPTVappid = jsonObject.getString("IPTVappid"); | ||
142 | String platformAccount = jsonObject.getString("platformAccount"); | ||
143 | String sessionId = jsonObject.getString("sessionId"); | ||
144 | String key = QR_CODE_URL + appid + "_" + platformAccount + "_" + sessionId; | ||
145 | String url = (String) redisUtils.get(key); | ||
146 | if (StringUtils.isBlank(url)) { | ||
147 | Map<String, String> wxInfo = WeixinUtil.getWeixinInfoByAppid(appid); | ||
148 | var appType = wxInfo.get("appType"); | ||
149 | // 订阅号不支持带参二维码,直接返回 | ||
150 | if (StrUtil.isNotEmpty(appType) && ObjectUtil.equals(appType, WeChatConstants.WX_SUBSCRIPTION)) { | ||
151 | log.error("订阅号不支持带参二维码 || {} || {}", appid, content); | ||
152 | return; | ||
153 | } | ||
154 | QrCode qrCode = new QrCode(); | ||
155 | qrCode.setActionName(WeChatConstants.QR_STR_SCENE); | ||
156 | if (StringUtils.isNotBlank(wxInfo.get("qrCodeExpireSeconds"))) { | ||
157 | qrCode.setExpireSeconds(Integer.valueOf(wxInfo.get("qrCodeExpireSeconds"))); | ||
158 | } | ||
159 | ActionInfo actionInfo = new ActionInfo(); | ||
160 | Scene scene = new Scene(); | ||
161 | scene.setSceneStr(content); | ||
162 | actionInfo.setScene(scene); | ||
163 | qrCode.setActionInfo(actionInfo); | ||
164 | JSONObject jsonQrCode = weixinRequestUtil.getQrCode(wxInfo, qrCode); | ||
165 | url = jsonQrCode.getString("url"); | ||
166 | Integer expireSeconds = jsonQrCode.getInteger("expire_seconds"); | ||
167 | redisUtils.set(key, url, expireSeconds, TimeUnit.SECONDS); | ||
168 | } | ||
169 | HashMap<String, Object> map = new HashMap<>(); | ||
170 | map.put("sessionId", sessionId); | ||
171 | map.put("url", url); | ||
172 | map.put("appid", appid); | ||
173 | map.put("IPTVappid", IPTVappid); | ||
174 | map.put("platformAccount", platformAccount); | ||
175 | map.put("extraInfo", content);*/ | ||
176 | restTemplateClient.sendQrCodeMessage(content); | ||
177 | } catch (Exception e) { | ||
178 | log.error("GetQrCodeConsumer || get qrCode error || {}", e.toString(), e); | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /** | ||
183 | * 关注和取关事件 | ||
184 | * eg: | ||
185 | * { | ||
186 | * "appIdMap": "{\"mpId\":\"234\"}", | ||
187 | * "allFieldsMap":"{\"FromUserName\":\"4343\",\"MsgType\":\"event\",\"Event\":\"unsubscribe\"}" | ||
188 | * } | ||
189 | * @param content | ||
190 | */ | ||
191 | @RabbitHandler | ||
192 | @RabbitListener(bindings = { | ||
193 | @QueueBinding(value = @Queue(value = RabbitMqConfig.WEIXIN_SUBORUNSUB_QUEUE), | ||
194 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}) | ||
195 | @Transactional | ||
196 | public void subOrUnSubEvent(String content) { | ||
197 | try { | ||
198 | log.info("receive wxu subOrUnSub message, content {}", content); | ||
199 | JSONObject jsonObject = JSONObject.parseObject(content); | ||
200 | |||
201 | JSONObject map = jsonObject.getJSONObject("appIdMap"); | ||
202 | JSONObject wechatMsg = jsonObject.getJSONObject("allFieldsMap"); | ||
203 | String appid = map.getString("mpId"); | ||
204 | // Map<String, String> wxInfoMap = WeixinUtil.getWeixinInfoByAppid(appid); | ||
205 | |||
206 | String openid = wechatMsg.getString("FromUserName"); | ||
207 | String msgType = wechatMsg.getString("MsgType"); | ||
208 | if ("event".equals(msgType)) { | ||
209 | String event = wechatMsg.getString("Event"); | ||
210 | String eventKey = wechatMsg.getString("EventKey"); | ||
211 | |||
212 | SubscribeBean subscribeBean = new SubscribeBean(openid,appid,eventKey); | ||
213 | |||
214 | if (event.equals("subscribe")) | ||
215 | this.restTemplateClient.subscribe(subscribeBean); | ||
216 | |||
217 | if (event.equals("unsubscribe")) | ||
218 | this.restTemplateClient.unsubscribe(subscribeBean); | ||
219 | |||
220 | } | ||
221 | |||
222 | } catch (Exception e) { | ||
223 | log.error("WXSubscribeConsumer || subOrUnSub msg error || {} || {}", content, e.getMessage()); | ||
224 | } | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * @description 添加收藏记录 | ||
229 | * @param content 消息内容 | ||
230 | */ | ||
231 | @RabbitHandler | ||
232 | @RabbitListener(bindings = { | ||
233 | @QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_ADD_QUEUE), | ||
234 | exchange = @Exchange(value = ExchangeTypes.DIRECT))}) | ||
235 | @Transactional | ||
236 | public void addCollection(String content) { | ||
237 | try { | ||
238 | log.info("receive UserCollection add message, content {}", content); | ||
239 | JSONObject jsonObject = JSONObject.parseObject(content); | ||
240 | String platformAccount = jsonObject.getString("platformAccount"); | ||
241 | String data = jsonObject.getString("data"); | ||
242 | if (StringUtils.isBlank(data) || !data.startsWith("[")) { | ||
243 | // return; | ||
244 | } | ||
245 | /*Optional<TvUser> userOptional = tvUserRepository.findByPlatformAccount(platformAccount); | ||
246 | if (!userOptional.isPresent()) { | ||
247 | return; | ||
248 | } | ||
249 | Long tvUserId = userOptional.get().getId(); | ||
250 | List<UserCollectionMq> userCollectionMqList = JSONObject.parseArray(data, UserCollectionMq.class); | ||
251 | if (userCollectionMqList == null || userCollectionMqList.isEmpty()) { | ||
252 | return; | ||
253 | } | ||
254 | Map<Long, List<UserCollectionMq>> collect = userCollectionMqList.stream().collect(Collectors.groupingBy(UserCollectionMq::getUserCollectionId)); | ||
255 | for (Map.Entry<Long, List<UserCollectionMq>> entry : collect.entrySet()) { | ||
256 | List<UserCollectionMq> value = entry.getValue(); | ||
257 | UserCollectionMq userCollectionMq = value.get(0); | ||
258 | if (StringUtils.isBlank(userCollectionMq.getName())) { | ||
259 | userCollectionMq.setName("DEFAULT"); | ||
260 | } | ||
261 | UserCollection userCollection = userCollectionRepository | ||
262 | .findFirstByUserIdAndTypeAndName(tvUserId, userCollectionMq.getType(), userCollectionMq.getName()).orElseGet(UserCollection::new); | ||
263 | userCollection.setAppId(userCollectionMq.getAppId()) | ||
264 | .setUserId(tvUserId) | ||
265 | .setName(userCollectionMq.getName()) | ||
266 | .setType(userCollectionMq.getType()) | ||
267 | .setCount(userCollection.getCount() == null ? value.size() : userCollection.getCount() + value.size()); | ||
268 | UserCollection userCollectionSave = userCollectionRepository.save(userCollection); | ||
269 | for (UserCollectionMq collectionMq : value) { | ||
270 | UserCollectionDetail userCollectionDetail = collectionMq2DetailMapper.toEntity(collectionMq); | ||
271 | Optional<UserCollectionDetail> userCollectionDetailOptional = userCollectionDetailRepository | ||
272 | .findByDetailIdAndDetailTypeAndUserCollectionId(userCollectionDetail.getDetailId(), userCollectionDetail.getDetailType(), userCollectionSave.getId()); | ||
273 | //观影记录同一天只存一条记录 | ||
274 | if (userCollectionDetailOptional.isPresent() && | ||
275 | DateUtil.isSameDay(new Date(userCollectionDetailOptional.get().getCreateTime().getTime()), new Date())) { | ||
276 | userCollectionDetail.setId(userCollectionDetailOptional.get().getId()); | ||
277 | } else { | ||
278 | userCollectionDetail.setId(null) | ||
279 | .setUserCollectionId(userCollectionSave.getId()); | ||
280 | } | ||
281 | userCollectionDetailRepository.save(userCollectionDetail); | ||
282 | } | ||
283 | }*/ | ||
284 | |||
285 | this.restTemplateClient.addCollection(content); | ||
286 | } catch (Exception e) { | ||
287 | log.error("CollectionAddConsumer || UserCollection add error || {}", e.toString(), e); | ||
288 | } | ||
289 | } | ||
290 | |||
291 | } |
1 | package com.topdraw.mq.domain; | ||
2 | |||
3 | import lombok.AllArgsConstructor; | ||
4 | import lombok.Data; | ||
5 | import lombok.NoArgsConstructor; | ||
6 | |||
7 | @Data | ||
8 | @AllArgsConstructor | ||
9 | @NoArgsConstructor | ||
10 | public class SubscribeBean { | ||
11 | |||
12 | /** */ | ||
13 | private String openId; | ||
14 | |||
15 | /** */ | ||
16 | private String appId; | ||
17 | |||
18 | /** */ | ||
19 | private String eventKey; | ||
20 | |||
21 | } |
... | @@ -6,6 +6,7 @@ import com.topdraw.business.basicdata.member.address.domain.MemberAddress; | ... | @@ -6,6 +6,7 @@ import com.topdraw.business.basicdata.member.address.domain.MemberAddress; |
6 | import com.topdraw.business.basicdata.member.domain.Member; | 6 | import com.topdraw.business.basicdata.member.domain.Member; |
7 | import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo; | 7 | import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo; |
8 | import com.topdraw.mq.domain.DataSyncMsg; | 8 | import com.topdraw.mq.domain.DataSyncMsg; |
9 | import com.topdraw.mq.domain.SubscribeBean; | ||
9 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
10 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.core.env.Environment; | 12 | import org.springframework.core.env.Environment; |
... | @@ -41,7 +42,6 @@ public class RestTemplateClient { | ... | @@ -41,7 +42,6 @@ public class RestTemplateClient { |
41 | } | 42 | } |
42 | 43 | ||
43 | public JSONObject dealTask(DataSyncMsg dataSyncMsg) { | 44 | public JSONObject dealTask(DataSyncMsg dataSyncMsg) { |
44 | JSONObject resultSet = null; | ||
45 | String url = BASE_URL + "/api/TaskOperation/dealTask"; | 45 | String url = BASE_URL + "/api/TaskOperation/dealTask"; |
46 | log.info("request uc : url is " + url + ", dataSyncMsg is " + dataSyncMsg); | 46 | log.info("request uc : url is " + url + ", dataSyncMsg is " + dataSyncMsg); |
47 | String content = JSON.toJSONString(dataSyncMsg); | 47 | String content = JSON.toJSONString(dataSyncMsg); |
... | @@ -78,122 +78,96 @@ public class RestTemplateClient { | ... | @@ -78,122 +78,96 @@ public class RestTemplateClient { |
78 | return resultSet; | 78 | return resultSet; |
79 | } | 79 | } |
80 | 80 | ||
81 | public String createMember(Member member) { | 81 | public String createMemberAddress(MemberAddress member) { |
82 | String entityBody = ""; | 82 | String url = BASE_URL + "/api/MemberAddress/create"; |
83 | String url = BASE_URL + "/api/member/create"; | ||
84 | log.info("request uc : url is " + url + ", memberId is " + JSONObject.toJSONString(member)); | 83 | log.info("request uc : url is " + url + ", memberId is " + JSONObject.toJSONString(member)); |
85 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, member, String.class); | 84 | restTemplate.postForEntity(url, member, String.class); |
85 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, member, String.class); | ||
86 | String entityBody = ""; | ||
86 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 87 | if (responseEntity.getStatusCode().is2xxSuccessful()) { |
87 | entityBody = responseEntity.getBody(); | 88 | entityBody = responseEntity.getBody(); |
88 | |||
89 | } | 89 | } |
90 | return entityBody; | 90 | log.info("uc response: " + entityBody);*/ |
91 | return null; | ||
91 | } | 92 | } |
92 | 93 | ||
93 | public String updateMember(Member member) { | 94 | public String unsubscribe(SubscribeBean subscribeBean) { |
94 | String entityBody = ""; | 95 | String url = BASE_URL + "/ucEngine/api/userOperation/unsubscribe"; |
95 | String url = BASE_URL + "/api/member/update"; | 96 | String content = JSON.toJSONString(subscribeBean); |
96 | log.info("request uc : url is " + url + ", memberId is " + JSONObject.toJSONString(member)); | ||
97 | restTemplate.put(url, member); | ||
98 | |||
99 | return entityBody; | ||
100 | } | ||
101 | 97 | ||
102 | public String createMemberAddress(MemberAddress member) { | 98 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); |
103 | JSONObject resultSet = null; | 99 | objectObjectHashMap.put("content", content); |
104 | String url = BASE_URL + "/api/MemberAddress/create"; | 100 | restTemplate.postForEntity(url, objectObjectHashMap, String.class); |
105 | log.info("request uc : url is " + url + ", memberId is " + JSONObject.toJSONString(member)); | 101 | /*ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, subscribeBean, String.class); |
106 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, member, String.class); | ||
107 | String entityBody = ""; | 102 | String entityBody = ""; |
108 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 103 | if (responseEntity.getStatusCode().is2xxSuccessful()) { |
109 | entityBody = responseEntity.getBody(); | 104 | entityBody = responseEntity.getBody(); |
110 | } | 105 | } |
111 | log.info("uc response: " + entityBody); | 106 | log.info("uc response: " + entityBody);*/ |
112 | return entityBody; | 107 | return null; |
113 | } | ||
114 | |||
115 | public void updateMemberAddress(MemberAddress member) { | ||
116 | String url = BASE_URL + "/api/MemberAddress/update"; | ||
117 | log.info("request uc : url is " + url + ", memberId is " + JSONObject.toJSONString(member)); | ||
118 | restTemplate.put(url, member); | ||
119 | |||
120 | } | 108 | } |
121 | 109 | ||
122 | public void deleteMemberAddress(Long id) { | 110 | public String subscribe(SubscribeBean subscribeBean) { |
123 | String url = BASE_URL + "/api/MemberAddress/delete/" + id; | 111 | String url = BASE_URL + "/ucEngine/api/userOperation/subscribe"; |
124 | log.info("request uc : url is " + url + ", memberId is " + id); | 112 | String content = JSON.toJSONString(subscribeBean); |
125 | restTemplate.delete(url); | ||
126 | |||
127 | } | ||
128 | 113 | ||
129 | public JSONObject getMemberProfile(Long memberId) { | 114 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); |
130 | JSONObject resultSet = null; | 115 | objectObjectHashMap.put("content", content); |
131 | String url = BASE_URL + "/api/MemberRelatedInfo/getMemberRelatedInfos"; | 116 | restTemplate.postForEntity(url, objectObjectHashMap, String.class); |
132 | log.info("request uc : url is " + url + ", memberId is " + memberId); | 117 | /*ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, subscribeBean, String.class); |
133 | ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); | 118 | String entityBody = ""; |
134 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 119 | if (responseEntity.getStatusCode().is2xxSuccessful()) { |
135 | String entityBody = responseEntity.getBody(); | 120 | entityBody = responseEntity.getBody(); |
136 | JSONObject jsonObject = JSONObject.parseObject(entityBody); | ||
137 | if (jsonObject.getInteger("businessCode").equals(200)) { | ||
138 | resultSet = jsonObject.getJSONArray("resultSet").getJSONObject(0); | ||
139 | } | ||
140 | } | 121 | } |
141 | log.info("uc response: " + resultSet.toJSONString()); | 122 | log.info("uc response: " + entityBody);*/ |
142 | return resultSet; | 123 | return null; |
143 | } | 124 | } |
144 | 125 | ||
145 | public String getMemberAddress(Map<String, Object> param) { | 126 | public String sendQrCodeMessage(String content) { |
127 | String url = BASE_URL + "/ucEngine/api/userOperation/sendQrCodeMessage"; | ||
128 | restTemplate.postForEntity(url, content, String.class); | ||
129 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); | ||
146 | String entityBody = ""; | 130 | String entityBody = ""; |
147 | String url = BASE_URL + "/api/MemberAddress/pageMemberAddress?page=" + param.get("page") + "&size=" + param.get("size") + "&memberId=" + param.get("memberId"); | ||
148 | log.info("request uc : url is " + url + ", param is " + param); | ||
149 | ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); | ||
150 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 131 | if (responseEntity.getStatusCode().is2xxSuccessful()) { |
151 | entityBody = responseEntity.getBody(); | 132 | entityBody = responseEntity.getBody(); |
152 | } | 133 | } |
153 | log.info("uc response: " + entityBody); | 134 | log.info("uc response: " + entityBody);*/ |
154 | return entityBody; | 135 | return null; |
155 | } | 136 | } |
156 | 137 | ||
157 | public String getMemberRelatedInfo(Map<String, Object> param) { | 138 | public String addCollection(String content) { |
139 | String url = BASE_URL + "/ucEngine/api/userOperation/addCollection"; | ||
140 | restTemplate.postForEntity(url, content, String.class); | ||
141 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); | ||
158 | String entityBody = ""; | 142 | String entityBody = ""; |
159 | String url = BASE_URL + "/api/MemberRelatedInfo/pageMemberRelatedInfos?page=" + param.get("page") + "&size=" + param.get("size") + "&memberId=" + param.get("memberId"); | ||
160 | log.info("request uc : url is " + url + ", memberId is " + param); | ||
161 | ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); | ||
162 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 143 | if (responseEntity.getStatusCode().is2xxSuccessful()) { |
163 | entityBody = responseEntity.getBody(); | 144 | entityBody = responseEntity.getBody(); |
164 | } | 145 | } |
165 | log.info("uc response: " + entityBody); | 146 | log.info("uc response: " + entityBody);*/ |
166 | return entityBody; | 147 | return null; |
167 | } | ||
168 | |||
169 | public void deleteMemberRelatedInfo(Long memberRelatedId) { | ||
170 | String url = BASE_URL + "/api/MemberRelatedInfo/delete/" + memberRelatedId; | ||
171 | log.info("request uc : url is " + url + ", memberId is " + memberRelatedId); | ||
172 | restTemplate.delete(url, String.class); | ||
173 | } | 148 | } |
174 | 149 | ||
175 | public String addMemberRelatedInfo(MemberRelatedInfo resources) { | 150 | public String deleteCollection(String content) { |
176 | String entityBody = null; | 151 | String url = BASE_URL + "/ucEngine/api/userOperation/deleteCollection"; |
177 | String url = BASE_URL + "/api/MemberRelatedInfo/create"; | 152 | restTemplate.postForEntity(url, content, String.class); |
178 | log.info("request uc : url is " + url + ", memberRelatedId is " + JSONObject.toJSONString(resources)); | 153 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); |
179 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, resources, String.class); | 154 | String entityBody = ""; |
180 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 155 | if (responseEntity.getStatusCode().is2xxSuccessful()) { |
181 | entityBody = responseEntity.getBody(); | 156 | entityBody = responseEntity.getBody(); |
182 | // JSONObject jsonObject = JSONObject.parseObject(entityBody); | ||
183 | // if (jsonObject.getInteger("businessCode").equals(200)) { | ||
184 | // resultSet = jsonObject.getJSONArray("resultSet").getJSONObject(0); | ||
185 | // } | ||
186 | } | 157 | } |
187 | log.info("uc response: " + entityBody); | 158 | log.info("uc response: " + entityBody);*/ |
188 | return entityBody; | 159 | return null; |
189 | } | 160 | } |
190 | 161 | ||
191 | public String updateMemberRelatedInfo(MemberRelatedInfo resources) { | 162 | public String deleteAllCollection(String content) { |
192 | String resultSet = ""; | 163 | String url = BASE_URL + "/ucEngine/api/userOperation/deleteAllCollection"; |
193 | String url = BASE_URL + "/api/MemberRelatedInfo/update"; | 164 | restTemplate.postForEntity(url, content, String.class); |
194 | log.info("request uc : url is " + url + ", memberRelatedId is " + JSONObject.toJSONString(resources)); | 165 | /*ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class); |
195 | restTemplate.put(url, resources); | 166 | String entityBody = ""; |
196 | 167 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | |
197 | return resultSet; | 168 | entityBody = responseEntity.getBody(); |
169 | } | ||
170 | log.info("uc response: " + entityBody);*/ | ||
171 | return null; | ||
198 | } | 172 | } |
199 | } | 173 | } | ... | ... |
1 | #配置数据源 | ||
2 | spring: | 1 | spring: |
2 | # 数据源 | ||
3 | datasource: | 3 | datasource: |
4 | # 测试/演示库 | 4 | # 数据源地址 |
5 | url: jdbc:log4jdbc:mysql://139.196.37.202:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | 5 | url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false |
6 | # 用户名 | ||
6 | username: root | 7 | username: root |
7 | password: Topdraw1qaz | 8 | # 密码 |
8 | # url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | 9 | password: root |
9 | # username: root | 10 | # 驱动程序 |
10 | # password: root | ||
11 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy | 11 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy |
12 | #Druid | 12 | # Druid |
13 | type: com.alibaba.druid.pool.DruidDataSource | 13 | type: com.alibaba.druid.pool.DruidDataSource |
14 | druid: | 14 | druid: |
15 | # 初始化配置 | 15 | # 初始化配置 |
... | @@ -27,57 +27,149 @@ spring: | ... | @@ -27,57 +27,149 @@ spring: |
27 | test-while-idle: true | 27 | test-while-idle: true |
28 | test-on-borrow: false | 28 | test-on-borrow: false |
29 | test-on-return: false | 29 | test-on-return: false |
30 | |||
31 | validation-query: select 1 | 30 | validation-query: select 1 |
32 | # 配置监控统计拦截的filters | 31 | # 配置监控统计拦截的filters |
33 | filters: stat | 32 | filters: stat |
34 | stat-view-servlet: | 33 | stat-view-servlet: |
35 | url-pattern: /druid/* | 34 | url-pattern: /druid/* |
36 | reset-enable: false | 35 | reset-enable: false |
37 | 36 | # 过滤器 | |
38 | web-stat-filter: | 37 | web-stat-filter: |
39 | url-pattern: /* | 38 | url-pattern: /* |
40 | exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*" | 39 | exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*" |
41 | 40 | ||
41 | # freemarker | ||
42 | freemarker: | ||
43 | check-template-location: false | ||
44 | jackson: | ||
45 | time-zone: GMT+8 | ||
46 | data: | ||
47 | redis: | ||
48 | repositories: | ||
49 | enabled: false | ||
42 | 50 | ||
43 | rabbitmq: | 51 | # jpa |
44 | user-center: | ||
45 | host: 47.100.212.170 # rabbitmq的连接地址 | ||
46 | #host: 139.196.192.242 # rabbitmq的连接地址 | ||
47 | port: 5672 # rabbitmq的连接端口号 | ||
48 | virtual-host: / # rabbitmq的虚拟host | ||
49 | username: test # rabbitmq的用户名 | ||
50 | password: test # rabbitmq的密码 | ||
51 | publisher-confirms: true #如果对异步消息需要回调必须设置为true | ||
52 | member-service: | ||
53 | host: 139.196.145.150 # rabbitmq的连接地址 | ||
54 | port: 5672 # rabbitmq的连接端口号 | ||
55 | virtual-host: member_center # rabbitmq的虚拟host | ||
56 | username: admin # rabbitmq的用户名 | ||
57 | password: Topdraw1qaz # rabbitmq的密码 | ||
58 | publisher-confirms: true #如果对异步消息需要回调必须设置为true | ||
59 | |||
60 | |||
61 | #配置 Jpa | ||
62 | jpa: | 52 | jpa: |
53 | properties: | ||
54 | hibernate: | ||
55 | # 数据库类型 | ||
56 | dialect: org.hibernate.dialect.MySQL5InnoDBDialect | ||
63 | hibernate: | 57 | hibernate: |
64 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 | 58 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 |
65 | ddl-auto: none | 59 | ddl-auto: none |
60 | open-in-view: true | ||
61 | |||
62 | # 文件上传 | ||
66 | servlet: | 63 | servlet: |
67 | multipart: | 64 | multipart: |
68 | file-size-threshold: 2KB | 65 | file-size-threshold: 2KB |
69 | max-file-size: 100MB | 66 | max-file-size: 100MB |
70 | max-request-size: 200MB | 67 | max-request-size: 200MB |
68 | |||
69 | # redis | ||
71 | redis: | 70 | redis: |
72 | #数据库索引 | 71 | # 数据库索引 |
73 | database: 6 | 72 | database: 0 |
73 | # ip | ||
74 | host: 122.112.214.149 | 74 | host: 122.112.214.149 |
75 | # 密码是 | ||
76 | password: redis123 | ||
77 | # 端口 | ||
75 | port: 6379 | 78 | port: 6379 |
76 | #连接超时时间 | 79 | # 连接超时时间 |
77 | timeout: 5000 | 80 | timeout: 5000 |
78 | 81 | ||
82 | # rabbitmq | ||
83 | # rabbitmq: | ||
84 | # # ip | ||
85 | # host: 139.196.145.150 | ||
86 | # # 端口号 | ||
87 | # port: 5672 | ||
88 | # # 用户名 | ||
89 | # username: admin # rabbitmq的用户名 | ||
90 | # # 密码 | ||
91 | # password: Topdraw1qaz | ||
92 | # # 虚拟空间 | ||
93 | # virtual-host: member_center | ||
94 | # # 如果对异步消息需要回调必须设置为true | ||
95 | # publisher-confirms: true | ||
96 | |||
97 | #是否允许生成代码,生产环境设置为false | ||
98 | generator: | ||
99 | enabled: false | ||
100 | |||
101 | #是否开启 swagger-ui | ||
102 | swagger: | ||
103 | enabled: true | ||
104 | |||
105 | |||
106 | ###########################################自定义属性################################################################# | ||
107 | # 多mq配置 | ||
108 | mutil-mq: | ||
109 | # 服务侧 | ||
110 | service: | ||
111 | # ip | ||
112 | host: 139.196.192.242 | ||
113 | # 端口 | ||
114 | port: 5672 | ||
115 | # 用户名 | ||
116 | username: member_center | ||
117 | # 密码 | ||
118 | password: Tjlh@2021 | ||
119 | # 虚拟空间 | ||
120 | virtual-host: /member_center | ||
121 | |||
122 | # 管理侧 | ||
123 | management: | ||
124 | # ip | ||
125 | # host: 139.196.145.150 | ||
126 | # # 端口 | ||
127 | # port: 5672 | ||
128 | # # 用户名 | ||
129 | # username: admin | ||
130 | # # 密码 | ||
131 | # password: Topdraw1qaz | ||
132 | # # 虚拟空间 | ||
133 | # virtual-host: member_center | ||
134 | # ip | ||
135 | host: 139.196.145.150 | ||
136 | # 端口 | ||
137 | port: 5672 | ||
138 | # 用户名 | ||
139 | username: admin | ||
140 | # 密码 | ||
141 | password: Topdraw1qaz | ||
142 | # 虚拟空间 | ||
143 | virtual-host: /member_center | ||
144 | |||
145 | #登录图形验证码有效时间/分钟 | ||
146 | loginCode: | ||
147 | expiration: 2 | ||
79 | 148 | ||
80 | #jwt。依赖的common中有需要jwt的部分属性。 | 149 | # 服务属性 |
150 | service: | ||
151 | # 服务域 mobile:小屏侧 vis:大屏侧 | ||
152 | area: vis | ||
153 | #平台类型 service: 服务侧 management: 管理侧 | ||
154 | platform: service | ||
155 | |||
156 | # uc-engine服务地址 | ||
157 | api: | ||
158 | baseUrl: http://127.0.0.1:8447 | ||
159 | |||
160 | # 线程池设置 | ||
161 | task: | ||
162 | pool: | ||
163 | # 核心线程池大小 | ||
164 | core-pool-size: 10 | ||
165 | # 最大线程数 | ||
166 | max-pool-size: 30 | ||
167 | # 活跃时间 | ||
168 | keep-alive-seconds: 60 | ||
169 | # 队列容量 | ||
170 | queue-capacity: 50 | ||
171 | |||
172 | #权限 jwt。依赖的common中有需要jwt的部分属性。 | ||
81 | jwt: | 173 | jwt: |
82 | header: Authorization | 174 | header: Authorization |
83 | secret: mySecret | 175 | secret: mySecret |
... | @@ -90,32 +182,4 @@ jwt: | ... | @@ -90,32 +182,4 @@ jwt: |
90 | # token 续期检查时间范围(60分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期 | 182 | # token 续期检查时间范围(60分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期 |
91 | detect: 3600000 | 183 | detect: 3600000 |
92 | # 续期时间,2小时,单位毫秒 | 184 | # 续期时间,2小时,单位毫秒 |
93 | renew: 7200000 | 185 | renew: 7200000 |
94 | |||
95 | #是否允许生成代码,生产环境设置为false | ||
96 | generator: | ||
97 | enabled: true | ||
98 | |||
99 | #是否开启 swagger-ui | ||
100 | swagger: | ||
101 | enabled: true | ||
102 | |||
103 | |||
104 | |||
105 | # 文件存储路径(相对路径) | ||
106 | file: | ||
107 | path: system/file | ||
108 | avatar: system/avatar | ||
109 | upload: upload | ||
110 | # 文件大小 /M | ||
111 | maxSize: 100 | ||
112 | avatarMaxSize: 5 | ||
113 | |||
114 | uc: | ||
115 | service: | ||
116 | # uc两侧部署,需配置位于哪一侧 mobile小屏侧 vis大屏侧 | ||
117 | type: vis | ||
118 | |||
119 | api: | ||
120 | # baseUrl: http://139.196.4.234:8447 | ||
121 | baseUrl: http://localhost:8447 | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | #配置数据源 | ||
2 | spring: | ||
3 | datasource: | ||
4 | url: jdbc:log4jdbc:mysql://172.0.31.91:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
5 | username: root | ||
6 | password: Tjlh@2021 | ||
7 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy | ||
8 | #Druid | ||
9 | type: com.alibaba.druid.pool.DruidDataSource | ||
10 | druid: | ||
11 | # 初始化配置 | ||
12 | initial-size: 3 | ||
13 | # 最小连接数 | ||
14 | min-idle: 3 | ||
15 | # 最大连接数 | ||
16 | max-active: 15 | ||
17 | # 获取连接超时时间 | ||
18 | max-wait: 5000 | ||
19 | # 连接有效性检测时间 | ||
20 | time-between-eviction-runs-millis: 90000 | ||
21 | # 最大空闲时间 | ||
22 | min-evictable-idle-time-millis: 1800000 | ||
23 | test-while-idle: true | ||
24 | test-on-borrow: false | ||
25 | test-on-return: false | ||
26 | |||
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 | hibernate: | ||
41 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 | ||
42 | ddl-auto: none | ||
43 | servlet: | ||
44 | multipart: | ||
45 | file-size-threshold: 2KB | ||
46 | max-file-size: 100MB | ||
47 | max-request-size: 200MB | ||
48 | redis: | ||
49 | #数据库索引 | ||
50 | database: 0 | ||
51 | host: 127.0.0.1 | ||
52 | port: 6379 | ||
53 | password: | ||
54 | #连接超时时间 | ||
55 | timeout: 5000 | ||
56 | rabbitmq: | ||
57 | host: 172.0.31.96 # rabbitmq的连接地址 | ||
58 | port: 5672 # rabbitmq的连接端口号 | ||
59 | virtual-host: member_center # rabbitmq的虚拟host | ||
60 | username: admin # rabbitmq的用户名 | ||
61 | password: Tjlh@2021 # rabbitmq的密码 | ||
62 | publisher-confirms: true #如果对异步消息需要回调必须设置为true | ||
63 | listener: | ||
64 | direct: | ||
65 | auto-startup: false | ||
66 | simple: | ||
67 | auto-startup: false | ||
68 | |||
69 | #jwt。依赖的common中有需要jwt的部分属性。 | ||
70 | jwt: | ||
71 | header: Authorization | ||
72 | secret: mySecret | ||
73 | # token 过期时间/毫秒,6小时 1小时 = 3600000 毫秒 | ||
74 | expiration: 7200000 | ||
75 | # 在线用户key | ||
76 | online: online-token | ||
77 | # 验证码 | ||
78 | codeKey: code-key | ||
79 | # token 续期检查时间范围(60分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期 | ||
80 | detect: 3600000 | ||
81 | # 续期时间,2小时,单位毫秒 | ||
82 | renew: 7200000 | ||
83 | |||
84 | #是否允许生成代码,生产环境设置为false | ||
85 | generator: | ||
86 | enabled: true | ||
87 | |||
88 | #是否开启 swagger-ui | ||
89 | swagger: | ||
90 | enabled: true | ||
91 | |||
92 | # 文件存储路径(相对路径) | ||
93 | file: | ||
94 | path: system/file | ||
95 | avatar: system/avatar | ||
96 | upload: upload | ||
97 | # 文件大小 /M | ||
98 | maxSize: 100 | ||
99 | avatarMaxSize: 5 | ||
100 | |||
101 | uc: | ||
102 | service: | ||
103 | # uc两侧部署,需配置位于哪一侧 mobile小屏侧 vis大屏侧 | ||
104 | type: vis | ||
105 | |||
106 | api: | ||
107 | # baseUrl: http://139.196.4.234:8447 | ||
108 | baseUrl: http://172.0.31.94:8447 |
1 | #配置数据源 | ||
2 | spring: | ||
3 | datasource: | ||
4 | # 测试/演示库 | ||
5 | #url: jdbc:log4jdbc:mysql://139.196.37.202:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
6 | #username: root | ||
7 | #password: Topdraw1qaz | ||
8 | url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
9 | username: root | ||
10 | password: root | ||
11 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy | ||
12 | # driverClassName: com.mysql.jdbc.Driver | ||
13 | #Druid | ||
14 | type: com.alibaba.druid.pool.DruidDataSource | ||
15 | druid: | ||
16 | # 初始化配置 | ||
17 | initial-size: 3 | ||
18 | # 最小连接数 | ||
19 | min-idle: 3 | ||
20 | # 最大连接数 | ||
21 | max-active: 15 | ||
22 | # 获取连接超时时间 | ||
23 | max-wait: 5000 | ||
24 | # 连接有效性检测时间 | ||
25 | time-between-eviction-runs-millis: 90000 | ||
26 | # 最大空闲时间 | ||
27 | min-evictable-idle-time-millis: 1800000 | ||
28 | test-while-idle: true | ||
29 | test-on-borrow: false | ||
30 | test-on-return: false | ||
31 | |||
32 | validation-query: select 1 | ||
33 | # 配置监控统计拦截的filters | ||
34 | filters: stat | ||
35 | stat-view-servlet: | ||
36 | url-pattern: /druid/* | ||
37 | reset-enable: false | ||
38 | |||
39 | web-stat-filter: | ||
40 | url-pattern: /* | ||
41 | exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*" | ||
42 | |||
43 | #配置 Jpa | ||
44 | jpa: | ||
45 | hibernate: | ||
46 | # 生产环境设置成 none,避免程序运行时自动更新数据库结构 | ||
47 | ddl-auto: none | ||
48 | servlet: | ||
49 | multipart: | ||
50 | file-size-threshold: 2KB | ||
51 | max-file-size: 100MB | ||
52 | max-request-size: 200MB | ||
53 | redis: | ||
54 | #数据库索引 | ||
55 | database: 6 | ||
56 | host: 127.0.0.1 | ||
57 | port: 6379 | ||
58 | password: | ||
59 | #连接超时时间 | ||
60 | timeout: 5000 | ||
61 | rabbitmq: | ||
62 | host: 122.112.214.149 # rabbitmq的连接地址 | ||
63 | #host: 139.196.192.242 # rabbitmq的连接地址 | ||
64 | port: 5672 # rabbitmq的连接端口号 | ||
65 | #virtual-host: /member_center # rabbitmq的虚拟host | ||
66 | #username: member_center # rabbitmq的用户名 | ||
67 | #password: Tjlh@2021 # rabbitmq的密码 | ||
68 | virtual-host: / # rabbitmq的虚拟host | ||
69 | username: guest # rabbitmq的用户名 | ||
70 | password: guest # rabbitmq的密码 | ||
71 | publisher-confirms: true #如果对异步消息需要回调必须设置为true | ||
72 | |||
73 | #jwt。依赖的common中有需要jwt的部分属性。 | ||
74 | jwt: | ||
75 | header: Authorization | ||
76 | secret: mySecret | ||
77 | # token 过期时间/毫秒,6小时 1小时 = 3600000 毫秒 | ||
78 | expiration: 7200000 | ||
79 | # 在线用户key | ||
80 | online: online-token | ||
81 | # 验证码 | ||
82 | codeKey: code-key | ||
83 | # token 续期检查时间范围(60分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期 | ||
84 | detect: 3600000 | ||
85 | # 续期时间,2小时,单位毫秒 | ||
86 | renew: 7200000 | ||
87 | |||
88 | #是否允许生成代码,生产环境设置为false | ||
89 | generator: | ||
90 | enabled: true | ||
91 | |||
92 | #是否开启 swagger-ui | ||
93 | swagger: | ||
94 | enabled: true | ||
95 | |||
96 | # 文件存储路径(相对路径) | ||
97 | file: | ||
98 | path: system/file | ||
99 | avatar: system/avatar | ||
100 | upload: upload | ||
101 | # 文件大小 /M | ||
102 | maxSize: 100 | ||
103 | avatarMaxSize: 5 | ||
104 | |||
105 | uc: | ||
106 | service: | ||
107 | # uc两侧部署,需配置位于哪一侧 mobile小屏侧 vis大屏侧 | ||
108 | type: mobile | ||
109 | |||
110 | api: | ||
111 | # baseUrl: http://139.196.4.234:8447 | ||
112 | baseUrl: http://localhost:8447 |
1 | # 服务器 | ||
1 | server: | 2 | server: |
3 | # 服务端口号 | ||
2 | port: 8448 | 4 | port: 8448 |
3 | 5 | ||
4 | spring: | 6 | spring: |
7 | # 服务 | ||
5 | application: | 8 | application: |
6 | name: member-engine | 9 | # 服务名 |
7 | freemarker: | 10 | name: uc-consumer |
8 | check-template-location: false | 11 | # 配置文件 |
9 | profiles: | 12 | profiles: |
13 | # 启动具体的配置文件 | ||
10 | active: dev | 14 | active: dev |
11 | jackson: | ||
12 | time-zone: GMT+8 | ||
13 | data: | ||
14 | redis: | ||
15 | repositories: | ||
16 | enabled: false | ||
17 | 15 | ||
18 | #配置 Jpa | ||
19 | jpa: | ||
20 | properties: | ||
21 | hibernate: | ||
22 | dialect: org.hibernate.dialect.MySQL5InnoDBDialect | ||
23 | open-in-view: true | ||
24 | 16 | ||
25 | 17 | ||
26 | task: | ||
27 | pool: | ||
28 | # 核心线程池大小 | ||
29 | core-pool-size: 10 | ||
30 | # 最大线程数 | ||
31 | max-pool-size: 30 | ||
32 | # 活跃时间 | ||
33 | keep-alive-seconds: 60 | ||
34 | # 队列容量 | ||
35 | queue-capacity: 50 | ||
36 | |||
37 | #登录图形验证码有效时间/分钟 | ||
38 | loginCode: | ||
39 | expiration: 2 | ||
40 | |||
41 | #默认上传图片类型 | ||
42 | default-image-type: -1 | ... | ... |
-
Please register or sign in to post a comment