|
|
@@ -26,6 +26,7 @@ import com.cyksj.mapper.manage.coupon.CouponMapper;
|
|
|
import com.cyksj.mapper.market.task.UserBindDetailMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.request.corp.Attachments;
|
|
|
+import com.cyksj.model.request.corp.CorpWelcomeMsg;
|
|
|
import com.cyksj.model.request.corp.CorpXmlMessage;
|
|
|
import com.cyksj.model.request.corp.CorpXmlOutMessage;
|
|
|
import com.cyksj.model.response.ExternalContact;
|
|
|
@@ -851,12 +852,12 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
try {
|
|
|
String welcomeCode = message.getWelcomeCode();
|
|
|
String followId = message.getUserId();
|
|
|
- JSONObject params = new JSONObject();
|
|
|
+ CorpWelcomeMsg corpWelcomeMsg = new CorpWelcomeMsg();
|
|
|
//新用户欢迎语
|
|
|
if (StrUtil.isNotBlank(content)) {
|
|
|
- JSONObject text = new JSONObject();
|
|
|
- text.putOpt("content", content);
|
|
|
- params.putOpt("text", text);
|
|
|
+ CorpWelcomeMsg.Text text = new CorpWelcomeMsg.Text();
|
|
|
+ text.setContent(content);
|
|
|
+ corpWelcomeMsg.setText(text);
|
|
|
}
|
|
|
//附件
|
|
|
LinkedList<Attachments> attachments;
|
|
|
@@ -866,15 +867,15 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
|
|
|
for (Attachments dbAttachment : dbAttachments) {
|
|
|
attachments.add(corpService.updateMaterial(dbAttachment, message.getToUserName(), 1));
|
|
|
}
|
|
|
- params.putOpt("attachments", attachments);
|
|
|
+ corpWelcomeMsg.setAttachments(attachments);
|
|
|
}
|
|
|
|
|
|
- params.putOpt("welcome_code", welcomeCode);
|
|
|
+ corpWelcomeMsg.setWelcomeCode(welcomeCode);
|
|
|
HttpResponse<byte[]> res = null;
|
|
|
res = J11HttpC.custom()
|
|
|
.ofPost()
|
|
|
.url(String.format("https://qyapi.weixin.qq.com/cgi-bin/externalcontact/send_welcome_msg?access_token=%s", wxCorpOps.getAccessToken(message.getToUserName())))
|
|
|
- .body(HttpRequest.BodyPublishers.ofString(params.toString(), IoKit.Charsets.UTF_8.getCharset()))
|
|
|
+ .body(HttpRequest.BodyPublishers.ofString(Jsons.toJson(corpWelcomeMsg), IoKit.Charsets.UTF_8.getCharset()))
|
|
|
.headers(J11HttpC.ReqType.raw_json)
|
|
|
.send(HttpResponse.BodyHandlers.ofByteArray());
|
|
|
JSONObject jsonObject = Jsons.parseObject(res.body(), JSONObject.class);
|