Commit 73ce6248 by fudahua

feat:消息

parent 8e053b65
...@@ -27,6 +27,7 @@ import com.gic.wechat.api.dto.qywx.ItemDTO; ...@@ -27,6 +27,7 @@ import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO; import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService; import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -180,10 +181,17 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService { ...@@ -180,10 +181,17 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
logger.info("不存在模板"); logger.info("不存在模板");
return null; return null;
} }
//需要替换的数据 //需要替换的数据
Map<String, String> contentMap = messageQDTO.getContentMap(); Map<String, String> contentMap = messageQDTO.getContentMap();
if (MapUtils.isEmpty(contentMap)) {
return templateMessage;
}
//替换的内容 //替换的内容
for (TemplateContentBO templateContentBO : templateMessage) { for (TemplateContentBO templateContentBO : templateMessage) {
contentMap.forEach((k, v) -> { contentMap.forEach((k, v) -> {
templateContentBO.setVal(templateContentBO.getVal().replaceAll("\\#\\{" + k + "\\}", v)); templateContentBO.setVal(templateContentBO.getVal().replaceAll("\\#\\{" + k + "\\}", v));
}); });
......
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