no message
This commit is contained in:
parent
99be99391f
commit
5a4945955d
|
|
@ -0,0 +1,74 @@
|
|||
package com.ghy.common.enums;
|
||||
|
||||
/**
|
||||
* 微信消息通知枚举
|
||||
* @author clunt
|
||||
*/
|
||||
|
||||
public enum WxStatusEnum {
|
||||
|
||||
/** 任务大厅订单通知 */
|
||||
ORDER_PLAN("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
|
||||
/** 新订单通知 */
|
||||
NEW_ORDER("","/pages/order-manage/order-manage?stateCur=6"),
|
||||
/** 商城端消息通知 */
|
||||
CUSTOMER_ORDER("", "JtsGFPDjYhL2GbHfKxvTJaR_lLp8xLyw8VeR01Y0JHM"),
|
||||
/** 测试 **/
|
||||
TEXT("", "dnjTqmqr7OsnOXJR_SikVNNQOPSZLJ6pcDoysOksjNQ"),
|
||||
|
||||
NORMAL_ORDER("", "/pages/order-manage/order-manage"),
|
||||
/** 拒单 **/
|
||||
REJECT_ORDER("", "lJUpyU7h6ipzjgBCdLW0vShjaG3uPxPZ4tQNwfv_XPM"),
|
||||
/** 新工单 默认 **/
|
||||
DEFAULT_ORDER("", "/pages/order-manage/order-manage?stateCur=6"),
|
||||
/**售后工单待处理提醒**/
|
||||
AFTER_SALES_ORDER("", "/pages/order-manage/order-manage?tabCur=4"),
|
||||
/**售后工单待处理提醒**/
|
||||
AFTER_SALES_TIMEOUT_ORDER("", "/pages/order-manage/order-manage?stateCur=2"),
|
||||
/**服务工单超时通知**/
|
||||
TIMEOUT_ORDER("", "/pages/order-manage/order-manage?stateCur=2"),
|
||||
/** 一小时订单 工单处理提醒*/
|
||||
ONEHOUR_ORDER("", "/pages/order-manage/order-manage"),
|
||||
/** 急报 **/
|
||||
WARN_ORDER("", "0RSuVHHP_okErJ1acQmIirBU7TrQYR0xPBgBHyt_azA"),
|
||||
|
||||
/** 默认工单处理提醒 **/
|
||||
DEFAULT_HANDLE_ORDER("", "/pages/order-manage/order-manage"),
|
||||
/** 超时消息通知 */
|
||||
// OVER_TIME("","8I5BnJMfwj-Z7udhNm9Z-kdjdg4__MV5ug1x8KKsbc0"),
|
||||
/** 今日单消息通知 */
|
||||
// TODAY_ORDER("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
|
||||
/** 明日单通知 工单处理提醒*/
|
||||
TOMORROW_ORDER("", " /pages/order-manage/order-manage?stateCur=4");
|
||||
/** 不同意排单通知 */
|
||||
// NOT_AGREE_PLAIN("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
|
||||
/** 不同意完单通知 */
|
||||
// NOT_AGREE_FINISH("","Yd2PJIdgBhEadi3EkAGyS4DiFp1Rd5ErsEs_jEt-HX4"),
|
||||
/** 子师傅拒绝接单/退单通知 */
|
||||
// DETAIL_REJECT("", "Yd2PJIdgBhEadi3EkAGyS4DiFp1Rd5ErsEs_jEt-HX4")
|
||||
|
||||
|
||||
private String type;
|
||||
private String tempCode;
|
||||
|
||||
WxStatusEnum(String type, String tempCode) {
|
||||
this.type = type;
|
||||
this.tempCode = tempCode;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTempCode() {
|
||||
return tempCode;
|
||||
}
|
||||
|
||||
public void setTempCode(String tempCode) {
|
||||
this.tempCode = tempCode;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ghy.common.config.WxConfig;
|
||||
import com.ghy.common.enums.WxMsgEnum;
|
||||
import com.ghy.common.enums.WxStatusEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -13,7 +14,9 @@ import java.io.InputStream;
|
|||
import java.io.OutputStreamWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -61,6 +64,12 @@ public class WechatMsgUtils {
|
|||
* @param token 鉴权token信息
|
||||
*/
|
||||
public static void sendWeChatMsg(String token, String userOpenId, WxMsgEnum mesType, Map<String, Object> dataMap) {
|
||||
String type=mesType+"";
|
||||
String wxStatusByWxMsgUrl=getWxStatusByWxMsg(WxStatusEnum.valueOf(type));
|
||||
if (StringUtils.isEmpty(wxStatusByWxMsgUrl)){
|
||||
wxStatusByWxMsgUrl="/pages/order-manage/order-manage";
|
||||
}
|
||||
log.info("传入的参数值{},获取到的url{}",type,wxStatusByWxMsgUrl);
|
||||
// 接口地址
|
||||
String sendMsgApi = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token;
|
||||
//整体参数map
|
||||
|
|
@ -70,8 +79,8 @@ public class WechatMsgUtils {
|
|||
paramMap.put("template_id", mesType.getTempCode());
|
||||
paramMap.put("url","");
|
||||
Map<String, Object> miniprogram=new HashMap<>();
|
||||
miniprogram.put("appid","gh_ebf4032d4403");
|
||||
miniprogram.put("pagepath","/pages/order-manage/order-manage");
|
||||
miniprogram.put("appid","wx105ce607b514ff2a");
|
||||
miniprogram.put("pagepath",wxStatusByWxMsgUrl);
|
||||
paramMap.put("miniprogram",miniprogram);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
for (Map.Entry<String, Object> objectEntry : dataMap.entrySet()) {
|
||||
|
|
@ -143,4 +152,7 @@ public class WechatMsgUtils {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
public static String getWxStatusByWxMsg(WxStatusEnum type){
|
||||
return type.getTempCode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue