|  |  |  | 
|---|
|  |  |  | package com.doumee.core.wx.wxPlat; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.emay.sdk.util.json.gson.JsonObject; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.DateUtil; | 
|---|
|  |  |  | import com.doumee.core.utils.Http; | 
|---|
|  |  |  | import com.doumee.core.utils.HttpsUtil; | 
|---|
|  |  |  | import com.doumee.dao.business.MemberMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.VisitsMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.WxNoticeConfigMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import me.chanjar.weixin.common.error.WxErrorException; | 
|---|
|  |  |  | import me.chanjar.weixin.mp.api.WxMpService; | 
|---|
|  |  |  | import me.chanjar.weixin.mp.bean.template.WxMpTemplateData; | 
|---|
|  |  |  | import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.apache.commons.lang3.time.DateFormatUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | 
|---|
|  |  |  | List<String> openIds){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | WxNoticeConfig wxNoticeConfig =  wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.visit) | 
|---|
|  |  |  | WxNoticeConfig wxNoticeConfig =  wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.platformJob) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getObjCode,objCode) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getStatus, Constants.ZERO) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | 
|---|
|  |  |  | paramMap.put("touser", openId); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息内容:{}", JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息内容:{}", JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | if(StringUtils.isBlank(response)){ | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", "失败"); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息:{}·--++==·", "失败"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void  sendMeetTemplateNotice(SystemDictDataBiz systemDictDataBiz,SmsEmail smsEmail,String token){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(), | 
|---|
|  |  |  | Constants.WxUrlParams.MEETING,smsEmail.getObjId().toString()); | 
|---|
|  |  |  | String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token; | 
|---|
|  |  |  | JSONObject jsonObject = JSONObject.parseObject(smsEmail.getContent()); | 
|---|
|  |  |  | jsonObject.put("url",jumpUrl); | 
|---|
|  |  |  | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(jsonObject)); | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息内容:{}", JSONObject.toJSONString(jsonObject)); | 
|---|
|  |  |  | if(StringUtils.isBlank(response)){ | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", "失败"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|