fwq
2022-01-26 07bf2e3fb490c635aab3835bf9f21b23ac0286af
企业消息发送修改
1个文件已删除
5个文件已修改
152 ■■■■■ 已修改文件
phi_platform_model/src/main/java/com/hx/phip/model/SystemParameter.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/Rsa.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/controller/message/CorpMessageController.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/resources/application-heTest.properties 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/resources/application-local.properties 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/resources/application-prod.properties 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_model/src/main/java/com/hx/phip/model/SystemParameter.java
File was deleted
phi_platform_user/src/main/java/com/hx/phip/Rsa.java
@@ -7,14 +7,14 @@
public class Rsa {
    public static void main(String[] args) {
       System.out.println(AesUtil.aesEncryp("ev8i6tfy9Gg0eyaF6SDyvNHcsNGNeff8enwT_eLKf_0"));
       //System.out.println(AesUtil.aesEncryp("ev8i6tfy9Gg0eyaF6SDyvNHcsNGNeff8enwT_eLKf_0"));
        //配置文件数据加密
        /*BasicTextEncryptor encryptor = new BasicTextEncryptor();
        BasicTextEncryptor encryptor = new BasicTextEncryptor();
        encryptor.setPassword(AesUtil.SECRET);
        String encrypted = encryptor.encrypt("pis_rw:UYWoCz#4^@w5Soj*");
        System.out.println(encrypted);*/
        String encrypted = encryptor.encrypt("wx7335025935d006fc");
        System.out.println(encrypted);
        //解密
        //String decrypt = encryptor.decrypt("uFESkQwpAXSxg0SUR6BOlTujZqFC3pfIi3eTfuP0Lmrd0fqxG5XC4X0ho0Sp2FEV");
        //System.out.println("decrypt:"+decrypt);
phi_platform_user/src/main/java/com/hx/phip/controller/message/CorpMessageController.java
@@ -4,6 +4,7 @@
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hx.common.BaseController;
import com.hx.exception.TipsException;
import com.hx.mp.util.CorpMpUtil;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.model.BaseEntity;
@@ -25,6 +26,7 @@
import com.platform.resultTool.PlatformCode;
import com.platform.resultTool.PlatformResult;
import com.platform.resultTool.SystemCode;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -47,15 +49,6 @@
@RequestMapping("/corp/message")
public class CorpMessageController extends BaseController {
    private static Logger logger = LoggerFactory.getLogger(CorpMessageController.class.getName());
    /**营销助手企业应用密钥*/
    @Value("${marketing.assistant}")
    private String marketingAssistant;
    /**营销助手 appid*/
    @Value("${mar.appId}")
    private String marAppid;
    /**CRM appid*/
    @Value("${crm.appId}")
    private String crmAppid;
    /**企业消息发送,返回消息key*/
    private static final String RETURN_KEY = "errcode";
    /**企业消息发送,返回消息value*/
@@ -100,20 +93,9 @@
        if (applyParameter == null) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "corpId or mpId is error");
        }
        //获取企业微信应用access_token
        SysParameter sysParameter = null;
        //CRM企业应用消息默认使用营销助手的应用信息
        if (crmAppid.equals(parameter.getMpId())) {
            sysParameter = WeiXinCorpMpUtil.getApplicationAccessToken(commonService, applyParameter.getCorpId(), marketingAssistant);
            //小程序appid改为营销助手的
            JSONObject jsonData = JSONObject.parseObject(parameter.getSendData());
            if (jsonData.getString("appid").equals(crmAppid)) {
                jsonData.put("appid", marAppid);
            }
        } else {
            //正常获取对应的应用信息
            sysParameter = WeiXinCorpMpUtil.getApplicationAccessToken(commonService, applyParameter.getCorpId(), AesUtil.aesDecryp(applyParameter.getApplySecretKey()));
        }
        //通过应用数据获取企业微信应用access_token
        SysParameter sysParameter = WeiXinCorpMpUtil.getApplicationAccessToken(commonService, applyParameter.getCorpId(), AesUtil.aesDecryp(applyParameter.getApplySecretKey()));
        if (sysParameter == null) {
            throw new PlatTipsException(PlatformCode.ERROR_SYSTEM, "服务错误" + SystemCode.ERROR_GET_CORP_TOKEN);
        }
@@ -121,11 +103,10 @@
        if (StringUtils.isEmpty(sysParameter.getParamValue())) {
            throw new PlatTipsException(PlatformCode.ERROR_SYSTEM, "服务错误" + SystemCode.ERROR_GET_CORP_TOKEN);
        }
        //发送数据
        logger.info("企业消息发送小程序appid为:" + parameter.getMpId() + "发送数据" + parameter.getSendData());
        net.sf.json.JSONObject returnData = CorpMpUtil.messageSend(sysParameter.getParamValue(), parameter.getSendData());
        logger.info("企业消息发送小程序appid为:" + parameter.getMpId() + "返回数据" + returnData);
        logger.info("企业消息发送小程序appid为:" + parameter.getMpId() + "发送数据:" + parameter.getSendData());
        net.sf.json.JSONObject returnData = CorpMpUtil.messageSend(sysParameter.getParamValue(),parameter.getSendData());
        logger.info("企业消息发送小程序appid为:" + parameter.getMpId() + "返回数据:" + returnData);
        //key不为0的时候发送不成功
        if (returnData.optInt(RETURN_KEY, DEFAULT_VALUE) != 0) {
            logger.error("appId:" + parameter.getMpId() + "企业消息发送失败:" + returnData);
phi_platform_user/src/main/resources/application-heTest.properties
@@ -124,7 +124,3 @@
ZyDJAoGBAJJuG2gOJKOanKnRU190RzMxzunYbgVJN/sUofvGMfyJGg3kYT9X+xm7It4GGGOV6bYU\
9n3HwKT5RmkboaoMQesefCQ/qz+wgbfoivudzzV3o41HgH3yD5V98g45SmxCgxndxswjR0Yiia5q\
0dEpK65zWEXTvLLpeyhiXZmtiVCA
marketing.assistant = ENC(f8isLyiD5gDuUXuCamRNAE+RAqsVXQWivpZ/DpEiMgj6bGrA3F6tdjymxyaO/Cqe2iczgiqTV/w=)
mar.appId = ENC(G/AV5rx7y0O7dQc/fE5nNOjkI0cOzNm16PD1LYXMxKM=)
crm.appId = ENC(lZfVVL5+C+1Qu5jZk6Bj73MBsXKieJfcRBKxP0aK1Dc=)
phi_platform_user/src/main/resources/application-local.properties
@@ -130,6 +130,3 @@
9n3HwKT5RmkboaoMQesefCQ/qz+wgbfoivudzzV3o41HgH3yD5V98g45SmxCgxndxswjR0Yiia5q\
0dEpK65zWEXTvLLpeyhiXZmtiVCA
marketing.assistant = ENC(wwa1fLFlhz/eWIGnABjKN6XXmfw8cJa9BwPSaYtNz/VHkeLYyTs9aV9zfHLAJFYUwAWs4eztmQo=)
mar.appId = ENC(EsqtPXd4IcnmiQ74UrYhEUo15MtcWcTeL3D+a+rZ6lM=)
crm.appId = ENC(KsziUSlFXFmcKlX+z/a2G6iw2v/xC0GMrqD/xVdXXws=)
phi_platform_user/src/main/resources/application-prod.properties
@@ -126,8 +126,3 @@
ZyDJAoGBAJJuG2gOJKOanKnRU190RzMxzunYbgVJN/sUofvGMfyJGg3kYT9X+xm7It4GGGOV6bYU\
9n3HwKT5RmkboaoMQesefCQ/qz+wgbfoivudzzV3o41HgH3yD5V98g45SmxCgxndxswjR0Yiia5q\
0dEpK65zWEXTvLLpeyhiXZmtiVCA
marketing.assistant = ENC(RJJ5z8IcCwu1IKhIfptdGRp8jWo97pA0BUZ1RlQUrMp5g2/g1gyTei3b1AjEsWeLfHTweLv1FLw=)
mar.appId = ENC(vny6XjaBcYCRo0XmIhyDBnrSouy8YcDf40SJh1G5R/o=)
crm.appId = ENC(l58aEl5OMYnGDgbQNRX5I0scUjNBMeVArwoKuN3t3Jw=)