All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.chanjar.weixin.cp.api.impl.WxCpTaskCardServiceImpl Maven / Gradle / Ivy

There is a newer version: 4.6.7.B
Show newest version
package me.chanjar.weixin.cp.api.impl;

import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.api.WxCpTaskCardService;
import me.chanjar.weixin.cp.bean.message.TemplateCardMessage;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.TaskCard.UPDATE_TASK_CARD;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.TaskCard.UPDATE_TEMPLATE_CARD;

/**
 * 
 *  任务卡片管理接口.
 *  Created by Jeff on 2019-05-16.
 * 
* * @author Jeff created on 2019-05-16 */ @RequiredArgsConstructor public class WxCpTaskCardServiceImpl implements WxCpTaskCardService { private final WxCpService mainService; @Override public void update(List userIds, String taskId, String replaceName) throws WxErrorException { Integer agentId = this.mainService.getWxCpConfigStorage().getAgentId(); Map data = new HashMap<>(4); data.put("userids", userIds); data.put("agentid", agentId); data.put("task_id", taskId); // 文档地址:https://open.work.weixin.qq.com/wwopen/devtool/interface?doc_id=16386 data.put("clicked_key", replaceName); String url = this.mainService.getWxCpConfigStorage().getApiUrl(UPDATE_TASK_CARD); this.mainService.post(url, WxGsonBuilder.create().toJson(data)); } @Override public void updateTemplateCardButton(List userIds, List partyIds, List tagIds, Integer atAll, String responseCode, String replaceName) throws WxErrorException { Integer agentId = this.mainService.getWxCpConfigStorage().getAgentId(); Map data = new HashMap<>(7); data.put("userids", userIds); data.put("partyids", partyIds); data.put("tagids", tagIds); data.put("atall", atAll); data.put("agentid", agentId); data.put("response_code", responseCode); Map btnMap = new HashMap<>(); btnMap.put("replace_name", replaceName); data.put("button", btnMap); String url = this.mainService.getWxCpConfigStorage().getApiUrl(UPDATE_TEMPLATE_CARD); this.mainService.post(url, WxGsonBuilder.create().toJson(data)); } @Override public void updateTemplateCardButton(TemplateCardMessage templateCardMessage) throws WxErrorException { String url = this.mainService.getWxCpConfigStorage().getApiUrl(UPDATE_TEMPLATE_CARD); this.mainService.post(url, WxGsonBuilder.create().toJson(templateCardMessage)); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy