| | |
| | | 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.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.*; |
| | |
| | | thing13.put("value",Constants.equalsInteger(hiddenDanger.getStatus(),Constants.ONE)?"隐患已整改":"隐患已退回"); |
| | | //提交人 |
| | | Map<String, Object> thing10 = new HashMap<String,Object>(); |
| | | thing10.put("value",hiddenDanger.getCheckorName()); |
| | | thing10.put("value",hiddenDanger.getMemberName()); |
| | | //通知时间 |
| | | Map<String, Object> time16 = new HashMap<String,Object>(); |
| | | time16.put("value", DateUtil.getFomartDate(hiddenDanger.getDealTime(),"yyyy年MM月dd日 HH:mm:ss") ); |
| | |
| | | paramMap.put("touser", openId); |
| | | paramMap.put("data", dataMap); |
| | | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap)); |
| | | log.warn("·==++--·推送微信模板信息:{}", jumpUrl); |
| | | if(StringUtils.isBlank(response)){ |
| | | log.warn("·==++--·推送微信模板信息:{}·--++==·", "失败"); |
| | | }else{ |
| | |
| | | * @param openIds |
| | | * @param sendType 0=申请人;1=审批人 |
| | | */ |
| | | public void sendPlatformBookTemplateNotice(SystemDictDataBiz systemDictDataBiz,WxNoticeConfigMapper wxNoticeConfigMapper, PlatformBooks platformBooks, String objCode,String token, |
| | | List<String> openIds,Integer sendType){ |
| | | public void sendPlatformBookTemplateNotice(SystemDictDataBiz systemDictDataBiz, WxNoticeConfigMapper wxNoticeConfigMapper, PlatformBooks platformBooks, String objCode, String token, |
| | | List<String> openIds, Integer sendType){ |
| | | try{ |
| | | if(CollectionUtils.isNotEmpty(openIds)){ |
| | | WxNoticeConfig wxNoticeConfig = wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.platformBook) |
| | |
| | | } |
| | | String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(), |
| | | wxUrlParams,platformBooks.getId().toString()); |
| | | |
| | | String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token; |
| | | //整体参数map |
| | | Map<String, Object> paramMap = new HashMap<String, Object>(); |
| | |
| | | paramMap.put("touser", openId); |
| | | paramMap.put("data", dataMap); |
| | | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap)); |
| | | log.warn("·==++--·推送微信模板信息:{}", JSONObject.toJSONString(paramMap)); |
| | | if(StringUtils.isBlank(response)){ |
| | | log.warn("·==++--·推送微信模板信息:{}·--++==·", "失败"); |
| | | }else{ |
| | |
| | | } |
| | | |
| | | |
| | | 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){ |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |