| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | import com.panzhihua.common.model.dtos.wx.TemplateParam; |
| | | import com.panzhihua.common.model.dtos.wx.WxSubscribeDTO; |
| | | |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidDangerMemberVO; |
| | | import com.panzhihua.common.model.vos.community.reserve.FiveCount; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | @Slf4j |
| | |
| | | subscribeDTO.setTemplate_id(templateId); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("time2",DateUtils.getCurrentDateStr())); |
| | | paras.add(new TemplateParam("thing3","请尽快完善返攀报备信息,填报当前在攀居住地。")); |
| | | paras.add(new TemplateParam("thing3","请尽快完善返攀报备,填报当前居住地。")); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 推送危险人员订阅消息通知 |
| | | * @param openId 用户openid |
| | | * @param accessToken token会话标识 |
| | | * @param dangerMember 风险人员 |
| | | */ |
| | | public static void sendSubscribeDanger(String openId, String accessToken, ComActAcidDangerMemberVO dangerMember, String templateId){ |
| | | WxSubscribeDTO subscribeDTO = new WxSubscribeDTO(); |
| | | subscribeDTO.setTouser(openId); |
| | | subscribeDTO.setTemplate_id(templateId); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | Integer type = dangerMember.getType(); |
| | | paras.add(new TemplateParam("thing2", (type == 1 ? "当前风险人员 " : "当前未填住址人员 ") + dangerMember.getName())); |
| | | paras.add(new TemplateParam("time3", DateUtils.getCurrentDateStr())); |
| | | paras.add(new TemplateParam("thing1","新冠疫情")); |
| | | paras.add(new TemplateParam("thing4", type == 1 ? "新增风险人员" : "新增未填住址人员")); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | | }catch (Exception e){ |
| | | log.error("危险人员订阅消息推送失败,失败原因:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送危险人员订阅消息通知 |
| | | * @param openId 用户openid |
| | | * @param accessToken token会话标识 |
| | | * @param fiveCount 统计数据 |
| | | */ |
| | | public static void sendSubscribeStatics(String openId, String accessToken, FiveCount fiveCount, String templateId){ |
| | | WxSubscribeDTO subscribeDTO = new WxSubscribeDTO(); |
| | | subscribeDTO.setTouser(openId); |
| | | subscribeDTO.setTemplate_id(templateId); |
| | | subscribeDTO.setPage("/packageB/pages/register/reportingStatistics/reportingStatistics"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("thing2", "报备总数"+fiveCount.getAllCount()+";"+"风险人员"+fiveCount.getDangerCount())); |
| | | paras.add(new TemplateParam("time3", DateUtils.getDateFormatString(DateUtils.addDay(new Date(),-1),"yyyy-MM-dd")+"0点到24点")); |
| | | paras.add(new TemplateParam("thing1","新冠疫情")); |
| | | paras.add(new TemplateParam("thing4", "社区报备数据统计")); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | | }catch (Exception e){ |
| | | log.error("危险人员订阅消息推送失败,失败原因:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * uu洗车订单状态更改 |
| | | * @param openId |
| | | * @param accessToken |
| | | * @param status |
| | | * @param washerName |
| | | * @param washerMobile |
| | | * @param phone |
| | | * @param templateId |
| | | */ |
| | | public static void sendUuWash(String openId, String accessToken, String status,String washerName,String washerMobile,String phone,String templateId){ |
| | | WxSubscribeDTO subscribeDTO = new WxSubscribeDTO(); |
| | | subscribeDTO.setTouser(openId); |
| | | subscribeDTO.setTemplate_id(templateId); |
| | | subscribeDTO.setPage("packageD/pages/washer/order/index"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("thing1", "上门洗车")); |
| | | paras.add(new TemplateParam("thing4", phone)); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | } |
| | | } |
| | | /** |
| | | * uu洗车订单状态更改 |
| | | * @param openId |
| | | * @param accessToken |
| | | * @param status |
| | | * @param washerName |
| | | * @param washerMobile |
| | | * @param phone |
| | | * @param templateId |
| | | */ |
| | | public static void sendUuWash3(String openId, String accessToken, String status,String washerName,String washerMobile,String phone,String templateId){ |
| | | WxSubscribeDTO subscribeDTO = new WxSubscribeDTO(); |
| | | subscribeDTO.setTouser(openId); |
| | | subscribeDTO.setTemplate_id(templateId); |
| | | subscribeDTO.setPage("packageD/pages/washer/order/index"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("thing9", washerName)); |
| | | paras.add(new TemplateParam("phone_number10",washerMobile)); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | } |
| | | } |
| | | /** |
| | | * uu洗车订单状态更改 |
| | | * @param openId |
| | | * @param accessToken |
| | | * @param status |
| | | * @param washerName |
| | | * @param washerMobile |
| | | * @param phone |
| | | * @param templateId |
| | | */ |
| | | public static void sendUuWash4(String openId, String accessToken, String status,String washerName,String washerMobile,String phone,String templateId){ |
| | | WxSubscribeDTO subscribeDTO = new WxSubscribeDTO(); |
| | | subscribeDTO.setTouser(openId); |
| | | subscribeDTO.setTemplate_id(templateId); |
| | | subscribeDTO.setPage("packageD/pages/washer/order/index"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("thing4", status)); |
| | | paras.add(new TemplateParam("thing3", washerName)); |
| | | paras.add(new TemplateParam("thing6",washerMobile)); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | } |
| | | } |
| | | /** |
| | | * uu洗车订单状态更改 |
| | | * @param openId |
| | | * @param accessToken |
| | | * @param status |
| | | * @param washerName |
| | | * @param washerMobile |
| | | * @param phone |
| | | * @param templateId |
| | | */ |
| | | public static void sendUuWash6(String openId, String accessToken, String status,String washerName,String washerMobile,String phone,String templateId){ |
| | | WxSubscribeDTO subscribeDTO = new WxSubscribeDTO(); |
| | | subscribeDTO.setTouser(openId); |
| | | subscribeDTO.setTemplate_id(templateId); |
| | | subscribeDTO.setPage("packageD/pages/washer/order/index"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("phrase14", status)); |
| | | paras.add(new TemplateParam("name3", washerName)); |
| | | paras.add(new TemplateParam("thing5",washerMobile)); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | } |
| | | } |
| | | public static void main(String[] args) { |
| | | |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | try { |
| | | // String openId = "oMIR-5S9rpsWAVUUrNKoVDQbn5Mw";//zj的openid |
| | | String openId = "oMIR-5dWyNyWCCKMl7-kYzvyHOjs";// lyq的openid |
| | | String accessToken = util.getAppAccessToken(); |
| | | String accessToken = util.getAccessToken(); |
| | | // sendSubscribeHDJJKS(openId,accessToken,"测试活动即将开始标题","2021-08-04 13:00:00","成都市","50");//活动即将开始 |
| | | // sendSubscribeHDQX(openId,accessToken,"取消活动测试标题","2021-08-04 13:00:00");//活动取消 |
| | | // sendSubscribeHDBG(openId,accessToken,"活动名称","2021-08-05","活动变更地址","2021-08-06","活动地址");//活动变更 |