|
|
@ -20,6 +20,7 @@ package com.epmet.service.impl; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.enums.EnvEnum; |
|
|
|
import com.epmet.commons.tools.exception.ValidateException; |
|
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
@ -182,16 +183,22 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
data.put(WxmpMessageConstant.MESSAGE_CONTENT, new JSONObject().put("value", msg.getMessageContent())); |
|
|
|
data.put(WxmpMessageConstant.MESSAGE_TIME, new JSONObject().put("value", msg.getMessageTime())); |
|
|
|
jsonObject.put(WxmpMessageConstant.DATA, data); |
|
|
|
EnvEnum envEnum = EnvEnum.getCurrentEnv(); |
|
|
|
//选填项
|
|
|
|
if (StringUtils.isNotBlank(msg.getPage())) { |
|
|
|
jsonObject.put(WxmpMessageConstant.PAGE, msg.getPage()); |
|
|
|
if (WxmpMessageConstant.RESI.equals(clientType)) { |
|
|
|
jsonObject.put(WxmpMessageConstant.PAGE, WxmpMessageConstant.PAGE_RESI); |
|
|
|
} else if (WxmpMessageConstant.WORK.equals(clientType)) { |
|
|
|
jsonObject.put(WxmpMessageConstant.PAGE, WxmpMessageConstant.PAGE_WORK); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(msg.getMiniprogramState())) { |
|
|
|
jsonObject.put(WxmpMessageConstant.MINIPROGRAM_STATE, msg.getMiniprogramState()); |
|
|
|
//开发环境
|
|
|
|
if ("dev".equals(envEnum.getCode())){ |
|
|
|
jsonObject.put(WxmpMessageConstant.MINIPROGRAM_STATE, WxmpMessageConstant.STATE_DEV); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(msg.getLang())) { |
|
|
|
jsonObject.put(WxmpMessageConstant.LANG, msg.getLang()); |
|
|
|
//测试环境
|
|
|
|
if ("test".equals(envEnum.getCode())){ |
|
|
|
jsonObject.put(WxmpMessageConstant.MINIPROGRAM_STATE, WxmpMessageConstant.STATE_TEST); |
|
|
|
} |
|
|
|
|
|
|
|
String resultStr = HttpClientManager.getInstance().sendPostByJSON(WxmpMessageConstant.SEND_MESSAGE + accessToken, JSON.toJSONString(jsonObject)).getData(); |
|
|
|
Map<String, Object> resultMap = JSON.parseObject(resultStr, Map.class); |
|
|
|
Object errcode = resultMap.get(WxmpMessageConstant.ERR_CODE); |
|
|
|