|
@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.exterior.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.cgi.ReplyStrategyServiceEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.response.CommonResponse;
|
|
|
+import com.tzld.longarticle.recommend.server.common.response.ExceptionCodeEnum;
|
|
|
import com.tzld.longarticle.recommend.server.model.bo.MiniData;
|
|
|
import com.tzld.longarticle.recommend.server.model.cgi.BucketDataParam;
|
|
|
import com.tzld.longarticle.recommend.server.model.cgi.GroupData;
|
|
@@ -15,6 +16,7 @@ import com.tzld.longarticle.recommend.server.model.vo.WeComPushMessageVo;
|
|
|
import com.tzld.longarticle.recommend.server.service.exterior.WeComService;
|
|
|
import com.tzld.longarticle.recommend.server.service.strategy.reply.ReplyStrategyService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
@@ -31,6 +33,8 @@ import java.util.Map;
|
|
|
@Service
|
|
|
public class WeComServiceImpl implements WeComService {
|
|
|
|
|
|
+ private static final String CORP_ID = "wwa4015dc7d652a21f";
|
|
|
+
|
|
|
@Autowired
|
|
|
private ApplicationContext applicationContext;
|
|
|
|
|
@@ -43,12 +47,15 @@ public class WeComServiceImpl implements WeComService {
|
|
|
|
|
|
@Override
|
|
|
public CommonResponse<List<WeComPushMessageVo>> getPushMessage(WeComPushMessageParam param) {
|
|
|
+ if (param == null || StringUtils.isEmpty(param.getCorpId()) || !CORP_ID.equals(param.getCorpId())) {
|
|
|
+ return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "参数错误");
|
|
|
+ }
|
|
|
List<WeComPushMessageVo> res = new ArrayList<>();
|
|
|
ReplyBucketData replyBucketData = getPushMessageData(param);
|
|
|
List<GroupData> groupList = replyBucketData.getGroupList();
|
|
|
- log.info("groupList={}",groupList);
|
|
|
- if(CollectionUtils.isEmpty(groupList)){
|
|
|
- return CommonResponse.create(500,"数据异常");
|
|
|
+ log.info("groupList={}", groupList);
|
|
|
+ if (CollectionUtils.isEmpty(groupList)) {
|
|
|
+ return CommonResponse.create(500, "数据异常");
|
|
|
}
|
|
|
for (GroupData groupData : groupList) {
|
|
|
if (CollectionUtils.isEmpty(groupData.getMsgDataList())) {
|
|
@@ -64,7 +71,7 @@ public class WeComServiceImpl implements WeComService {
|
|
|
weComPushMessageVo.setMsgDataList(msgDataList);
|
|
|
res.add(weComPushMessageVo);
|
|
|
}
|
|
|
- log.info("res={}",res);
|
|
|
+ log.info("res={}", res);
|
|
|
return CommonResponse.success(res);
|
|
|
}
|
|
|
|