Commit 26c9d30e authored by 竹天卫's avatar 竹天卫

消息推送到企业微信中

parent d97611b9
......@@ -129,6 +129,16 @@
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
</dependencies>
<build>
......
......@@ -123,4 +123,24 @@ public class WeiXinController {
String s = new String(tempArr);
return s;
}
@ApiOperation(value = "发送消息")
@GetMapping("/sendTextMessage")
public BaseResponse sendTextMessage() {
try {
weiXinService.sendTextMessage("1","hello");
return BaseResponse.okData("成功");
} catch (Exception e) {
log.debug("发送消息{}", e);
}
return BaseResponse.errorMsg("失败!");
}
}
......@@ -18,6 +18,7 @@ import cn.wise.sc.cement.business.util.CheckCountUtil;
import cn.wise.sc.cement.business.util.ExcelUtil;
import cn.wise.sc.cement.business.util.PageUtil;
import cn.wise.sc.cement.business.util.RedisUtil;
import cn.wise.sc.cement.business.util.weixin.Global;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -111,6 +112,9 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
private ClientMapper clientMapper;
@Autowired
private ISysUserMessageService userMessageService;
@Autowired
private WeiXinService weiXinService;
/**
* 委托分页
......@@ -290,10 +294,21 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (approvalId == null) {
return BaseResponse.errorMsg("委托评审信息错误");
}
SysUser approvalUser = userService.getById(approvalId);
if(approvalUser == null){
return BaseResponse.errorMsg("委托评审信息错误");
}
BaseResponse wrapper = userMessageService.sendMessage(approvalId, "您有一条新的委托单申请等待评审",entrust.getId(), SysUserMessage.MessageType.ENTRUST);
if(wrapper.getCode() != 200){
return wrapper;
}
//发送企业微信消息内容
if(StringUtils.isNotBlank(approvalUser.getWxId())){
String content="你好!"+loginUser.getName()+"向您申请了一条委托,请前往\n" +
Global.systemUrl +"进行评审。";
weiXinService.sendTextMessage(approvalUser.getWxId(), content);
}
return BaseResponse.okData(entrust);
}
......@@ -882,6 +897,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (entrust.getStatus() != 1) {
return BaseResponse.errorMsg("当前状态不允许样品处理");
}
String userIds = "";
List<Integer> userIdList = new ArrayList<>();
if (query.getSampleHandleQueryList() != null && query.getSampleHandleQueryList().size() > 0) {
List<SampleHandleQuery> sampleHandleQueryList = query.getSampleHandleQueryList();
for (SampleHandleQuery sampleHandleQuery : sampleHandleQueryList) {
......@@ -927,6 +944,15 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if(wrapper.getCode() != 200){
return wrapper;
}
SysUser handleUser = userService.getById(sampleHandle.getUserId());
if(handleUser == null){
return BaseResponse.errorMsg("样品处理人信息错误");
}
if(StringUtils.isNotBlank(handleUser.getWxId()) && !userIdList.contains(handleUser.getId())){
userIdList.add(handleUser.getId());
userIds = userIds.equals("")?handleUser.getWxId():userIds+"|"+handleUser.getWxId();
}
}
}
//委托表改成已发送样品处理,状态改为样品处理状态中
......@@ -934,6 +960,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.setStatus(3);
entrustMapper.updateById(entrust);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "发送样品处理任务", null);
//发送企业微信消息内容
String content="你好!您有一条新的样品处理任务,请前往\n"+Global.systemUrl +"进行接受。";
weiXinService.sendTextMessage(userIds, content);
return BaseResponse.okMsg("已发送样品处理任务");
}
......@@ -1251,6 +1281,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (entrust.getStatus() != 4) {
return BaseResponse.errorMsg("当前状态不允许派发");
}
String userIds = "";
List<Integer> userIdList = new ArrayList<>();
if (query.getSampleDistributionQueryList() != null && query.getSampleDistributionQueryList().size() > 0) {
List<SampleDistributionQuery> sampleDistributionQueryList = query.getSampleDistributionQueryList();
List<SampleDistribution> sampleDistributionList = new ArrayList<>();
......@@ -1282,6 +1314,14 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if(wrapper.getCode() != 200){
return wrapper;
}
SysUser distributionUser = userService.getById(distributionTeamQuery.getUserId());
if(distributionUser == null){
return BaseResponse.errorMsg("样品检测人信息错误");
}
if(StringUtils.isNotBlank(distributionUser.getWxId()) && !userIdList.contains(distributionUser.getId())){
userIdList.add(distributionUser.getId());
userIds = userIds.equals("")?distributionUser.getWxId():userIds+"|"+distributionUser.getWxId();
}
}
}
Sample sample = sampleService.getById(distributionQuery.getSampleId());
......@@ -1297,6 +1337,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
entrust.setStatus(5).setIsDistribution(1);
entrustMapper.updateById(entrust);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "派发检测项目任务", null);
//发送企业微信消息内容
String content="你好!您有一条新的样品检测任务,请前往\n" +
Global.systemUrl +"进行接受。";
weiXinService.sendTextMessage(userIds, content);
return BaseResponse.okMsg("已派发检测项目任务");
}
......@@ -2076,6 +2120,21 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
List<Sample> sampleNoCheckList = sampleMapper.getNoCheckList(entrust.getId());
if (sampleNoCheckList == null || sampleNoCheckList.size() == 0) {
entrust.setStatus(8);
//校核完成之后 ,提醒评审人员查看
Integer approvalId = sysApprovalMapper.getApprovalId("委托评审");
if (approvalId == null) {
return BaseResponse.errorMsg("委托评审信息错误");
}
SysUser approvalUser = userService.getById(approvalId);
if(approvalUser == null){
return BaseResponse.errorMsg("委托评审信息错误");
}
//发送企业微信消息内容
if(StringUtils.isNotBlank(approvalUser.getWxId())){
String content="你好!"+"委托单号"+entrust.getEntrustCode()+"已校核完成,请前往\n" +
Global.systemUrl +"进行查看。";
weiXinService.sendTextMessage(approvalUser.getWxId(), content);
}
}
entrustMapper.updateById(entrust);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "数据校核", null);
......
......@@ -268,6 +268,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
return BaseResponse.okData("检定完成");
}
//TODO判断设备检定是否到期,如果到期,提醒检测人员
/**
* 设备检定分页查询
*
......
......@@ -8,29 +8,23 @@ import cn.wise.sc.cement.business.service.ISysUserService;
import cn.wise.sc.cement.business.util.JwtUtil;
import cn.wise.sc.cement.business.util.RedisUtil;
import cn.wise.sc.cement.business.util.weixin.Global;
import cn.wise.sc.cement.business.util.weixin.WeiXinUtil;
import cn.wise.sc.cement.business.util.weixin.WeixinInterfaceUtil;
import cn.wise.sc.cement.business.wrapper.WrapMapper;
import cn.wise.sc.cement.business.wrapper.Wrapper;
import cn.wise.sc.cement.business.util.weixin.message.send.BaseMessage;
import cn.wise.sc.cement.business.util.weixin.message.send.Text;
import cn.wise.sc.cement.business.util.weixin.message.send.TextMessage;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.Gson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@Service
public class WeiXinService {
@Value("${weixin.corpid}")
private String corpid;
@Value("${weixin.corpsecret}")
private String corpsecret;
@Value("${weixin.corpsecretPC}")
private String corpsecretPC;
private static Logger log = LoggerFactory.getLogger(WeiXinService.class);
@Autowired
private ISysUserService userService;
@Autowired
......@@ -53,7 +47,7 @@ public class WeiXinService {
System.out.println("==================code===================");
System.out.println(code);
try {
String accessToken = null;
/* String accessToken = null;
if (type.equals("PC")) {
accessToken = getAccessToken();
} else if (type.equals("APP")) {
......@@ -70,10 +64,10 @@ public class WeiXinService {
String UserId = jsonObject.getString("UserId");
System.out.println("==================UserId===================");
System.out.println(UserId);
JSONObject userJson = getUser(accessToken, UserId);
JSONObject userJson = getUser(accessToken, UserId);*/
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
wrapper.eq("phone", userJson.get("mobile"));
// wrapper.eq("phone", code); //暂时用手机号代替code
// wrapper.eq("phone", userJson.get("mobile"));
wrapper.eq("phone", code); //暂时用手机号代替code
SysUser sysUser = userService.getOne(wrapper);
if (sysUser == null) {
return BaseResponse.errorMsg("非系统用户不允许登录!");
......@@ -89,6 +83,8 @@ public class WeiXinService {
sysUser.getName(), sysUser.getPhone());
System.out.println(token);
redisUtil.setString(sysUser.getId().toString(), token, 3600);
// sysUser.setWxId(UserId);
// userService.updateById(sysUser);
return BaseResponse.okData(token);
} catch (Exception e) {
return BaseResponse.errorMsg(e.getMessage());
......@@ -110,7 +106,7 @@ public class WeiXinService {
if (!redisUtil.existsKey(ACCESS_TOKEN)) {
String param = "corpid=%s&corpsecret=%s";
param = String.format(param, corpid, corpsecret);
param = String.format(param, Global.corpId, Global.agentSecret);
JSONObject jsonObject = WeixinInterfaceUtil.doGet(Global.ACCESSTOKENURL, param);
accessToken = jsonObject.getString("access_token");
redisUtil.setString(ACCESS_TOKEN, accessToken, 7100);
......@@ -174,4 +170,68 @@ public class WeiXinService {
}
/**
* 发送消息
* @param touser 指定接收消息的成员,成员ID列表(多个接收者用‘|’分隔,最多支持1000个)。
* 特殊情况:指定为”@all”,则向该企业应用的全部成员发送
* @param content 消息内容,最长不超过2048个字节,超过将截断(支持id转译)
*/
public void sendTextMessage(String touser, String content){
//1.创建文本消息对象
TextMessage message=new TextMessage();
//1.1非必需
message.setTouser(touser); //不区分大小写
//textMessage.setToparty("1");
//txtMsg.setTotag(totag);
//txtMsg.setSafe(0);
//1.2必需
message.setMsgtype("text");
message.setAgentid(Global.agentId);
Text text=new Text();
text.setContent(content);
message.setText(text);
//2.获取access_token:根据企业id和通讯录密钥获取access_token,并拼接请求url
// String accessToken= WeiXinUtil.getAccessToken(corpid, WeiXinParamesUtil.agentSecret).getToken();
String accessToken = getAccessToken();
System.out.println("accessToken:"+accessToken);
//3.发送消息:调用业务类,发送消息
sendMessage(accessToken, message);
}
/**
* @desc :0.公共方法:发送消息
*
* @param accessToken
* @param message void
*/
public void sendMessage(String accessToken,BaseMessage message){
//1.获取json字符串:将message对象转换为json字符串
Gson gson = new Gson();
String jsonMessage =gson.toJson(message); //使用gson.toJson(user)即可将user对象顺序转成json
System.out.println("jsonTextMessage:"+jsonMessage);
//2.获取请求的url
String url=Global.SENDMESSAGE.replace("ACCESS_TOKEN", accessToken);
//3.调用接口,发送消息
JSONObject jsonObject = WeiXinUtil.httpRequest(url, "POST", jsonMessage);
System.out.println("jsonObject:"+jsonObject.toString());
//4.错误消息处理
if (null != jsonObject) {
if (0 != jsonObject.getInteger("errcode")) {
log.error("消息发送失败 errcode:{} errmsg:{}", jsonObject.getInteger("errcode"), jsonObject.getString("errmsg"));
}
}
}
}
package cn.wise.sc.cement.business.util.weixin;
/**
* @desc : 微信通用接口凭证
*
* @author: shirayner
* @date : 2017-8-20 下午9:35:11
*/
public class AccessToken {
// 获取到的凭证
private String token;
// 凭证有效时间,单位:秒
private int expiresIn;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public int getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(int expiresIn) {
this.expiresIn = expiresIn;
}
}
\ No newline at end of file
......@@ -10,6 +10,23 @@ package cn.wise.sc.cement.business.util.weixin;
public interface Global {
//企业应用的id,整型。可在应用的设置页面查看
public final static int agentId = 1000002;
//企业ID
public final static String corpId = "ww348f91b2573c1867";
//应用的凭证密钥
public final static String agentSecret = "gFa_7XvXtCaoeAYERzjRwwz_OTJkJfgBb8weOKjmI3o";
//编译后的回调地址
public final static String backUrl = "https%3a%2f%2fprogram.oxogroup.com%2flab-system";
//实验室管理系统链接
public final static String systemUrl = "<a href=\"+https://open.weixin.qq.com/connect/oauth2/authorize?appid="+corpId+"&redirect_uri="+backUrl+"%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">天津院实验室管理系统</a>,";
//应用的凭证密钥PC
public final static String agentSecretPC = "itCLYcwl9ggA9VfZam_iz96Ikp9StDFfVr4Adb0yY7A";
/**
* 微信公众平台,获取AccessToken的接口地址,Https请求方式:GET
* 接口地址示例:https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=id&corpsecret=secrect
......@@ -35,10 +52,12 @@ public interface Global {
* 微信公众平台,发送应用消息的接口地址,Https请求方式:GET
* 接口地址示例:https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN
*/
public static final String SENDMESSAGE = "https://qyapi.weixin.qq.com/cgi-bin/message/send";
public static final String SENDMESSAGE = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN";
public static final String userTicket = "https://qyapi.weixin.qq.com/cgi-bin/ticket/get";
}
package cn.wise.sc.cement.business.util.weixin;
import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
/**
* 证书信任管理器(用于https请求)
*
* @author liufeng
* @date 2013-08-08
*/
public class MyX509TrustManager implements X509TrustManager {
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
public X509Certificate[] getAcceptedIssuers() {
return null;
}
}
\ No newline at end of file
package cn.wise.sc.cement.business.util.weixin;
import cn.wise.sc.cement.business.model.ResultVO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.*;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.util.*;
......@@ -16,16 +13,6 @@ import java.util.*;
*/
public class WeixinInterfaceUtil {
private static final String HOST = "https://ydd.whlyj.sh.gov.cn/"; //服务器IP与端口
private static final String APPID = "DSACTSYS";
private static final String APPSECRET = "uzRpwnG6USeZDR0C";
// private static final Long TIMESTAMP = System.currentTimeMillis();
private static final String NONCE = UUID.randomUUID().toString();
public static void main(String[] args){
String param = "corpid=%s&corpsecret=%s";
param = String.format(param, "ww348f91b2573c1867", "gFa_7XvXtCaoeAYERzjRwwz_OTJkJfgBb8weOKjmI3o");
......@@ -37,7 +24,6 @@ public class WeixinInterfaceUtil {
e.printStackTrace();
}
}
public static JSONObject doGet(String url, String param) {
......@@ -47,55 +33,5 @@ public class WeixinInterfaceUtil {
return resultMap;
}
/**
* 向目的URL发送post请求
* @param url 目的url
* @param params 发送的参数
* @return ResultVO
*/
public static ResultVO sendPostRequest(String url, MultiValueMap<String, String> params){
RestTemplate client = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
HttpMethod method = HttpMethod.POST;
// 以表单的方式提交
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
//将请求头部和参数合成一个请求
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers);
//执行HTTP请求,将返回的结构使用ResultVO类格式化
ResponseEntity<ResultVO> response = client.exchange(url, method, requestEntity, ResultVO.class);
return response.getBody();
}
/**
* 将请求参数放到map里,
* 按照字母请求参数名的字母升序排列非空请求参数(包含 appid)
* @param sortedParams
* @return
*/
private static String getSignContent(Map<String, String> sortedParams) {
System.out.println("signData = " + JSON.toJSONString(sortedParams));
Set<String> keySet = sortedParams.keySet();
StringBuffer content = new StringBuffer();
List<String> keys = new ArrayList<String>();
for (String key : keySet) {
keys.add(key);
}
Collections.sort(keys);
int index = 0;
for (int i = 0; i < keys.size(); i++) {
String key = keys.get(i);
String value = sortedParams.get(key);
if (StringUtils.isNotEmpty(key) && StringUtils.isNotEmpty(value)) {
content.append((index == 0 ? "" : "&") + key + "=" + value);
index++;
}
}
return content.toString();
}
}
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 文章
* @author shirayner
*
*/
public class Article {
//是 标题,不超过128个字节,超过会自动截断
private String title;
//否 描述,不超过512个字节,超过会自动截断
private String description;
//是 点击后跳转的链接。
private String url;
//否 图文消息的图片链接,支持JPG、PNG格式,较好的效果为大图640320,小图8080。
private String picurl;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getPicurl() {
return picurl;
}
public void setPicurl(String picurl) {
this.picurl = picurl;
}
}
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 消息基类(企业号 -> 普通用户)
* @author shirayner
*
*/
public class BaseMessage {
// 否 成员ID列表(消息接收者,多个接收者用‘|’分隔,最多支持1000个)。特殊情况:指定为@all,则向该企业应用的全部成员发送
private String touser;
// 否 部门ID列表,多个接收者用‘|’分隔,最多支持100个。当touser为@all时忽略本参数
private String toparty;
// 否 标签ID列表,多个接收者用‘|’分隔,最多支持100个。当touser为@all时忽略本参数
private String totag;
// 是 消息类型
private String msgtype;
// 是 企业应用的id,整型。可在应用的设置页面查看
private int agentid;
public String getTouser() {
return touser;
}
public void setTouser(String touser) {
this.touser = touser;
}
public String getToparty() {
return toparty;
}
public void setToparty(String toparty) {
this.toparty = toparty;
}
public String getTotag() {
return totag;
}
public void setTotag(String totag) {
this.totag = totag;
}
public String getMsgtype() {
return msgtype;
}
public void setMsgtype(String msgtype) {
this.msgtype = msgtype;
}
public int getAgentid() {
return agentid;
}
public void setAgentid(int agentid) {
this.agentid = agentid;
}
}
\ No newline at end of file
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 文件消息
* @author shirayner
*
*/
public class FileMessage extends BaseMessage {
//文件
private Media file ;
//否 表示是否是保密消息,0表示否,1表示是,默认0
private int safe;
public Media getFile() {
return file;
}
public void setFile(Media file) {
this.file = file;
}
public int getSafe() {
return safe;
}
public void setSafe(int safe) {
this.safe = safe;
}
}
\ No newline at end of file
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 图片消息
* @author shirayner
*
*/
public class ImgMessage extends BaseMessage {
//图片
private Media image ;
//否 表示是否是保密消息,0表示否,1表示是,默认0
private int safe;
public Media getImage() {
return image;
}
public void setImage(Media image) {
this.image = image;
}
public int getSafe() {
return safe;
}
public void setSafe(int safe) {
this.safe = safe;
}
}
\ No newline at end of file
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 图片、语音、文件
* @author shirayner
*
*/
public class Media {
//是 图片/语音/文件 媒体文件id,可以调用上传临时素材接口获取
private String media_id;
public String getMedia_id() {
return media_id;
}
public void setMedia_id(String media_id) {
this.media_id = media_id;
}
}
package cn.wise.sc.cement.business.util.weixin.message.send;
import java.util.List;
/**
* 图文
* @author shirayner
*
*/
public class News {
//文章列表
private List<Article> articles;
public List<Article> getArticles() {
return articles;
}
public void setArticles(List<Article> articles) {
this.articles = articles;
}
}
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 图文消息
* @author shirayner
*
*/
public class NewsMessage extends BaseMessage {
//图文
private News news;
public News getNews() {
return news;
}
public void setNews(News news) {
this.news = news;
}
}
\ No newline at end of file
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 文本
* @author shirayner
*
*/
public class Text {
//是 消息内容,最长不超过2048个字节
private String content;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 文本消息
* @author shirayner
*
*/
public class TextMessage extends BaseMessage {
//文本
private Text text;
//否 表示是否是保密消息,0表示否,1表示是,默认0
private int safe;
public Text getText() {
return text;
}
public void setText(Text text) {
this.text = text;
}
public int getSafe() {
return safe;
}
public void setSafe(int safe) {
this.safe = safe;
}
}
\ No newline at end of file
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 文本卡片
* @author shirayner
*
*/
public class Textcard {
//是 标题,不超过128个字节,超过会自动截断
private String title;
//是 描述,不超过512个字节,超过会自动截断
private String description;
//是 点击后跳转的链接。
private String url;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 文本卡片消息
* @author shirayner
*
*/
public class TextcardMessage extends BaseMessage {
//文本
private Textcard textcard;
//btntxt 否 按钮文字。 默认为“详情”, 不超过4个文字,超过自动截断。
public Textcard getTextcard() {
return textcard;
}
public void setTextcard(Textcard textcard) {
this.textcard = textcard;
}
}
\ No newline at end of file
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 视频
* @author shirayner
*
*/
public class Video {
//是 视频媒体文件id,可以调用上传临时素材接口获取
private String media_id;
//否 视频消息的标题,不超过128个字节,超过会自动截断
private String title;
//否 视频消息的描述,不超过512个字节,超过会自动截断
private String description;
public String getMedia_id() {
return media_id;
}
public void setMedia_id(String media_id) {
this.media_id = media_id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 视频消息
* @author shirayner
*
*/
public class VideoMessage extends BaseMessage {
//视频
private Video video ;
//否 表示是否是保密消息,0表示否,1表示是,默认0
private int safe;
public Video getVideo() {
return video;
}
public void setVideo(Video video) {
this.video = video;
}
public int getSafe() {
return safe;
}
public void setSafe(int safe) {
this.safe = safe;
}
}
\ No newline at end of file
package cn.wise.sc.cement.business.util.weixin.message.send;
/**
* 语音消息
* @author shirayner
*
*/
public class VoiceMessage extends BaseMessage {
//语音
private Media voice ;
//否 表示是否是保密消息,0表示否,1表示是,默认0
private int safe;
public Media getVoice() {
return voice;
}
public void setVoice(Media voice) {
this.voice = voice;
}
public int getSafe() {
return safe;
}
public void setSafe(int safe) {
this.safe = safe;
}
}
\ No newline at end of file
......@@ -7,8 +7,8 @@ spring:
active: dev
datasource:
# 192.168.110.85 admin!@#123
url: jdbc:mysql://192.168.110.85:3306/sinoma_tcdri?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
# url: jdbc:mysql://81.68.92.175:3306/sinoma_tcdri?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
# url: jdbc:mysql://192.168.110.85:3306/sinoma_tcdri?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://81.68.92.175:3306/sinoma_tcdri?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: admin!@#123
driverClassName: com.mysql.cj.jdbc.Driver
......@@ -37,8 +37,3 @@ mybatis-plus:
check-config-location: true
type-aliases-package: cn.wise.sc.cement.business.entity.**
mapper-locations: classpath:/cn/wise/sc/cement/business/mapper/xml/*Mapper.xml
weixin:
corpsecret: gFa_7XvXtCaoeAYERzjRwwz_OTJkJfgBb8weOKjmI3o
corpsecretPC: itCLYcwl9ggA9VfZam_iz96Ikp9StDFfVr4Adb0yY7A
corpid: ww348f91b2573c1867
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment