| | |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 月台签到通知 |
| | | * @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(platformJob.getSignDate(),"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 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){ |
| | | |
| | | } |
| | | } |
| | | |
| | | |