Commit 8b099e01 by 徐高华

离职继承欢迎语

parent 3d83a746
package com.gic.haoban.manage.service.pojo;
import java.io.Serializable;
public class WelcomeUserInfoBO implements Serializable {
private String name ;
private int addWay ;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAddWay() {
return addWay;
}
public void setAddWay(int addWay) {
this.addWay = addWay;
}
public WelcomeUserInfoBO(String name, int addWay) {
this.name = name;
this.addWay = addWay;
}
}
......@@ -5,8 +5,10 @@ import java.util.Date;
import java.util.List;
import java.util.Objects;
import com.alibaba.fastjson.JSONArray;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMediaMapper;
import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.pojo.WelcomeUserInfoBO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
......@@ -112,10 +114,6 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
/**
* 发送欢迎语
*
* @param dto
* @param wxEnterpriseDTO
* @param enterpriseId
* @param staffId
* {"data":{"welcomeCode":"J0GjdrsF-nZNac3Xc6V2K2p8OokQZcY4g0jxljdHc7A","wxUserId":"016903","suiteid":"selfSuiteId","corpid":"wxbde984c3488b837e","externalUserid":"wmSe9FEAAAy39F1NI6Z-THUUd9mkqOIw","changeType":"add_external_contact"},"type":1,"mqTraceId":"278473818-1-1679557069.126"}
*/
@Override
......@@ -144,6 +142,7 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
log.info("发送欢迎语,state={}", state);
String relationKey = SecureUtil.md5(staffId + externalUserId);
WelcomeDetailBO welcomeBO = null;
WelcomeUserInfoBO userBO = this.getExternalUserName(qwDTO, externalUserId , wxUserId);
if (StringUtils.isNotBlank(state)
&& (state.startsWith(Manage3Constants.HM) || state.startsWith(Manage3Constants.DT))) {
WelcomeReferBO welcomeReferBo = getWelcomeReferBo(state);
......@@ -163,7 +162,7 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
log.info("欢迎语发送{}={}", welcomeBO.getWelcomeId(), JSON.toJSONString(welcomeBO));
String content = welcomeBO.getWelcomeContent();
if (content.contains("<微信昵称>")) {
String nickName = this.getExternalUserName(qwDTO, externalUserId);
String nickName = userBO.getName() ;
//这里对“$”符号和”\\“符号进行转义处理
nickName = java.util.regex.Matcher.quoteReplacement(nickName);
content = content.replaceAll("<微信昵称>", nickName);
......@@ -403,7 +402,7 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
}
}
private String getExternalUserName(WxEnterpriseQwDTO qwDTO, String externalUserId) {
private WelcomeUserInfoBO getExternalUserName(WxEnterpriseQwDTO qwDTO, String externalUserId , String addUserId) {
log.info("查询好友详情,externalUserId={},{}", externalUserId,qwDTO.getWxSecurityType());
String userInfo = null ;
if(qwDTO.isSelf()) {
......@@ -412,13 +411,14 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
userInfo =qywxUserApiService.getExternalUseridInfo(qwDTO.getThirdCorpid(), config.getWxSuiteid(), externalUserId);
}
String name = "";
Integer addWay = 0 ;
if (StringUtils.isBlank(userInfo)) {
log.info("好友不存在");
return name;
return new WelcomeUserInfoBO(name,0);
}
if ("1".equals(userInfo)) {
log.info("限制次数");
return name;
return new WelcomeUserInfoBO(name,0);
}
if (StringUtils.isNotBlank(userInfo)) {
JSONObject userJson = JSON.parseObject(userInfo);
......@@ -428,8 +428,22 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
jt = JSON.parseObject(external_contact);
name = EmojiFilterUtil.filterEmojiLast(jt.getString("name"), true);
}
String follow_user = "";
follow_user = userJson.getString("follow_user");
if (StringUtils.isNotBlank(follow_user)) {
JSONArray j = JSON.parseArray(follow_user);
for (Object object : j) {
String followJson = JSON.toJSONString(object);
JSONObject follow = JSON.parseObject(followJson);
String userId = follow.getString("userid");
if (userId.equals(addUserId)) {
addWay = follow.getIntValue("add_way") ;
}
}
}
}
return name;
log.info("addWay={}",addWay);
return new WelcomeUserInfoBO(name,addWay);
}
private String getClerkId(String wxEnterpriseId, String staffId, String state) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment