|
|
@@ -1,5 +1,6 @@
|
|
|
package com.xjrsoft.module.oa.utils;
|
|
|
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.extra.mail.MailAccount;
|
|
|
import cn.hutool.extra.mail.MailUtil;
|
|
|
@@ -12,12 +13,13 @@ import com.xjrsoft.common.enums.YesOrNoEnum;
|
|
|
import com.xjrsoft.common.sms.SmsSender;
|
|
|
import com.xjrsoft.common.utils.LocalDateTimeUtil;
|
|
|
import com.xjrsoft.common.utils.RedisUtil;
|
|
|
-import com.xjrsoft.common.utils.WeChatUtil;
|
|
|
import com.xjrsoft.config.CommonPropertiesConfig;
|
|
|
import com.xjrsoft.module.oa.entity.Message;
|
|
|
import com.xjrsoft.module.oa.service.IMessageService;
|
|
|
+import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
|
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
|
+import com.xjrsoft.module.organization.service.IWeChatService;
|
|
|
import com.xjrsoft.module.workflow.model.NoticePolicyParam;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
@@ -71,7 +73,7 @@ public class SendMessageUtil {
|
|
|
IUserService userService = SpringUtil.getBean(IUserService.class);
|
|
|
RedisUtil redisUtil = SpringUtil.getBean(RedisUtil.class);
|
|
|
|
|
|
- WeChatUtil weChatUtil = SpringUtil.getBean(WeChatUtil.class);
|
|
|
+ IWeChatService weChatUtil = SpringUtil.getBean(IWeChatService.class);
|
|
|
|
|
|
CommonPropertiesConfig cpConfig = SpringUtil.getBean(CommonPropertiesConfig.class);
|
|
|
|
|
|
@@ -111,17 +113,13 @@ public class SendMessageUtil {
|
|
|
put("value", LocalDateTimeUtil.format(LocalDateTime.now(), LocalDateTimeUtil.LOCAL_DATE_TIME_FORMAT));
|
|
|
}});
|
|
|
|
|
|
- JSONObject object = new JSONObject();
|
|
|
- object.put("touser", openId);
|
|
|
- object.put("template_id", "sHsmz7LRj7HLd7GSTS3r2jCLvK-4Wp19iGzEvYK8n_I");
|
|
|
-// object.put("miniprogram", new JSONObject() {{
|
|
|
-// put("appid", weChatUtil.getAppletAppKey());
|
|
|
-// put("pagepath", StrUtil.format("{}/xjrsoft/pages/workflow/approval?taskId={}&processId={}&type=todo",cpConfig.getDomainApp(), param.getTaskId(), param.getProcessId()));
|
|
|
-// }});
|
|
|
- object.put("url", StrUtil.format("{}/xjrsoft/pages/workflow/approval?taskId={}&processId={}&type=todo", cpConfig.getDomainApp(), param.getTaskId(), param.getProcessId()));
|
|
|
- object.put("client_msg_id", param.getTaskId());
|
|
|
- object.put("data", data);
|
|
|
- weChatUtil.sendTemplateMessage(object);
|
|
|
+ WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
|
|
|
+ weChatSendMessageDto.setUserId(openId);
|
|
|
+ weChatSendMessageDto.setTemplateId("sHsmz7LRj7HLd7GSTS3r2jCLvK-4Wp19iGzEvYK8n_I");
|
|
|
+ weChatSendMessageDto.setMsgId(param.getTaskId());
|
|
|
+ weChatSendMessageDto.setUrl(StrUtil.format("{}/xjrsoft/pages/workflow/approval?taskId={}&processId={}&type=todo", cpConfig.getDomainApp(), param.getTaskId(), param.getProcessId()));
|
|
|
+ weChatSendMessageDto.setContent(data);
|
|
|
+ weChatUtil.sendTemplateMessage(weChatSendMessageDto);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -133,7 +131,7 @@ public class SendMessageUtil {
|
|
|
IUserService userService = SpringUtil.getBean(IUserService.class);
|
|
|
RedisUtil redisUtil = SpringUtil.getBean(RedisUtil.class);
|
|
|
|
|
|
- WeChatUtil weChatUtil = SpringUtil.getBean(WeChatUtil.class);
|
|
|
+ IWeChatService weChatUtil = SpringUtil.getBean(IWeChatService.class);
|
|
|
|
|
|
CommonPropertiesConfig cpConfig = SpringUtil.getBean(CommonPropertiesConfig.class);
|
|
|
|
|
|
@@ -176,18 +174,13 @@ public class SendMessageUtil {
|
|
|
put("value", LocalDateTimeUtil.format(LocalDateTime.now(), LocalDateTimeUtil.LOCAL_DATE_TIME_FORMAT));
|
|
|
}});
|
|
|
|
|
|
- JSONObject object = new JSONObject();
|
|
|
- object.put("touser", openId);
|
|
|
- object.put("template_id", "sHsmz7LRj7HLd7GSTS3r2jCLvK-4Wp19iGzEvYK8n_I");
|
|
|
-// object.put("miniprogram", new JSONObject() {{
|
|
|
-// put("appid", weChatUtil.getAppletAppKey());
|
|
|
-// put("pagepath", StrUtil.format("{}/xjrsoft/pages/workflow/approval?taskId={}&processId={}&type=todo",cpConfig.getDomainApp(), param.getTaskId(), param.getProcessId()));
|
|
|
-// }});
|
|
|
- object.put("url", StrUtil.format("{}/xjrsoft/pages/home/home", cpConfig.getDomainApp()));
|
|
|
-// object.put("client_msg_id", param.getTaskId());
|
|
|
- object.put("data", data);
|
|
|
- weChatUtil.sendTemplateMessage(object);
|
|
|
- //System.err.println(isSuccess);
|
|
|
+ WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
|
|
|
+ weChatSendMessageDto.setUserId(openId);
|
|
|
+ weChatSendMessageDto.setTemplateId("sHsmz7LRj7HLd7GSTS3r2jCLvK-4Wp19iGzEvYK8n_I");
|
|
|
+ weChatSendMessageDto.setMsgId(IdUtil.getSnowflakeNextIdStr());
|
|
|
+ weChatSendMessageDto.setUrl(StrUtil.format("{}/xjrsoft/pages/home/home", cpConfig.getDomainApp()));
|
|
|
+ weChatSendMessageDto.setContent(data);
|
|
|
+ weChatUtil.sendTemplateMessage(weChatSendMessageDto);
|
|
|
}
|
|
|
}
|
|
|
|