Commit 7d7f63e9 7d7f63e9dc138935de348bfc7f689016517c790f by xianghan@topdraw.cn

1.添加公众号关注、取关消费者

1 parent c46df744
......@@ -16,6 +16,35 @@ import org.springframework.context.annotation.Primary;
@Configuration
public class RabbitMqConfig {
//////////////////////////////////////////////////////// OMO 小屏///////////////////////////////////////////////////////////////
/** 获取带参二维码(大屏->小屏) */
public static final String GET_QR_CODE_QUEUE = "queue.qrCode.get";
/** 删除全部收藏队列(大屏->小屏) */
public static final String COLLECTION_DELETE_ALL_QUEUE = "queue.collection.deleteall";
/** 添加收藏队列(大屏->小屏) */
public static final String COLLECTION_ADD_QUEUE = "queue.collection.add";
/** 删除收藏队列(大屏->小屏) */
public static final String COLLECTION_DELETE_QUEUE = "queue.collection.delete";
/** 微信侧 公众号关注与取消关注 */
public static final String WEIXIN_SUBORUNSUB_QUEUE = "weixin.subOrUnSub.queue";
//////////////////////////////////////////////////////// 重数 ///////////////////////////////////////////////////////////////
/** 路由(事件)--direct route.key*/
// 事件,uc-gateway
public static final String UC_ROUTE_KEY_DIRECT_EVENT_AAA = "uc.route.key.direct.event.aaa";
......@@ -123,4 +152,6 @@ public class RabbitMqConfig {
public Queue eventDirect() {
return new Queue(UC_ROUTE_KEY_DIRECT_EVENT_AAA);
}
}
......
package com.topdraw.mq.consumer;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class UcEngineEventConsumer {
private static final Logger LOG = LoggerFactory.getLogger(UcEngineEventConsumer.class);
@Autowired
AutoRoute autoUser;
}
package com.topdraw.mq.consumer;
import com.topdraw.config.RabbitMqConfig;
import com.topdraw.mq.domain.TableOperationMsg;
import com.topdraw.util.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class UcEngineManageConsumer {
private static final Logger LOG = LoggerFactory.getLogger(UcEngineManageConsumer.class);
@Autowired
AutoRoute autoUser;
/**
* @param content
* @description 基础数据同步
* @author Hongyan Wang
* @date 2021/9/7 11:26 上午
*/
/*@RabbitHandler
@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_CCC),
exchange = @Exchange(value = ExchangeTypes.DIRECT))
}, containerFactory = "managementRabbitListenerContainerFactory")
public void memberServiceFanoutConsumer(String content) {
try {
log.info(" receive dataSync msg , content is : {} ", content);
TableOperationMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, TableOperationMsg.class);
autoUser.route(dataSyncMsg);
LOG.info("memberServiceFanoutConsumer ====>>>> "+dataSyncMsg);
} catch (Exception e) {
log.error(" LocalDataSyncMsg || msg:{} || error:{} ", content, e.getMessage());
}
}*/
}
package com.topdraw.mq.consumer;
import com.topdraw.config.RabbitMqConfig;
import com.topdraw.mq.domain.TableOperationMsg;
import com.topdraw.resttemplate.RestTemplateClient;
import com.topdraw.util.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class UcEngineServiceConsumer {
@Autowired
RestTemplateClient restTemplateClient;
@Autowired
AutoRoute autoUser;
/**
* 事件
* @param content
* @description 基础数据同步
* @author Hongyan Wang
* @date 2021/9/7 11:26 上午
*/
@RabbitHandler
@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_BBB),
exchange = @Exchange(value = ExchangeTypes.DIRECT))
}, containerFactory = "serviceRabbitListenerContainerFactory")
public void ucEventConsumer(String content) {
log.info(" receive dataSync msg , content is : {} ", content);
TableOperationMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, TableOperationMsg.class);
autoUser.route(dataSyncMsg);
log.info("ucEventConsumer ====>>>> end");
}
}
......@@ -13,7 +13,7 @@ import org.springframework.util.Assert;
@Component
@Slf4j
public class UcGatewayConsumer {
public class UcGatewayEventConsumer {
@Autowired
RestTemplateClient restTemplateClient;
......@@ -28,7 +28,7 @@ public class UcGatewayConsumer {
* @author Hongyan Wang
* @date 2021/9/7 11:26 上午
*/
/*@RabbitHandler
@RabbitHandler
@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_AAA),
exchange = @Exchange(value = ExchangeTypes.DIRECT))
......@@ -38,7 +38,7 @@ public class UcGatewayConsumer {
DataSyncMsg dataSyncMsg = this.parseContent(content);
this.taskDeal(dataSyncMsg);
log.info("ucEventConsumer ====>>>> end");
}*/
}
/**
* 数据解析
......
package com.topdraw.mq.consumer;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.config.RabbitMqConfig;
import com.topdraw.mq.domain.SubscribeBean;
import com.topdraw.resttemplate.RestTemplateClient;
import com.topdraw.utils.RedisUtils;
import com.topdraw.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* 微信事件
*/
@Component
@Slf4j
public class WeiXinEventConsumer {
@Autowired
private RestTemplateClient restTemplateClient;
@Value("${subAppId:wx05f35931270014be}")
private String subAppId;
@Autowired
private RedisUtils redisUtils;
private static final String QR_CODE_URL = "QR_CODE_URL_";
/**
* @description 删除用户收藏记录
* @param content 消息内容
*/
@RabbitHandler
@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_QUEUE),
exchange = @Exchange(value = ExchangeTypes.DIRECT))})
public void deleteCollection(String content) {
try {
log.info("receive UserCollection delete message, content {}", content);
JSONObject jsonObject = JSONObject.parseObject(content);
String platformAccount = jsonObject.getString("platformAccount");
String data = jsonObject.getString("data");
if (StringUtils.isBlank(data) || !data.startsWith("[")) {
// return;
}
/*Optional<TvUser> userOptional = tvUserRepository.findByPlatformAccount(platformAccount);
if (!userOptional.isPresent()) {
return;
}
Long id = userOptional.get().getId();
List<UserCollectionMq> userCollectionMqList = JSONObject.parseArray(data, UserCollectionMq.class);
if (userCollectionMqList == null || userCollectionMqList.isEmpty()) {
return;
}
Map<Long, List<UserCollectionMq>> collect = userCollectionMqList.stream().collect(Collectors.groupingBy(UserCollectionMq::getUserCollectionId));
for (Map.Entry<Long, List<UserCollectionMq>> entry : collect.entrySet()) {
List<UserCollectionMq> value = entry.getValue();
UserCollectionMq userCollectionMq = value.get(0);
if (StringUtils.isBlank(userCollectionMq.getName())) {
userCollectionMq.setName("DEFAULT");
}
Optional<UserCollection> userCollectionOptional = userCollectionRepository.findFirstByUserIdAndTypeAndName(id, userCollectionMq.getType(), userCollectionMq.getName());
UserCollection userCollection = userCollectionOptional.orElseGet(UserCollection::new);
int count = 0;
for (UserCollectionMq collectionMq : value) {
collectionMq.setUserCollectionId(userCollection.getId());
List<UserCollectionDetail> userCollectionDetailOptional = userCollectionDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, collectionMq, criteriaBuilder));
if (!userCollectionDetailOptional.isEmpty()) {
userCollectionDetailRepository.deleteAll(userCollectionDetailOptional);
count++;
}
}
userCollection.setAppId(userCollectionMq.getAppId())
.setUserId(id)
.setName(userCollectionMq.getName())
.setType(userCollectionMq.getType())
.setCount(userCollection.getCount() - count);
userCollectionRepository.save(userCollection);
}*/
this.restTemplateClient.deleteCollection(content);
} catch (Exception e) {
log.error("CollectionDeleteConsumer || UserCollection delete error || {}", e.toString(), e);
}
}
/**
* @description 删除全部收藏记录
* @param content 消息内容
*/
@RabbitHandler
@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_DELETE_ALL_QUEUE),
exchange = @Exchange(value = ExchangeTypes.DIRECT))})
@Transactional
public void deleteAllCollection(String content) {
try {
log.info("receive UserCollection delete all message, content {}", content);
JSONObject jsonObject = JSONObject.parseObject(content);
String platformAccount = jsonObject.getString("platformAccount");
Integer type = jsonObject.getInteger("collectionType");
/* Optional<TvUser> userOptional = tvUserRepository.findByPlatformAccount(platformAccount);
if (!userOptional.isPresent()) {
return;
}
Long id = userOptional.get().getId();
List<UserCollection> userCollections = userCollectionRepository.findByUserIdAndType(id, type);
if (userCollections == null || userCollections.isEmpty()) {
return;
}
for (UserCollection userCollection : userCollections) {
userCollectionDetailRepository.deleteAllByUserCollectionId(userCollection.getId());
}*/
this.restTemplateClient.deleteAllCollection(content);
} catch (Exception e) {
log.error("CollectionDeleteConsumer || UserCollection delete all error || {}", e.toString(), e);
}
}
/**
* 处理带参的二维码事件
* @param content 消息内容
* @description 获取公众号带参二维码
*/
@RabbitHandler
@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = RabbitMqConfig.GET_QR_CODE_QUEUE),
exchange = @Exchange(value = ExchangeTypes.DIRECT))})
public void getQrCode(String content) {
try {
log.info("receive get qrCode message, content {}", content);
JSONObject jsonObject = JSONObject.parseObject(content);
/*String appid = jsonObject.getString("appid");
String IPTVappid = jsonObject.getString("IPTVappid");
String platformAccount = jsonObject.getString("platformAccount");
String sessionId = jsonObject.getString("sessionId");
String key = QR_CODE_URL + appid + "_" + platformAccount + "_" + sessionId;
String url = (String) redisUtils.get(key);
if (StringUtils.isBlank(url)) {
Map<String, String> wxInfo = WeixinUtil.getWeixinInfoByAppid(appid);
var appType = wxInfo.get("appType");
// 订阅号不支持带参二维码,直接返回
if (StrUtil.isNotEmpty(appType) && ObjectUtil.equals(appType, WeChatConstants.WX_SUBSCRIPTION)) {
log.error("订阅号不支持带参二维码 || {} || {}", appid, content);
return;
}
QrCode qrCode = new QrCode();
qrCode.setActionName(WeChatConstants.QR_STR_SCENE);
if (StringUtils.isNotBlank(wxInfo.get("qrCodeExpireSeconds"))) {
qrCode.setExpireSeconds(Integer.valueOf(wxInfo.get("qrCodeExpireSeconds")));
}
ActionInfo actionInfo = new ActionInfo();
Scene scene = new Scene();
scene.setSceneStr(content);
actionInfo.setScene(scene);
qrCode.setActionInfo(actionInfo);
JSONObject jsonQrCode = weixinRequestUtil.getQrCode(wxInfo, qrCode);
url = jsonQrCode.getString("url");
Integer expireSeconds = jsonQrCode.getInteger("expire_seconds");
redisUtils.set(key, url, expireSeconds, TimeUnit.SECONDS);
}
HashMap<String, Object> map = new HashMap<>();
map.put("sessionId", sessionId);
map.put("url", url);
map.put("appid", appid);
map.put("IPTVappid", IPTVappid);
map.put("platformAccount", platformAccount);
map.put("extraInfo", content);*/
restTemplateClient.sendQrCodeMessage(content);
} catch (Exception e) {
log.error("GetQrCodeConsumer || get qrCode error || {}", e.toString(), e);
}
}
/**
* 关注和取关事件
* eg:
* {
* "appIdMap": "{\"mpId\":\"234\"}",
* "allFieldsMap":"{\"FromUserName\":\"4343\",\"MsgType\":\"event\",\"Event\":\"unsubscribe\"}"
* }
* @param content
*/
@RabbitHandler
@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = RabbitMqConfig.WEIXIN_SUBORUNSUB_QUEUE),
exchange = @Exchange(value = ExchangeTypes.DIRECT))})
@Transactional
public void subOrUnSubEvent(String content) {
try {
log.info("receive wxu subOrUnSub message, content {}", content);
JSONObject jsonObject = JSONObject.parseObject(content);
JSONObject map = jsonObject.getJSONObject("appIdMap");
JSONObject wechatMsg = jsonObject.getJSONObject("allFieldsMap");
String appid = map.getString("mpId");
// Map<String, String> wxInfoMap = WeixinUtil.getWeixinInfoByAppid(appid);
String openid = wechatMsg.getString("FromUserName");
String msgType = wechatMsg.getString("MsgType");
if ("event".equals(msgType)) {
String event = wechatMsg.getString("Event");
String eventKey = wechatMsg.getString("EventKey");
SubscribeBean subscribeBean = new SubscribeBean(openid,appid,eventKey);
if (event.equals("subscribe"))
this.restTemplateClient.subscribe(subscribeBean);
if (event.equals("unsubscribe"))
this.restTemplateClient.unsubscribe(subscribeBean);
}
} catch (Exception e) {
log.error("WXSubscribeConsumer || subOrUnSub msg error || {} || {}", content, e.getMessage());
}
}
/**
* @description 添加收藏记录
* @param content 消息内容
*/
@RabbitHandler
@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = RabbitMqConfig.COLLECTION_ADD_QUEUE),
exchange = @Exchange(value = ExchangeTypes.DIRECT))})
@Transactional
public void addCollection(String content) {
try {
log.info("receive UserCollection add message, content {}", content);
JSONObject jsonObject = JSONObject.parseObject(content);
String platformAccount = jsonObject.getString("platformAccount");
String data = jsonObject.getString("data");
if (StringUtils.isBlank(data) || !data.startsWith("[")) {
// return;
}
/*Optional<TvUser> userOptional = tvUserRepository.findByPlatformAccount(platformAccount);
if (!userOptional.isPresent()) {
return;
}
Long tvUserId = userOptional.get().getId();
List<UserCollectionMq> userCollectionMqList = JSONObject.parseArray(data, UserCollectionMq.class);
if (userCollectionMqList == null || userCollectionMqList.isEmpty()) {
return;
}
Map<Long, List<UserCollectionMq>> collect = userCollectionMqList.stream().collect(Collectors.groupingBy(UserCollectionMq::getUserCollectionId));
for (Map.Entry<Long, List<UserCollectionMq>> entry : collect.entrySet()) {
List<UserCollectionMq> value = entry.getValue();
UserCollectionMq userCollectionMq = value.get(0);
if (StringUtils.isBlank(userCollectionMq.getName())) {
userCollectionMq.setName("DEFAULT");
}
UserCollection userCollection = userCollectionRepository
.findFirstByUserIdAndTypeAndName(tvUserId, userCollectionMq.getType(), userCollectionMq.getName()).orElseGet(UserCollection::new);
userCollection.setAppId(userCollectionMq.getAppId())
.setUserId(tvUserId)
.setName(userCollectionMq.getName())
.setType(userCollectionMq.getType())
.setCount(userCollection.getCount() == null ? value.size() : userCollection.getCount() + value.size());
UserCollection userCollectionSave = userCollectionRepository.save(userCollection);
for (UserCollectionMq collectionMq : value) {
UserCollectionDetail userCollectionDetail = collectionMq2DetailMapper.toEntity(collectionMq);
Optional<UserCollectionDetail> userCollectionDetailOptional = userCollectionDetailRepository
.findByDetailIdAndDetailTypeAndUserCollectionId(userCollectionDetail.getDetailId(), userCollectionDetail.getDetailType(), userCollectionSave.getId());
//观影记录同一天只存一条记录
if (userCollectionDetailOptional.isPresent() &&
DateUtil.isSameDay(new Date(userCollectionDetailOptional.get().getCreateTime().getTime()), new Date())) {
userCollectionDetail.setId(userCollectionDetailOptional.get().getId());
} else {
userCollectionDetail.setId(null)
.setUserCollectionId(userCollectionSave.getId());
}
userCollectionDetailRepository.save(userCollectionDetail);
}
}*/
this.restTemplateClient.addCollection(content);
} catch (Exception e) {
log.error("CollectionAddConsumer || UserCollection add error || {}", e.toString(), e);
}
}
}
package com.topdraw.mq.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SubscribeBean {
/** */
private String openId;
/** */
private String appId;
/** */
private String eventKey;
}
......@@ -6,6 +6,7 @@ import com.topdraw.business.basicdata.member.address.domain.MemberAddress;
import com.topdraw.business.basicdata.member.domain.Member;
import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.mq.domain.DataSyncMsg;
import com.topdraw.mq.domain.SubscribeBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
......@@ -41,7 +42,6 @@ public class RestTemplateClient {
}
public JSONObject dealTask(DataSyncMsg dataSyncMsg) {
JSONObject resultSet = null;
String url = BASE_URL + "/api/TaskOperation/dealTask";
log.info("request uc : url is " + url + ", dataSyncMsg is " + dataSyncMsg);
String content = JSON.toJSONString(dataSyncMsg);
......@@ -78,122 +78,96 @@ public class RestTemplateClient {
return resultSet;
}
public String createMember(Member member) {
String entityBody = "";
String url = BASE_URL + "/api/member/create";
public String createMemberAddress(MemberAddress member) {
String url = BASE_URL + "/api/MemberAddress/create";
log.info("request uc : url is " + url + ", memberId is " + JSONObject.toJSONString(member));
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, member, String.class);
restTemplate.postForEntity(url, member, String.class);
/* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, member, String.class);
String entityBody = "";
if (responseEntity.getStatusCode().is2xxSuccessful()) {
entityBody = responseEntity.getBody();
entityBody = responseEntity.getBody();
}
return entityBody;
log.info("uc response: " + entityBody);*/
return null;
}
public String updateMember(Member member) {
String entityBody = "";
String url = BASE_URL + "/api/member/update";
log.info("request uc : url is " + url + ", memberId is " + JSONObject.toJSONString(member));
restTemplate.put(url, member);
return entityBody;
}
public String unsubscribe(SubscribeBean subscribeBean) {
String url = BASE_URL + "/ucEngine/api/userOperation/unsubscribe";
String content = JSON.toJSONString(subscribeBean);
public String createMemberAddress(MemberAddress member) {
JSONObject resultSet = null;
String url = BASE_URL + "/api/MemberAddress/create";
log.info("request uc : url is " + url + ", memberId is " + JSONObject.toJSONString(member));
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, member, String.class);
HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("content", content);
restTemplate.postForEntity(url, objectObjectHashMap, String.class);
/*ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, subscribeBean, String.class);
String entityBody = "";
if (responseEntity.getStatusCode().is2xxSuccessful()) {
entityBody = responseEntity.getBody();
}
log.info("uc response: " + entityBody);
return entityBody;
}
public void updateMemberAddress(MemberAddress member) {
String url = BASE_URL + "/api/MemberAddress/update";
log.info("request uc : url is " + url + ", memberId is " + JSONObject.toJSONString(member));
restTemplate.put(url, member);
log.info("uc response: " + entityBody);*/
return null;
}
public void deleteMemberAddress(Long id) {
String url = BASE_URL + "/api/MemberAddress/delete/" + id;
log.info("request uc : url is " + url + ", memberId is " + id);
restTemplate.delete(url);
}
public String subscribe(SubscribeBean subscribeBean) {
String url = BASE_URL + "/ucEngine/api/userOperation/subscribe";
String content = JSON.toJSONString(subscribeBean);
public JSONObject getMemberProfile(Long memberId) {
JSONObject resultSet = null;
String url = BASE_URL + "/api/MemberRelatedInfo/getMemberRelatedInfos";
log.info("request uc : url is " + url + ", memberId is " + memberId);
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("content", content);
restTemplate.postForEntity(url, objectObjectHashMap, String.class);
/*ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, subscribeBean, String.class);
String entityBody = "";
if (responseEntity.getStatusCode().is2xxSuccessful()) {
String entityBody = responseEntity.getBody();
JSONObject jsonObject = JSONObject.parseObject(entityBody);
if (jsonObject.getInteger("businessCode").equals(200)) {
resultSet = jsonObject.getJSONArray("resultSet").getJSONObject(0);
}
entityBody = responseEntity.getBody();
}
log.info("uc response: " + resultSet.toJSONString());
return resultSet;
log.info("uc response: " + entityBody);*/
return null;
}
public String getMemberAddress(Map<String, Object> param) {
public String sendQrCodeMessage(String content) {
String url = BASE_URL + "/ucEngine/api/userOperation/sendQrCodeMessage";
restTemplate.postForEntity(url, content, String.class);
/* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class);
String entityBody = "";
String url = BASE_URL + "/api/MemberAddress/pageMemberAddress?page=" + param.get("page") + "&size=" + param.get("size") + "&memberId=" + param.get("memberId");
log.info("request uc : url is " + url + ", param is " + param);
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
if (responseEntity.getStatusCode().is2xxSuccessful()) {
entityBody = responseEntity.getBody();
}
log.info("uc response: " + entityBody);
return entityBody;
log.info("uc response: " + entityBody);*/
return null;
}
public String getMemberRelatedInfo(Map<String, Object> param) {
public String addCollection(String content) {
String url = BASE_URL + "/ucEngine/api/userOperation/addCollection";
restTemplate.postForEntity(url, content, String.class);
/* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class);
String entityBody = "";
String url = BASE_URL + "/api/MemberRelatedInfo/pageMemberRelatedInfos?page=" + param.get("page") + "&size=" + param.get("size") + "&memberId=" + param.get("memberId");
log.info("request uc : url is " + url + ", memberId is " + param);
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
if (responseEntity.getStatusCode().is2xxSuccessful()) {
entityBody = responseEntity.getBody();
}
log.info("uc response: " + entityBody);
return entityBody;
}
public void deleteMemberRelatedInfo(Long memberRelatedId) {
String url = BASE_URL + "/api/MemberRelatedInfo/delete/" + memberRelatedId;
log.info("request uc : url is " + url + ", memberId is " + memberRelatedId);
restTemplate.delete(url, String.class);
log.info("uc response: " + entityBody);*/
return null;
}
public String addMemberRelatedInfo(MemberRelatedInfo resources) {
String entityBody = null;
String url = BASE_URL + "/api/MemberRelatedInfo/create";
log.info("request uc : url is " + url + ", memberRelatedId is " + JSONObject.toJSONString(resources));
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, resources, String.class);
public String deleteCollection(String content) {
String url = BASE_URL + "/ucEngine/api/userOperation/deleteCollection";
restTemplate.postForEntity(url, content, String.class);
/* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class);
String entityBody = "";
if (responseEntity.getStatusCode().is2xxSuccessful()) {
entityBody = responseEntity.getBody();
// JSONObject jsonObject = JSONObject.parseObject(entityBody);
// if (jsonObject.getInteger("businessCode").equals(200)) {
// resultSet = jsonObject.getJSONArray("resultSet").getJSONObject(0);
// }
}
log.info("uc response: " + entityBody);
return entityBody;
log.info("uc response: " + entityBody);*/
return null;
}
public String updateMemberRelatedInfo(MemberRelatedInfo resources) {
String resultSet = "";
String url = BASE_URL + "/api/MemberRelatedInfo/update";
log.info("request uc : url is " + url + ", memberRelatedId is " + JSONObject.toJSONString(resources));
restTemplate.put(url, resources);
return resultSet;
public String deleteAllCollection(String content) {
String url = BASE_URL + "/ucEngine/api/userOperation/deleteAllCollection";
restTemplate.postForEntity(url, content, String.class);
/*ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, content, String.class);
String entityBody = "";
if (responseEntity.getStatusCode().is2xxSuccessful()) {
entityBody = responseEntity.getBody();
}
log.info("uc response: " + entityBody);*/
return null;
}
}
......
#配置数据源
spring:
# 数据源
datasource:
# 测试/演示库
url: jdbc:log4jdbc:mysql://139.196.37.202:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
# 数据源地址
url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
# 用户名
username: root
password: Topdraw1qaz
# url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
# username: root
# password: root
# 密码
password: root
# 驱动程序
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
#Druid
# Druid
type: com.alibaba.druid.pool.DruidDataSource
druid:
# 初始化配置
......@@ -27,57 +27,149 @@ spring:
test-while-idle: true
test-on-borrow: false
test-on-return: false
validation-query: select 1
# 配置监控统计拦截的filters
filters: stat
stat-view-servlet:
url-pattern: /druid/*
reset-enable: false
# 过滤器
web-stat-filter:
url-pattern: /*
exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
# freemarker
freemarker:
check-template-location: false
jackson:
time-zone: GMT+8
data:
redis:
repositories:
enabled: false
rabbitmq:
user-center:
host: 47.100.212.170 # rabbitmq的连接地址
#host: 139.196.192.242 # rabbitmq的连接地址
port: 5672 # rabbitmq的连接端口号
virtual-host: / # rabbitmq的虚拟host
username: test # rabbitmq的用户名
password: test # rabbitmq的密码
publisher-confirms: true #如果对异步消息需要回调必须设置为true
member-service:
host: 139.196.145.150 # rabbitmq的连接地址
port: 5672 # rabbitmq的连接端口号
virtual-host: member_center # rabbitmq的虚拟host
username: admin # rabbitmq的用户名
password: Topdraw1qaz # rabbitmq的密码
publisher-confirms: true #如果对异步消息需要回调必须设置为true
#配置 Jpa
# jpa
jpa:
properties:
hibernate:
# 数据库类型
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
hibernate:
# 生产环境设置成 none,避免程序运行时自动更新数据库结构
ddl-auto: none
open-in-view: true
# 文件上传
servlet:
multipart:
file-size-threshold: 2KB
max-file-size: 100MB
max-request-size: 200MB
# redis
redis:
#数据库索引
database: 6
# 数据库索引
database: 0
# ip
host: 122.112.214.149
# 密码是
password: redis123
# 端口
port: 6379
#连接超时时间
# 连接超时时间
timeout: 5000
# rabbitmq
# rabbitmq:
# # ip
# host: 139.196.145.150
# # 端口号
# port: 5672
# # 用户名
# username: admin # rabbitmq的用户名
# # 密码
# password: Topdraw1qaz
# # 虚拟空间
# virtual-host: member_center
# # 如果对异步消息需要回调必须设置为true
# publisher-confirms: true
#是否允许生成代码,生产环境设置为false
generator:
enabled: false
#是否开启 swagger-ui
swagger:
enabled: true
###########################################自定义属性#################################################################
# 多mq配置
mutil-mq:
# 服务侧
service:
# ip
host: 139.196.192.242
# 端口
port: 5672
# 用户名
username: member_center
# 密码
password: Tjlh@2021
# 虚拟空间
virtual-host: /member_center
# 管理侧
management:
# ip
# host: 139.196.145.150
# # 端口
# port: 5672
# # 用户名
# username: admin
# # 密码
# password: Topdraw1qaz
# # 虚拟空间
# virtual-host: member_center
# ip
host: 139.196.145.150
# 端口
port: 5672
# 用户名
username: admin
# 密码
password: Topdraw1qaz
# 虚拟空间
virtual-host: /member_center
#登录图形验证码有效时间/分钟
loginCode:
expiration: 2
#jwt。依赖的common中有需要jwt的部分属性。
# 服务属性
service:
# 服务域 mobile:小屏侧 vis:大屏侧
area: vis
#平台类型 service: 服务侧 management: 管理侧
platform: service
# uc-engine服务地址
api:
baseUrl: http://127.0.0.1:8447
# 线程池设置
task:
pool:
# 核心线程池大小
core-pool-size: 10
# 最大线程数
max-pool-size: 30
# 活跃时间
keep-alive-seconds: 60
# 队列容量
queue-capacity: 50
#权限 jwt。依赖的common中有需要jwt的部分属性。
jwt:
header: Authorization
secret: mySecret
......@@ -90,32 +182,4 @@ jwt:
# token 续期检查时间范围(60分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
detect: 3600000
# 续期时间,2小时,单位毫秒
renew: 7200000
#是否允许生成代码,生产环境设置为false
generator:
enabled: true
#是否开启 swagger-ui
swagger:
enabled: true
# 文件存储路径(相对路径)
file:
path: system/file
avatar: system/avatar
upload: upload
# 文件大小 /M
maxSize: 100
avatarMaxSize: 5
uc:
service:
# uc两侧部署,需配置位于哪一侧 mobile小屏侧 vis大屏侧
type: vis
api:
# baseUrl: http://139.196.4.234:8447
baseUrl: http://localhost:8447
renew: 7200000
\ No newline at end of file
......
#配置数据源
spring:
datasource:
url: jdbc:log4jdbc:mysql://172.0.31.91:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
username: root
password: Tjlh@2021
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
#Druid
type: com.alibaba.druid.pool.DruidDataSource
druid:
# 初始化配置
initial-size: 3
# 最小连接数
min-idle: 3
# 最大连接数
max-active: 15
# 获取连接超时时间
max-wait: 5000
# 连接有效性检测时间
time-between-eviction-runs-millis: 90000
# 最大空闲时间
min-evictable-idle-time-millis: 1800000
test-while-idle: true
test-on-borrow: false
test-on-return: false
validation-query: select 1
# 配置监控统计拦截的filters
filters: stat
stat-view-servlet:
url-pattern: /druid/*
reset-enable: false
web-stat-filter:
url-pattern: /*
exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
#配置 Jpa
jpa:
hibernate:
# 生产环境设置成 none,避免程序运行时自动更新数据库结构
ddl-auto: none
servlet:
multipart:
file-size-threshold: 2KB
max-file-size: 100MB
max-request-size: 200MB
redis:
#数据库索引
database: 0
host: 127.0.0.1
port: 6379
password:
#连接超时时间
timeout: 5000
rabbitmq:
host: 172.0.31.96 # rabbitmq的连接地址
port: 5672 # rabbitmq的连接端口号
virtual-host: member_center # rabbitmq的虚拟host
username: admin # rabbitmq的用户名
password: Tjlh@2021 # rabbitmq的密码
publisher-confirms: true #如果对异步消息需要回调必须设置为true
listener:
direct:
auto-startup: false
simple:
auto-startup: false
#jwt。依赖的common中有需要jwt的部分属性。
jwt:
header: Authorization
secret: mySecret
# token 过期时间/毫秒,6小时 1小时 = 3600000 毫秒
expiration: 7200000
# 在线用户key
online: online-token
# 验证码
codeKey: code-key
# token 续期检查时间范围(60分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
detect: 3600000
# 续期时间,2小时,单位毫秒
renew: 7200000
#是否允许生成代码,生产环境设置为false
generator:
enabled: true
#是否开启 swagger-ui
swagger:
enabled: true
# 文件存储路径(相对路径)
file:
path: system/file
avatar: system/avatar
upload: upload
# 文件大小 /M
maxSize: 100
avatarMaxSize: 5
uc:
service:
# uc两侧部署,需配置位于哪一侧 mobile小屏侧 vis大屏侧
type: vis
api:
# baseUrl: http://139.196.4.234:8447
baseUrl: http://172.0.31.94:8447
#配置数据源
spring:
datasource:
# 测试/演示库
#url: jdbc:log4jdbc:mysql://139.196.37.202:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
#username: root
#password: Topdraw1qaz
url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
username: root
password: root
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# driverClassName: com.mysql.jdbc.Driver
#Druid
type: com.alibaba.druid.pool.DruidDataSource
druid:
# 初始化配置
initial-size: 3
# 最小连接数
min-idle: 3
# 最大连接数
max-active: 15
# 获取连接超时时间
max-wait: 5000
# 连接有效性检测时间
time-between-eviction-runs-millis: 90000
# 最大空闲时间
min-evictable-idle-time-millis: 1800000
test-while-idle: true
test-on-borrow: false
test-on-return: false
validation-query: select 1
# 配置监控统计拦截的filters
filters: stat
stat-view-servlet:
url-pattern: /druid/*
reset-enable: false
web-stat-filter:
url-pattern: /*
exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
#配置 Jpa
jpa:
hibernate:
# 生产环境设置成 none,避免程序运行时自动更新数据库结构
ddl-auto: none
servlet:
multipart:
file-size-threshold: 2KB
max-file-size: 100MB
max-request-size: 200MB
redis:
#数据库索引
database: 6
host: 127.0.0.1
port: 6379
password:
#连接超时时间
timeout: 5000
rabbitmq:
host: 122.112.214.149 # rabbitmq的连接地址
#host: 139.196.192.242 # rabbitmq的连接地址
port: 5672 # rabbitmq的连接端口号
#virtual-host: /member_center # rabbitmq的虚拟host
#username: member_center # rabbitmq的用户名
#password: Tjlh@2021 # rabbitmq的密码
virtual-host: / # rabbitmq的虚拟host
username: guest # rabbitmq的用户名
password: guest # rabbitmq的密码
publisher-confirms: true #如果对异步消息需要回调必须设置为true
#jwt。依赖的common中有需要jwt的部分属性。
jwt:
header: Authorization
secret: mySecret
# token 过期时间/毫秒,6小时 1小时 = 3600000 毫秒
expiration: 7200000
# 在线用户key
online: online-token
# 验证码
codeKey: code-key
# token 续期检查时间范围(60分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
detect: 3600000
# 续期时间,2小时,单位毫秒
renew: 7200000
#是否允许生成代码,生产环境设置为false
generator:
enabled: true
#是否开启 swagger-ui
swagger:
enabled: true
# 文件存储路径(相对路径)
file:
path: system/file
avatar: system/avatar
upload: upload
# 文件大小 /M
maxSize: 100
avatarMaxSize: 5
uc:
service:
# uc两侧部署,需配置位于哪一侧 mobile小屏侧 vis大屏侧
type: mobile
api:
# baseUrl: http://139.196.4.234:8447
baseUrl: http://localhost:8447
# 服务器
server:
# 服务端口号
port: 8448
spring:
# 服务
application:
name: member-engine
freemarker:
check-template-location: false
# 服务名
name: uc-consumer
# 配置文件
profiles:
# 启动具体的配置文件
active: dev
jackson:
time-zone: GMT+8
data:
redis:
repositories:
enabled: false
#配置 Jpa
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
open-in-view: true
task:
pool:
# 核心线程池大小
core-pool-size: 10
# 最大线程数
max-pool-size: 30
# 活跃时间
keep-alive-seconds: 60
# 队列容量
queue-capacity: 50
#登录图形验证码有效时间/分钟
loginCode:
expiration: 2
#默认上传图片类型
default-image-type: -1
......