|
@@ -1,6 +1,7 @@
|
|
|
package com.tzld.longarticle.recommend.server.service.exterior.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.StaffEnum;
|
|
|
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;
|
|
@@ -51,7 +52,7 @@ 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())) {
|
|
|
+ if (param == null || StringUtils.isEmpty(param.getCorpId()) || !CORP_ID.equals(param.getCorpId()) || StringUtils.isEmpty(param.getUserId())) {
|
|
|
return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "参数错误");
|
|
|
}
|
|
|
List<WeComPushMessageVo> res = new ArrayList<>();
|
|
@@ -61,6 +62,7 @@ public class WeComServiceImpl implements WeComService {
|
|
|
if (CollectionUtils.isEmpty(groupList)) {
|
|
|
return CommonResponse.create(500, "数据异常");
|
|
|
}
|
|
|
+ String name = StaffEnum.getName(param.getUserId());
|
|
|
for (GroupData groupData : groupList) {
|
|
|
if (CollectionUtils.isEmpty(groupData.getMsgDataList())) {
|
|
|
continue;
|
|
@@ -69,14 +71,14 @@ public class WeComServiceImpl implements WeComService {
|
|
|
weComPushMessageVo.setGroupIndex(groupData.getGroupIndex());
|
|
|
List<MsgData> msgDataList = groupData.getMsgDataList();
|
|
|
for (MsgData msgData : msgDataList) {
|
|
|
- if(msgData.getTitle().getBytes(StandardCharsets.UTF_8).length > MAX_BYTES){
|
|
|
+ if (msgData.getTitle().getBytes(StandardCharsets.UTF_8).length > MAX_BYTES) {
|
|
|
String s = truncateString(msgData.getTitle(), 61) + "...";
|
|
|
-
|
|
|
+ msgData.setTitle(s);
|
|
|
}
|
|
|
}
|
|
|
MsgData msgData = new MsgData();
|
|
|
msgData.setMsgType(3);
|
|
|
- msgData.setTitle("欢迎你的到来");
|
|
|
+ msgData.setTitle(String.format("很高兴认识您!我是员工%s,每天给您推荐精彩视频~", name));
|
|
|
msgDataList.add(0, msgData);
|
|
|
weComPushMessageVo.setMsgDataList(msgDataList);
|
|
|
res.add(weComPushMessageVo);
|