From 1efc36e6dc172c02939a5245c1dffa78ba728c49 Mon Sep 17 00:00:00 2001 From: lujiang Date: Sun, 8 Sep 2024 12:20:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=B0=8F=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ics/controller/mobile/WxBindController.java | 13 ------------- .../service/impl/RepairRemindPushServiceImpl.java | 13 ++++++++----- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/shoot-hand/ics-web/src/main/java/com/ics/controller/mobile/WxBindController.java b/shoot-hand/ics-web/src/main/java/com/ics/controller/mobile/WxBindController.java index 1e08cea..7640dfb 100644 --- a/shoot-hand/ics-web/src/main/java/com/ics/controller/mobile/WxBindController.java +++ b/shoot-hand/ics-web/src/main/java/com/ics/controller/mobile/WxBindController.java @@ -3,7 +3,6 @@ package com.ics.controller.mobile; import com.alibaba.fastjson.JSONObject; import com.ics.admin.service.IIcsCustomerStaffService; import com.ics.common.utils.StringUtils; -import com.ics.service.RepairRemindPushService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; @@ -45,10 +44,6 @@ public class WxBindController { @Autowired private IIcsCustomerStaffService customerStaffService; - @Autowired - private RepairRemindPushService repairRemindPushService; - - //微信公众号网页授权地址 private final static String OAUTH2_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=sh0907#wechat_redirect"; @@ -98,14 +93,6 @@ public class WxBindController { return String.format(resultHtml, row > 0 ? "绑定成功" : "绑定失败"); } - - @Ignore - @ResponseBody - @RequestMapping(value = "/send", produces = "text/html;charset=utf-8") - public String send() { - return repairRemindPushService.pushWxTemplateMsg()+""; - } - /** * 获取绑定页面 */ diff --git a/shoot-hand/ics-web/src/main/java/com/ics/service/impl/RepairRemindPushServiceImpl.java b/shoot-hand/ics-web/src/main/java/com/ics/service/impl/RepairRemindPushServiceImpl.java index f70bb90..fde276f 100644 --- a/shoot-hand/ics-web/src/main/java/com/ics/service/impl/RepairRemindPushServiceImpl.java +++ b/shoot-hand/ics-web/src/main/java/com/ics/service/impl/RepairRemindPushServiceImpl.java @@ -89,16 +89,19 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService { String openid = customerStaff.getGzhOpenid(); String time = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, repairRemind.getCreateTime()); String content = repairRemind.getContent(); + if (StringUtils.isNotBlank(content) && content.length() > 20) { + content = content.substring(0, 19); + } Map param = new HashMap<>(); param.put("touser", openid); param.put("template_id", templateId); param.put("touser", openid); -// JSONObject miniprogram = new JSONObject(); -// miniprogram.put("appid", WX_SMALL_APP_ID); -// miniprogram.put("pagepath", WX_SMALL_APP_PAGE); -// param.put("miniprogram", miniprogram); + JSONObject miniprogram = new JSONObject(); + miniprogram.put("appid", WX_SMALL_APP_ID); + miniprogram.put("pagepath", WX_SMALL_APP_PAGE); + param.put("miniprogram", miniprogram); JSONObject dataTime = new JSONObject(); @@ -111,6 +114,7 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService { data.put("thing37", msg); param.put("data", data); JSONObject result = send(url, JSON.toJSONString(param)); + System.out.println(result.toString()); if (result == null || result.getInteger("errcode") == null || result.getInteger("errcode") != 0) { failed.add(repairRemind.getId()); } else { @@ -132,7 +136,6 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService { try { Response response = call.execute(); String resultStr = response.body().string(); - System.out.println(resultStr); return JSON.parseObject(resultStr); } catch (IOException e) { e.printStackTrace();