|  |  |  | 
|---|
|  |  |  | package com.doumee.core.wx.wxPlat; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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.HttpsUtil; | 
|---|
|  |  |  | import com.doumee.dao.business.WxNoticeConfigMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Visits; | 
|---|
|  |  |  | import com.doumee.dao.business.model.WxNoticeConfig; | 
|---|
|  |  |  | 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.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 微信公众号通知 | 
|---|
|  |  |  | 
|---|
|  |  |  | @Component | 
|---|
|  |  |  | public class WxPlatNotice { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 微信公众号API的Service | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | /*  private final WxMpService wxMpService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public WxPlatNotice(WxMpService wxMpService) { | 
|---|
|  |  |  | this.wxMpService = wxMpService; | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 访客业务通知接口 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Boolean  sendVisitAuditTemplateNotice(Visits visits,String prefix,String tempId){ | 
|---|
|  |  |  | if(StringUtils.isBlank(visits.getOpenid())){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | WxMpTemplateMessage templateMessage =  WxMpTemplateMessage.builder() | 
|---|
|  |  |  | .toUser(visits.getOpenid()) | 
|---|
|  |  |  | .templateId(tempId) | 
|---|
|  |  |  | .url(prefix + visits.getId()) | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String thing1 = "待审批"; | 
|---|
|  |  |  | if(visits.getStatus()==2){ | 
|---|
|  |  |  | thing1 = "审核通过"; | 
|---|
|  |  |  | }else if(visits.getStatus()==3){ | 
|---|
|  |  |  | thing1 = "审核不通过"; | 
|---|
|  |  |  | }else if(visits.getStatus()==5){ | 
|---|
|  |  |  | thing1 = "设备授权成功"; | 
|---|
|  |  |  | }else if(visits.getStatus()==6){ | 
|---|
|  |  |  | thing1 = "设备授权未成功"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 添加模板数据 | 
|---|
|  |  |  | templateMessage.addData(new WxMpTemplateData("thing1", thing1)) | 
|---|
|  |  |  | .addData(new WxMpTemplateData("thing2", visits.getName())) | 
|---|
|  |  |  | .addData(new WxMpTemplateData("phone_number6", visits.getPhone())); | 
|---|
|  |  |  | String msgId = null; | 
|---|
|  |  |  | /*        try { | 
|---|
|  |  |  | // 发送模板消息 | 
|---|
|  |  |  | msgId = wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage); | 
|---|
|  |  |  | } catch (WxErrorException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", msgId != null ? "成功" : "失败"); | 
|---|
|  |  |  | return msgId != null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 访客业务通知 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void  sendVisitTemplateNotice(WxNoticeConfigMapper wxNoticeConfigMapper,Visits visits,String objCode, String prefix, String tempId, List<String> openIds){ | 
|---|
|  |  |  | public void  testSendNotice(List<String> openIds,String token){ | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | WxNoticeConfig wxNoticeConfig =  wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.visit) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getObjCode,objCode) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getStatus, Constants.ZERO) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | WxMpTemplateMessage templateMessage =  WxMpTemplateMessage.builder() | 
|---|
|  |  |  | .toUser(visits.getOpenid()) | 
|---|
|  |  |  | .templateId(tempId) | 
|---|
|  |  |  | .url(prefix + visits.getId()) | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | templateMessage.addData(new WxMpTemplateData("thing1", visits.getName())) | 
|---|
|  |  |  | .addData(new WxMpTemplateData("car_number7", StringUtils.isBlank(visits.getCarNos())?visits.getCarNos():"-")) | 
|---|
|  |  |  | .addData(new WxMpTemplateData("character_string6", Constants.equalsInteger(visits.getMemberNum(),Constants.ZERO)?Constants.ONE+"":visits.getMemberNum().toString())) | 
|---|
|  |  |  | .addData(new WxMpTemplateData("const9", wxNoticeConfig.getTitile())) | 
|---|
|  |  |  | .addData(new WxMpTemplateData("thing4", visits.getReason())) | 
|---|
|  |  |  | ; | 
|---|
|  |  |  | String msgId = null; | 
|---|
|  |  |  | /* try { | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | templateMessage.setToUser(openId); | 
|---|
|  |  |  | String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token; | 
|---|
|  |  |  | //整体参数map | 
|---|
|  |  |  | Map<String, Object> paramMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | Map<String, Object> const9 = new HashMap<String,Object>(); | 
|---|
|  |  |  | const9.put("value","申请待您审批"); | 
|---|
|  |  |  | Map<String, Object> thing1 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing1.put("value", "测试名称"); | 
|---|
|  |  |  | Map<String, Object> car_number7 = new HashMap<String,Object>(); | 
|---|
|  |  |  | car_number7.put("value","皖AP12345"); | 
|---|
|  |  |  | Map<String, Object> character_string6 = new HashMap<String,Object>(); | 
|---|
|  |  |  | character_string6.put("value","1"); | 
|---|
|  |  |  | Map<String, Object> thing4 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing4.put("value","理由"); | 
|---|
|  |  |  | dataMap.put("const9",const9); | 
|---|
|  |  |  | dataMap.put("thing1",thing1); | 
|---|
|  |  |  | dataMap.put("car_number7",car_number7); | 
|---|
|  |  |  | dataMap.put("character_string6",character_string6); | 
|---|
|  |  |  | dataMap.put("thing4",thing4); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("template_id", "SPwvgtASkm1aMDBsYhX2wHKdL2JBEGPknDkgniSza2Y"); | 
|---|
|  |  |  | paramMap.put("touser", openId); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | if(StringUtils.isBlank(response)){ | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", "失败"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 发送模板消息 | 
|---|
|  |  |  | msgId = wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage); | 
|---|
|  |  |  | } catch (WxErrorException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", msgId != null ? "成功" : "失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //            log.warn("·==++--·推送微信模板信息:{}·--++==·", msgId != null ? "成功" : "失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 访客申请/报备业务通知 | 
|---|
|  |  |  | * @param wxNoticeConfigMapper | 
|---|
|  |  |  | * @param visits | 
|---|
|  |  |  | * @param objCode  visitUpload,visitAuditSuccess,visitWaitAudit,visitWaitAudit,visitReportUpload,visitReportAuditSuccess,visitReportAuditFail, visitReportAuditSuccess | 
|---|
|  |  |  | * @param openIds | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void  sendVisitTemplateNotice(SystemDictDataBiz systemDictDataBiz,WxNoticeConfigMapper wxNoticeConfigMapper, Visits visits, String objCode, String token, List<String> openIds){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | WxNoticeConfig wxNoticeConfig =  wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda() | 
|---|
|  |  |  | .in(WxNoticeConfig::getObjType,WxPlatConstants.visit,WxPlatConstants.visitReport) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getObjCode,objCode) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getStatus, Constants.ZERO) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Constants.WxUrlParams wxUrlParams =  Constants.WxUrlParams.VISIT_REPORT_RECORD_USER; | 
|---|
|  |  |  | if(!Constants.equalsInteger(visits.getType(),Constants.TWO)){ | 
|---|
|  |  |  | if(!objCode.equals(WxPlatConstants.visitContent.visitWaitAudit)){ | 
|---|
|  |  |  | wxUrlParams = Constants.WxUrlParams.VISIT_RECORD_VISIT; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | wxUrlParams = Constants.WxUrlParams.VISIT_RECORD_USER; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(), | 
|---|
|  |  |  | wxUrlParams | 
|---|
|  |  |  | ,visits.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>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | Map<String, Object> const9 = new HashMap<String,Object>(); | 
|---|
|  |  |  | const9.put("value",wxNoticeConfig.getTitile()); | 
|---|
|  |  |  | Map<String, Object> thing1 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing1.put("value", visits.getName()); | 
|---|
|  |  |  | Map<String, Object> car_number7 = new HashMap<String,Object>(); | 
|---|
|  |  |  | car_number7.put("value",StringUtils.isNotBlank(visits.getCarNos())?visits.getCarNos():"无"); | 
|---|
|  |  |  | dataMap.put("car_number7",car_number7); | 
|---|
|  |  |  | Map<String, Object> character_string6 = new HashMap<String,Object>(); | 
|---|
|  |  |  | character_string6.put("value","1"); | 
|---|
|  |  |  | Map<String, Object> thing4 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing4.put("value",visits.getReason()); | 
|---|
|  |  |  | dataMap.put("const9",const9); | 
|---|
|  |  |  | dataMap.put("thing1",thing1); | 
|---|
|  |  |  | dataMap.put("character_string6",character_string6); | 
|---|
|  |  |  | dataMap.put("thing4",thing4); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("url", jumpUrl); | 
|---|
|  |  |  | paramMap.put("template_id", wxNoticeConfig.getTempId()); | 
|---|
|  |  |  | 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{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //            log.warn("·==++--·推送微信模板信息:{}·--++==·", msgId != null ? "成功" : "失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 隐患上报 | 
|---|
|  |  |  | * @param wxNoticeConfigMapper | 
|---|
|  |  |  | * @param hiddenDanger | 
|---|
|  |  |  | * @param objCode hiddenDangerUpload | 
|---|
|  |  |  | * @param openIds | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void  sendHiddenDangerUploadTemplateNotice(SystemDictDataBiz systemDictDataBiz,WxNoticeConfigMapper wxNoticeConfigMapper, HiddenDanger hiddenDanger, String objCode,String token, List<String> openIds){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | WxNoticeConfig wxNoticeConfig =  wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.hiddenDanger) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getObjCode,objCode) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getStatus, Constants.ZERO) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(), | 
|---|
|  |  |  | Constants.WxUrlParams.HIDDEN_DANGER,hiddenDanger.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>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //隐患区域 | 
|---|
|  |  |  | Map<String, Object> thing9 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing9.put("value",hiddenDanger.getAreaName()); | 
|---|
|  |  |  | //隐患名称 | 
|---|
|  |  |  | Map<String, Object> thing1 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing1.put("value", hiddenDanger.getCategoryName()); | 
|---|
|  |  |  | //提报人 | 
|---|
|  |  |  | Map<String, Object> thing12 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing12.put("value",hiddenDanger.getMemberName()); | 
|---|
|  |  |  | //提报时间 | 
|---|
|  |  |  | Map<String, Object> time11 = new HashMap<String,Object>(); | 
|---|
|  |  |  | time11.put("value", DateUtil.getFomartDate(hiddenDanger.getCreateDate(),"yyyy年MM月dd日 HH:mm:ss") ); | 
|---|
|  |  |  | dataMap.put("thing9",thing9); | 
|---|
|  |  |  | dataMap.put("thing1",thing1); | 
|---|
|  |  |  | dataMap.put("thing12",thing12); | 
|---|
|  |  |  | dataMap.put("time11",time11); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("template_id", wxNoticeConfig.getTempId()); | 
|---|
|  |  |  | paramMap.put("url", jumpUrl); | 
|---|
|  |  |  | 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{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 隐患整改 | 
|---|
|  |  |  | * @param wxNoticeConfigMapper | 
|---|
|  |  |  | * @param hiddenDanger | 
|---|
|  |  |  | * @param objCode hiddenDangerDeal | 
|---|
|  |  |  | * @param openIds | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void  sendHiddenDangerDealTemplateNotice(SystemDictDataBiz systemDictDataBiz,WxNoticeConfigMapper wxNoticeConfigMapper, HiddenDanger hiddenDanger, String objCode,String token, List<String> openIds){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | WxNoticeConfig wxNoticeConfig =  wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.hiddenDanger) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getObjCode,objCode) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getStatus, Constants.ZERO) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(), | 
|---|
|  |  |  | Constants.WxUrlParams.HIDDEN_DANGER,hiddenDanger.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>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //隐患区域 | 
|---|
|  |  |  | Map<String, Object> thing17 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing17.put("value",hiddenDanger.getAreaName()); | 
|---|
|  |  |  | //隐患名称 | 
|---|
|  |  |  | Map<String, Object> thing3 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing3.put("value", hiddenDanger.getCategoryName()); | 
|---|
|  |  |  | //整改方式 | 
|---|
|  |  |  | Map<String, Object> thing13 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing13.put("value",Constants.equalsInteger(hiddenDanger.getStatus(),Constants.ONE)?"隐患已整改":"隐患已退回"); | 
|---|
|  |  |  | //提交人 | 
|---|
|  |  |  | Map<String, Object> thing10 = new HashMap<String,Object>(); | 
|---|
|  |  |  | 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") ); | 
|---|
|  |  |  | dataMap.put("thing17",thing17); | 
|---|
|  |  |  | dataMap.put("thing3",thing3); | 
|---|
|  |  |  | dataMap.put("thing13",thing13); | 
|---|
|  |  |  | dataMap.put("thing10",thing10); | 
|---|
|  |  |  | dataMap.put("time16",time16); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("url", jumpUrl); | 
|---|
|  |  |  | paramMap.put("template_id", wxNoticeConfig.getTempId()); | 
|---|
|  |  |  | 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{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 用车申请 审批情况 | 
|---|
|  |  |  | * @param wxNoticeConfigMapper | 
|---|
|  |  |  | * @param carUseBook | 
|---|
|  |  |  | * @param objCode  reservationSuccess,meetingCancel,meetingBeginA,meetingEndA | 
|---|
|  |  |  | * @param openIds | 
|---|
|  |  |  | * @param sendType 0=申请人;1=审批人 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void  sendCarUseBookTemplateNotice(SystemDictDataBiz systemDictDataBiz,WxNoticeConfigMapper wxNoticeConfigMapper, CarUseBook carUseBook, 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.carUse) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getObjCode,objCode) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getStatus, Constants.ZERO) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(), | 
|---|
|  |  |  | Constants.WxUrlParams.CAR_USE,carUseBook.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>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //审批进度 | 
|---|
|  |  |  | Map<String, Object> thing3 = new HashMap<String,Object>(); | 
|---|
|  |  |  | if(Constants.equalsInteger(sendType,Constants.ONE)){ | 
|---|
|  |  |  | thing3.put("value","申请待您审批"); | 
|---|
|  |  |  | }else if(Constants.equalsInteger(sendType,Constants.ZERO)){ | 
|---|
|  |  |  | if(Constants.equalsInteger(carUseBook.getStatus(),Constants.ZERO)){ | 
|---|
|  |  |  | thing3.put("value","申请提交成功待审核"); | 
|---|
|  |  |  | }else if(Constants.equalsInteger(carUseBook.getStatus(),Constants.TWO)){ | 
|---|
|  |  |  | thing3.put("value","申请已审核通过"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | thing3.put("value","申请已被驳回"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | thing3.put("value","申请已被取消"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //申请人 | 
|---|
|  |  |  | Map<String, Object> thing1 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing1.put("value", carUseBook.getMemberName()); | 
|---|
|  |  |  | //车牌号 | 
|---|
|  |  |  | Map<String, Object> car_number2 = new HashMap<String,Object>(); | 
|---|
|  |  |  | car_number2.put("value",carUseBook.getCarCode()); | 
|---|
|  |  |  | //目的地 | 
|---|
|  |  |  | Map<String, Object> thing11 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing11.put("value",carUseBook.getAddr()); | 
|---|
|  |  |  | //用车时间 | 
|---|
|  |  |  | Map<String, Object> time14 = new HashMap<String,Object>(); | 
|---|
|  |  |  | time14.put("value", carUseBook.getPlanUseDate()); | 
|---|
|  |  |  | dataMap.put("thing3",thing3); | 
|---|
|  |  |  | dataMap.put("car_number2",car_number2); | 
|---|
|  |  |  | dataMap.put("thing1",thing1); | 
|---|
|  |  |  | dataMap.put("thing11",thing11); | 
|---|
|  |  |  | dataMap.put("time14",time14); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("url", jumpUrl); | 
|---|
|  |  |  | paramMap.put("template_id", wxNoticeConfig.getTempId()); | 
|---|
|  |  |  | 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{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 车辆入园申请  物流车 | 
|---|
|  |  |  | * @param wxNoticeConfigMapper | 
|---|
|  |  |  | * @param platformBooks | 
|---|
|  |  |  | * @param objCode platformBookUpload,platformBookAuditSuccess,platformBookAuditFail,platformBookWaitAudit | 
|---|
|  |  |  | * @param token | 
|---|
|  |  |  | * @param openIds | 
|---|
|  |  |  | * @param sendType 0=申请人;1=审批人 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getObjCode,objCode) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getStatus, Constants.ZERO) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Constants.WxUrlParams  wxUrlParams = Constants.WxUrlParams.PLATFORM_BOOK_DRIVER; | 
|---|
|  |  |  | if(!objCode.equals(WxPlatConstants.platformBookContent.platformBookUpload)){ | 
|---|
|  |  |  | wxUrlParams = Constants.WxUrlParams.PLATFORM_BOOK; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //审核状态 | 
|---|
|  |  |  | Map<String, Object> const9 = new HashMap<String,Object>(); | 
|---|
|  |  |  | if(Constants.equalsInteger(sendType,Constants.ONE)){ | 
|---|
|  |  |  | const9.put("value","申请待您审批"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | if(Constants.equalsInteger(platformBooks.getStatus(),Constants.ZERO)){ | 
|---|
|  |  |  | const9.put("value","申请提交成功待审核"); | 
|---|
|  |  |  | }else if(Constants.equalsInteger(platformBooks.getStatus(),Constants.TWO)){ | 
|---|
|  |  |  | const9.put("value","申请已审核通过"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | const9.put("value","申请已审核驳回"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //车牌号 | 
|---|
|  |  |  | Map<String, Object> car_number3 = new HashMap<String,Object>(); | 
|---|
|  |  |  | car_number3.put("value", platformBooks.getCarCodeFront()); | 
|---|
|  |  |  | //业务类型 | 
|---|
|  |  |  | Map<String, Object> phrase4 = new HashMap<String,Object>(); | 
|---|
|  |  |  | phrase4.put("value", platformBooks.getInReason()); | 
|---|
|  |  |  | //申请人 | 
|---|
|  |  |  | Map<String, Object> thing8 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing8.put("value", platformBooks.getDriverName()); | 
|---|
|  |  |  | //时间 | 
|---|
|  |  |  | Map<String, Object> time4 = new HashMap<String,Object>(); | 
|---|
|  |  |  | time4.put("value", DateUtil.getFomartDate(platformBooks.getArriveDate(),"yyyy年MM月dd日 HH:mm:ss") ); | 
|---|
|  |  |  | dataMap.put("const9",const9); | 
|---|
|  |  |  | dataMap.put("car_number3",car_number3); | 
|---|
|  |  |  | dataMap.put("phrase4",phrase4); | 
|---|
|  |  |  | dataMap.put("thing8",thing8); | 
|---|
|  |  |  | dataMap.put("time2",time4); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("url", jumpUrl); | 
|---|
|  |  |  | paramMap.put("template_id", wxNoticeConfig.getTempId()); | 
|---|
|  |  |  | 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{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.warn("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * Wms 任务下达通知 | 
|---|
|  |  |  | * @param wxNoticeConfigMapper | 
|---|
|  |  |  | * @param platformJob | 
|---|
|  |  |  | * @param objCode   platformJobNewJob | 
|---|
|  |  |  | * @param openIds | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void  sendWmsTemplateNotice(SystemDictDataBiz systemDictDataBiz, WxNoticeConfigMapper wxNoticeConfigMapper, PlatformJob platformJob, String objCode,String token, | 
|---|
|  |  |  | List<String> openIds){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | WxNoticeConfig wxNoticeConfig =  wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.visit) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getObjCode,objCode) | 
|---|
|  |  |  | .eq(WxNoticeConfig::getStatus, Constants.ZERO) | 
|---|
|  |  |  | .last(" limit 1") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(), | 
|---|
|  |  |  | Constants.WxUrlParams.PLATFORM_JOB_DRIVER,platformJob.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>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //运单编号 | 
|---|
|  |  |  | Map<String, Object> character_string1 = new HashMap<String,Object>(); | 
|---|
|  |  |  | character_string1.put("value",platformJob.getBillCode()); | 
|---|
|  |  |  | //司机 | 
|---|
|  |  |  | Map<String, Object> thing3 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing3.put("value", platformJob.getDriverName()); | 
|---|
|  |  |  | //下达时间 | 
|---|
|  |  |  | Map<String, Object> time4 = new HashMap<String,Object>(); | 
|---|
|  |  |  | time4.put("value", DateUtil.getFomartDate(platformJob.getCreateDate(),"yyyy年MM月dd日 HH:mm:ss") ); | 
|---|
|  |  |  | dataMap.put("character_string1",character_string1); | 
|---|
|  |  |  | dataMap.put("thing3",thing3); | 
|---|
|  |  |  | dataMap.put("time4",time4); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("url",jumpUrl); | 
|---|
|  |  |  | paramMap.put("template_id", wxNoticeConfig.getTempId()); | 
|---|
|  |  |  | paramMap.put("touser", openId); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | 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){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * Wms 任务取消通知 | 
|---|
|  |  |  | * @param wxNoticeConfigMapper | 
|---|
|  |  |  | * @param platformJob | 
|---|
|  |  |  | * @param objCode   platformJobNewJob | 
|---|
|  |  |  | * @param openIds | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void  sendWmsCancelTemplateNotice(SystemDictDataBiz systemDictDataBiz,WxNoticeConfigMapper wxNoticeConfigMapper, PlatformJob platformJob, String objCode,String token, | 
|---|
|  |  |  | List<String> openIds){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | 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") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(), | 
|---|
|  |  |  | Constants.WxUrlParams.PLATFORM_JOB_DRIVER,platformJob.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>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //任务单号 | 
|---|
|  |  |  | Map<String, Object> character_string1 = new HashMap<String,Object>(); | 
|---|
|  |  |  | character_string1.put("value",platformJob.getBillCode()); | 
|---|
|  |  |  | //取消时间 | 
|---|
|  |  |  | Map<String, Object> time6 = new HashMap<String,Object>(); | 
|---|
|  |  |  | time6.put("value", DateUtil.getFomartDate(new Date(),"yyyy年MM月dd日 HH:mm:ss") ); | 
|---|
|  |  |  | dataMap.put("character_string1",character_string1); | 
|---|
|  |  |  | dataMap.put("time6",time6); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("url",jumpUrl); | 
|---|
|  |  |  | paramMap.put("template_id", wxNoticeConfig.getTempId()); | 
|---|
|  |  |  | paramMap.put("touser", openId); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | 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){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 月台作业 | 
|---|
|  |  |  | * @param wxNoticeConfigMapper | 
|---|
|  |  |  | * @param platformJob | 
|---|
|  |  |  | * @param objCode platformJobCallIn,platformJobSingIn,platformJobOverNum,platformJobWorking,platformJobFinish,platformJobLevelPower,platformJobMove,platformJobError,platformJobTimeOut,platformJobStopErr | 
|---|
|  |  |  | * @param token | 
|---|
|  |  |  | * @param openIds | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void  sendPlatformJobTemplateNotice(SystemDictDataBiz systemDictDataBiz,WxNoticeConfigMapper wxNoticeConfigMapper, PlatformJob platformJob, String objCode,String token, | 
|---|
|  |  |  | List<String> openIds){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | 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") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(), | 
|---|
|  |  |  | Constants.WxUrlParams.PLATFORM_JOB_DRIVER,platformJob.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>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //月台通知 | 
|---|
|  |  |  | Map<String, Object> const6 = new HashMap<String,Object>(); | 
|---|
|  |  |  | const6.put("value",wxNoticeConfig.getTitile()); | 
|---|
|  |  |  | //车牌号 | 
|---|
|  |  |  | Map<String, Object> car_number3 = new HashMap<String,Object>(); | 
|---|
|  |  |  | car_number3.put("value",platformJob.getCarCodeFront()); | 
|---|
|  |  |  | //月台号 | 
|---|
|  |  |  | Map<String, Object> thing9 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing9.put("value", platformJob.getPlatformName()); | 
|---|
|  |  |  | //时间 | 
|---|
|  |  |  | Map<String, Object> time4 = new HashMap<String,Object>(); | 
|---|
|  |  |  | time4.put("value", DateUtil.getFomartDate(new Date(),"yyyy年MM月dd日 HH:mm:ss") ); | 
|---|
|  |  |  | dataMap.put("const6",const6); | 
|---|
|  |  |  | dataMap.put("car_number3",car_number3); | 
|---|
|  |  |  | dataMap.put("thing9",thing9); | 
|---|
|  |  |  | dataMap.put("time4",time4); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("url",jumpUrl); | 
|---|
|  |  |  | paramMap.put("template_id", wxNoticeConfig.getTempId()); | 
|---|
|  |  |  | paramMap.put("touser", openId); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息内容:{}", JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | if(StringUtils.isBlank(response)){ | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息:{}·--++==·", "失败"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 月台签到通知 | 
|---|
|  |  |  | * @param wxNoticeConfigMapper | 
|---|
|  |  |  | * @param platformJob | 
|---|
|  |  |  | * @param objCode | 
|---|
|  |  |  | * @param token | 
|---|
|  |  |  | * @param openIds | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void  sendPlatformJobSignNotice(WxNoticeConfigMapper wxNoticeConfigMapper, PlatformJob platformJob, String objCode,String token, | 
|---|
|  |  |  | List<String> openIds){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | 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") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token; | 
|---|
|  |  |  | //整体参数map | 
|---|
|  |  |  | Map<String, Object> paramMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //车牌号 | 
|---|
|  |  |  | Map<String, Object> car_number1 = new HashMap<String,Object>(); | 
|---|
|  |  |  | car_number1.put("value",platformJob.getCarCodeFront()); | 
|---|
|  |  |  | //司机姓名 | 
|---|
|  |  |  | Map<String, Object> thing2 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing2.put("value",platformJob.getDriverName()); | 
|---|
|  |  |  | //签到时间 | 
|---|
|  |  |  | Map<String, Object> time5 = new HashMap<String,Object>(); | 
|---|
|  |  |  | time5.put("value", DateUtil.getFomartDate(new Date(),"yyyy年MM月dd日 HH:mm:ss")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dataMap.put("car_number1",car_number1); | 
|---|
|  |  |  | dataMap.put("thing2",thing2); | 
|---|
|  |  |  | dataMap.put("time5",time5); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("template_id", wxNoticeConfig.getTempId()); | 
|---|
|  |  |  | paramMap.put("touser", openId); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息内容:{}", JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | if(StringUtils.isBlank(response)){ | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息:{}·--++==·", "失败"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static void main(String[] args) { | 
|---|
|  |  |  | String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=90_8_a3QDclSc8HTcbgXhSVnijiQdRf4dG5wme29riDIyt3UIi7FpZ_HJyqyEIY-_e2A29jH2fLBKgtuBKtq-cy7DteFg5l9EawoxAwiRis8BMnEl-u01ITtCUVU90XCIjADASXD"; | 
|---|
|  |  |  | //整体参数map | 
|---|
|  |  |  | Map<String, Object> paramMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //车牌号 | 
|---|
|  |  |  | Map<String, Object> car_number1 = new HashMap<String,Object>(); | 
|---|
|  |  |  | car_number1.put("value","皖A12345"); | 
|---|
|  |  |  | //司机姓名 | 
|---|
|  |  |  | Map<String, Object> thing2 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing2.put("value","小阿武"); | 
|---|
|  |  |  | //签到时间 | 
|---|
|  |  |  | Map<String, Object> time5 = new HashMap<String,Object>(); | 
|---|
|  |  |  | time5.put("value", DateUtil.getFomartDate(new Date(),"yyyy年MM月dd日 HH:mm:ss")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dataMap.put("car_number1",car_number1); | 
|---|
|  |  |  | dataMap.put("thing2",thing2); | 
|---|
|  |  |  | dataMap.put("time5",time5); | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("template_id", "ZYhHg5eJJim0LR3FLVaqKcVqW3p8GQk8qrTO40ffHXI"); | 
|---|
|  |  |  | paramMap.put("touser", "ovmre6RUJJZCDtCyLxWYKSMgt7u8"); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息内容:{}", JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | if(StringUtils.isBlank(response)){ | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息:{}·--++==·", "失败"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void  sendUnFinishNotice(WxNoticeConfigMapper wxNoticeConfigMapper,Integer unFinishNum,String objCode,String token, | 
|---|
|  |  |  | List<String> openIds){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(openIds)){ | 
|---|
|  |  |  | 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") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wxNoticeConfig)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token; | 
|---|
|  |  |  | //整体参数map | 
|---|
|  |  |  | Map<String, Object> paramMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //消息主题显示相关map | 
|---|
|  |  |  | Map<String, Object> dataMap = new HashMap<String, Object>(); | 
|---|
|  |  |  | //车牌号 | 
|---|
|  |  |  | Map<String, Object> const1 = new HashMap<String,Object>(); | 
|---|
|  |  |  | const1.put("value","作业任务未完成"); | 
|---|
|  |  |  | //司机姓名 | 
|---|
|  |  |  | Map<String, Object> thing2 = new HashMap<String,Object>(); | 
|---|
|  |  |  | thing2.put("value",unFinishNum+"个"); | 
|---|
|  |  |  | //签到时间 | 
|---|
|  |  |  | Map<String, Object> time3 = new HashMap<String,Object>(); | 
|---|
|  |  |  | time3.put("value", DateUtil.getFomartDate(new Date(),"yyyy年MM月dd日 HH:mm:ss")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dataMap.put("const1",const1); | 
|---|
|  |  |  | dataMap.put("thing2",thing2); | 
|---|
|  |  |  | dataMap.put("time3",time3); | 
|---|
|  |  |  | for (String openId:openIds) { | 
|---|
|  |  |  | paramMap.clear(); | 
|---|
|  |  |  | paramMap.put("template_id", wxNoticeConfig.getTempId()); | 
|---|
|  |  |  | paramMap.put("touser", openId); | 
|---|
|  |  |  | paramMap.put("data", dataMap); | 
|---|
|  |  |  | String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息内容:{}", JSONObject.toJSONString(paramMap)); | 
|---|
|  |  |  | if(StringUtils.isBlank(response)){ | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息:{}·--++==·", "失败"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | JSONObject json = JSONObject.parseObject(response); | 
|---|
|  |  |  | log.error("·==++--·推送微信模板信息:{}·--++==·", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"成功":"失败"+json.getString("errmsg")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|