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

消息推送到企业微信中

parent d97611b9
...@@ -129,6 +129,16 @@ ...@@ -129,6 +129,16 @@
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
</dependency> </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> </dependencies>
<build> <build>
......
...@@ -123,4 +123,24 @@ public class WeiXinController { ...@@ -123,4 +123,24 @@ public class WeiXinController {
String s = new String(tempArr); String s = new String(tempArr);
return s; 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; ...@@ -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.ExcelUtil;
import cn.wise.sc.cement.business.util.PageUtil; import cn.wise.sc.cement.business.util.PageUtil;
import cn.wise.sc.cement.business.util.RedisUtil; 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.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -111,6 +112,9 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -111,6 +112,9 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
private ClientMapper clientMapper; private ClientMapper clientMapper;
@Autowired @Autowired
private ISysUserMessageService userMessageService; private ISysUserMessageService userMessageService;
@Autowired
private WeiXinService weiXinService;
/** /**
* 委托分页 * 委托分页
...@@ -290,10 +294,21 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -290,10 +294,21 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (approvalId == null) { if (approvalId == null) {
return BaseResponse.errorMsg("委托评审信息错误"); return BaseResponse.errorMsg("委托评审信息错误");
} }
SysUser approvalUser = userService.getById(approvalId);
if(approvalUser == null){
return BaseResponse.errorMsg("委托评审信息错误");
}
BaseResponse wrapper = userMessageService.sendMessage(approvalId, "您有一条新的委托单申请等待评审",entrust.getId(), SysUserMessage.MessageType.ENTRUST); BaseResponse wrapper = userMessageService.sendMessage(approvalId, "您有一条新的委托单申请等待评审",entrust.getId(), SysUserMessage.MessageType.ENTRUST);
if(wrapper.getCode() != 200){ if(wrapper.getCode() != 200){
return wrapper; return wrapper;
} }
//发送企业微信消息内容
if(StringUtils.isNotBlank(approvalUser.getWxId())){
String content="你好!"+loginUser.getName()+"向您申请了一条委托,请前往\n" +
Global.systemUrl +"进行评审。";
weiXinService.sendTextMessage(approvalUser.getWxId(), content);
}
return BaseResponse.okData(entrust); return BaseResponse.okData(entrust);
} }
...@@ -882,6 +897,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -882,6 +897,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (entrust.getStatus() != 1) { if (entrust.getStatus() != 1) {
return BaseResponse.errorMsg("当前状态不允许样品处理"); return BaseResponse.errorMsg("当前状态不允许样品处理");
} }
String userIds = "";
List<Integer> userIdList = new ArrayList<>();
if (query.getSampleHandleQueryList() != null && query.getSampleHandleQueryList().size() > 0) { if (query.getSampleHandleQueryList() != null && query.getSampleHandleQueryList().size() > 0) {
List<SampleHandleQuery> sampleHandleQueryList = query.getSampleHandleQueryList(); List<SampleHandleQuery> sampleHandleQueryList = query.getSampleHandleQueryList();
for (SampleHandleQuery sampleHandleQuery : sampleHandleQueryList) { for (SampleHandleQuery sampleHandleQuery : sampleHandleQueryList) {
...@@ -927,6 +944,15 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -927,6 +944,15 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if(wrapper.getCode() != 200){ if(wrapper.getCode() != 200){
return wrapper; 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 ...@@ -934,6 +960,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.setStatus(3); .setStatus(3);
entrustMapper.updateById(entrust); entrustMapper.updateById(entrust);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "发送样品处理任务", null); logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "发送样品处理任务", null);
//发送企业微信消息内容
String content="你好!您有一条新的样品处理任务,请前往\n"+Global.systemUrl +"进行接受。";
weiXinService.sendTextMessage(userIds, content);
return BaseResponse.okMsg("已发送样品处理任务"); return BaseResponse.okMsg("已发送样品处理任务");
} }
...@@ -1251,6 +1281,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -1251,6 +1281,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (entrust.getStatus() != 4) { if (entrust.getStatus() != 4) {
return BaseResponse.errorMsg("当前状态不允许派发"); return BaseResponse.errorMsg("当前状态不允许派发");
} }
String userIds = "";
List<Integer> userIdList = new ArrayList<>();
if (query.getSampleDistributionQueryList() != null && query.getSampleDistributionQueryList().size() > 0) { if (query.getSampleDistributionQueryList() != null && query.getSampleDistributionQueryList().size() > 0) {
List<SampleDistributionQuery> sampleDistributionQueryList = query.getSampleDistributionQueryList(); List<SampleDistributionQuery> sampleDistributionQueryList = query.getSampleDistributionQueryList();
List<SampleDistribution> sampleDistributionList = new ArrayList<>(); List<SampleDistribution> sampleDistributionList = new ArrayList<>();
...@@ -1282,6 +1314,14 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -1282,6 +1314,14 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if(wrapper.getCode() != 200){ if(wrapper.getCode() != 200){
return wrapper; 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()); Sample sample = sampleService.getById(distributionQuery.getSampleId());
...@@ -1297,6 +1337,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -1297,6 +1337,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
entrust.setStatus(5).setIsDistribution(1); entrust.setStatus(5).setIsDistribution(1);
entrustMapper.updateById(entrust); entrustMapper.updateById(entrust);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "派发检测项目任务", null); logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "派发检测项目任务", null);
//发送企业微信消息内容
String content="你好!您有一条新的样品检测任务,请前往\n" +
Global.systemUrl +"进行接受。";
weiXinService.sendTextMessage(userIds, content);
return BaseResponse.okMsg("已派发检测项目任务"); return BaseResponse.okMsg("已派发检测项目任务");
} }
...@@ -2076,6 +2120,21 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -2076,6 +2120,21 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
List<Sample> sampleNoCheckList = sampleMapper.getNoCheckList(entrust.getId()); List<Sample> sampleNoCheckList = sampleMapper.getNoCheckList(entrust.getId());
if (sampleNoCheckList == null || sampleNoCheckList.size() == 0) { if (sampleNoCheckList == null || sampleNoCheckList.size() == 0) {
entrust.setStatus(8); 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); entrustMapper.updateById(entrust);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "数据校核", null); logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "数据校核", null);
......
...@@ -268,6 +268,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -268,6 +268,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
return BaseResponse.okData("检定完成"); return BaseResponse.okData("检定完成");
} }
//TODO判断设备检定是否到期,如果到期,提醒检测人员
/** /**
* 设备检定分页查询 * 设备检定分页查询
* *
......
...@@ -8,29 +8,23 @@ import cn.wise.sc.cement.business.service.ISysUserService; ...@@ -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.JwtUtil;
import cn.wise.sc.cement.business.util.RedisUtil; 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.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.util.weixin.WeixinInterfaceUtil;
import cn.wise.sc.cement.business.wrapper.WrapMapper; import cn.wise.sc.cement.business.util.weixin.message.send.BaseMessage;
import cn.wise.sc.cement.business.wrapper.Wrapper; 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.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.Gson;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@Service @Service
public class WeiXinService { public class WeiXinService {
@Value("${weixin.corpid}") private static Logger log = LoggerFactory.getLogger(WeiXinService.class);
private String corpid;
@Value("${weixin.corpsecret}")
private String corpsecret;
@Value("${weixin.corpsecretPC}")
private String corpsecretPC;
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@Autowired @Autowired
...@@ -53,7 +47,7 @@ public class WeiXinService { ...@@ -53,7 +47,7 @@ public class WeiXinService {
System.out.println("==================code==================="); System.out.println("==================code===================");
System.out.println(code); System.out.println(code);
try { try {
String accessToken = null; /* String accessToken = null;
if (type.equals("PC")) { if (type.equals("PC")) {
accessToken = getAccessToken(); accessToken = getAccessToken();
} else if (type.equals("APP")) { } else if (type.equals("APP")) {
...@@ -70,10 +64,10 @@ public class WeiXinService { ...@@ -70,10 +64,10 @@ public class WeiXinService {
String UserId = jsonObject.getString("UserId"); String UserId = jsonObject.getString("UserId");
System.out.println("==================UserId==================="); System.out.println("==================UserId===================");
System.out.println(UserId); System.out.println(UserId);
JSONObject userJson = getUser(accessToken, UserId); JSONObject userJson = getUser(accessToken, UserId);*/
QueryWrapper<SysUser> wrapper = new QueryWrapper<>(); QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
wrapper.eq("phone", userJson.get("mobile")); // wrapper.eq("phone", userJson.get("mobile"));
// wrapper.eq("phone", code); //暂时用手机号代替code wrapper.eq("phone", code); //暂时用手机号代替code
SysUser sysUser = userService.getOne(wrapper); SysUser sysUser = userService.getOne(wrapper);
if (sysUser == null) { if (sysUser == null) {
return BaseResponse.errorMsg("非系统用户不允许登录!"); return BaseResponse.errorMsg("非系统用户不允许登录!");
...@@ -89,6 +83,8 @@ public class WeiXinService { ...@@ -89,6 +83,8 @@ public class WeiXinService {
sysUser.getName(), sysUser.getPhone()); sysUser.getName(), sysUser.getPhone());
System.out.println(token); System.out.println(token);
redisUtil.setString(sysUser.getId().toString(), token, 3600); redisUtil.setString(sysUser.getId().toString(), token, 3600);
// sysUser.setWxId(UserId);
// userService.updateById(sysUser);
return BaseResponse.okData(token); return BaseResponse.okData(token);
} catch (Exception e) { } catch (Exception e) {
return BaseResponse.errorMsg(e.getMessage()); return BaseResponse.errorMsg(e.getMessage());
...@@ -110,7 +106,7 @@ public class WeiXinService { ...@@ -110,7 +106,7 @@ public class WeiXinService {
if (!redisUtil.existsKey(ACCESS_TOKEN)) { if (!redisUtil.existsKey(ACCESS_TOKEN)) {
String param = "corpid=%s&corpsecret=%s"; 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); JSONObject jsonObject = WeixinInterfaceUtil.doGet(Global.ACCESSTOKENURL, param);
accessToken = jsonObject.getString("access_token"); accessToken = jsonObject.getString("access_token");
redisUtil.setString(ACCESS_TOKEN, accessToken, 7100); redisUtil.setString(ACCESS_TOKEN, accessToken, 7100);
...@@ -174,4 +170,68 @@ public class WeiXinService { ...@@ -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; ...@@ -10,6 +10,23 @@ package cn.wise.sc.cement.business.util.weixin;
public interface Global { 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 * 微信公众平台,获取AccessToken的接口地址,Https请求方式:GET
* 接口地址示例:https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=id&corpsecret=secrect * 接口地址示例:https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=id&corpsecret=secrect
...@@ -35,10 +52,12 @@ public interface Global { ...@@ -35,10 +52,12 @@ public interface Global {
* 微信公众平台,发送应用消息的接口地址,Https请求方式:GET * 微信公众平台,发送应用消息的接口地址,Https请求方式:GET
* 接口地址示例:https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN * 接口地址示例: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"; 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 com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.net.ConnectException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Formatter;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class WeiXinUtil {
private static Logger log = LoggerFactory.getLogger(WeiXinUtil.class);
//微信的请求url
//获取access_token的接口地址(GET) 限200(次/天)
public final static String access_token_url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpId}&corpsecret={corpsecret}";
//获取jsapi_ticket的接口地址(GET) 限200(次/天)
public final static String jsapi_ticket_url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=ACCESSTOKEN";
@Value("${weixin.corpid}")
private String corpid;
@Value("${weixin.corpsecret}")
private String corpsecret;
/**
* 1.发起https请求并获取结果
*
* @param requestUrl 请求地址
* @param requestMethod 请求方式(GET、POST)
* @param outputStr 提交的数据
* @return JSONObject(通过JSONObject.get(key)的方式获取json对象的属性值)
*/
public static JSONObject httpRequest(String requestUrl, String requestMethod, String outputStr) {
JSONObject jsonObject = null;
StringBuffer buffer = new StringBuffer();
try {
// 创建SSLContext对象,并使用我们指定的信任管理器初始化
TrustManager[] tm = { new MyX509TrustManager() };
SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
sslContext.init(null, tm, new java.security.SecureRandom());
// 从上述SSLContext对象中得到SSLSocketFactory对象
SSLSocketFactory ssf = sslContext.getSocketFactory();
URL url = new URL(requestUrl);
HttpsURLConnection httpUrlConn = (HttpsURLConnection) url.openConnection();
httpUrlConn.setSSLSocketFactory(ssf);
httpUrlConn.setDoOutput(true);
httpUrlConn.setDoInput(true);
httpUrlConn.setUseCaches(false);
// 设置请求方式(GET/POST)
httpUrlConn.setRequestMethod(requestMethod);
if ("GET".equalsIgnoreCase(requestMethod))
httpUrlConn.connect();
// 当有数据需要提交时
if (null != outputStr) {
OutputStream outputStream = httpUrlConn.getOutputStream();
// 注意编码格式,防止中文乱码
outputStream.write(outputStr.getBytes("UTF-8"));
outputStream.close();
}
// 将返回的输入流转换成字符串
InputStream inputStream = httpUrlConn.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String str = null;
while ((str = bufferedReader.readLine()) != null) {
buffer.append(str);
}
bufferedReader.close();
inputStreamReader.close();
// 释放资源
inputStream.close();
inputStream = null;
httpUrlConn.disconnect();
// jsonObject = JSONObject.fromObject(buffer.toString());
jsonObject = JSONObject.parseObject(buffer.toString());
} catch (ConnectException ce) {
log.error("Weixin server connection timed out.");
} catch (Exception e) {
log.error("https request error:{}", e);
}
return jsonObject;
}
/**
* 2.发送https请求之获取临时素材
* @param requestUrl
* @param savePath 文件的保存路径,此时还缺一个扩展名
* @return
* @throws Exception
*/
public static File getFile(String requestUrl,String savePath) throws Exception {
//String path=System.getProperty("user.dir")+"/img//1.png";
// 创建SSLContext对象,并使用我们指定的信任管理器初始化
TrustManager[] tm = { new MyX509TrustManager() };
SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
sslContext.init(null, tm, new java.security.SecureRandom());
// 从上述SSLContext对象中得到SSLSocketFactory对象
SSLSocketFactory ssf = sslContext.getSocketFactory();
URL url = new URL(requestUrl);
HttpsURLConnection httpUrlConn = (HttpsURLConnection) url.openConnection();
httpUrlConn.setSSLSocketFactory(ssf);
httpUrlConn.setDoOutput(true);
httpUrlConn.setDoInput(true);
httpUrlConn.setUseCaches(false);
// 设置请求方式(GET/POST)
httpUrlConn.setRequestMethod("GET");
httpUrlConn.connect();
//获取文件扩展名
String ext=getExt(httpUrlConn.getContentType());
savePath=savePath+ext;
System.out.println("savePath"+savePath);
//下载文件到f文件
File file = new File(savePath);
// 获取微信返回的输入流
InputStream in = httpUrlConn.getInputStream();
//输出流,将微信返回的输入流内容写到文件中
FileOutputStream out = new FileOutputStream(file);
int length=100*1024;
byte[] byteBuffer = new byte[length]; //存储文件内容
int byteread =0;
int bytesum=0;
while (( byteread=in.read(byteBuffer)) != -1) {
bytesum += byteread; //字节数 文件大小
out.write(byteBuffer,0,byteread);
}
System.out.println("bytesum: "+bytesum);
in.close();
// 释放资源
out.close();
in = null;
out=null;
httpUrlConn.disconnect();
return file;
}
/**
* @desc :2.微信上传素材的请求方法
*
* @param requestUrl 微信上传临时素材的接口url
* @param file 要上传的文件
* @return String 上传成功后,微信服务器返回的消息
*/
public static String httpRequest(String requestUrl, File file) {
StringBuffer buffer = new StringBuffer();
try{
//1.建立连接
URL url = new URL(requestUrl);
HttpURLConnection httpUrlConn = (HttpURLConnection) url.openConnection(); //打开链接
//1.1输入输出设置
httpUrlConn.setDoInput(true);
httpUrlConn.setDoOutput(true);
httpUrlConn.setUseCaches(false); // post方式不能使用缓存
//1.2设置请求头信息
httpUrlConn.setRequestProperty("Connection", "Keep-Alive");
httpUrlConn.setRequestProperty("Charset", "UTF-8");
//1.3设置边界
String BOUNDARY = "----------" + System.currentTimeMillis();
httpUrlConn.setRequestProperty("Content-Type","multipart/form-data; boundary="+ BOUNDARY);
// 请求正文信息
// 第一部分:
//2.将文件头输出到微信服务器
StringBuilder sb = new StringBuilder();
sb.append("--"); // 必须多两道线
sb.append(BOUNDARY);
sb.append("\r\n");
sb.append("Content-Disposition: form-data;name=\"media\";filelength=\"" + file.length()
+ "\";filename=\""+ file.getName() + "\"\r\n");
sb.append("Content-Type:application/octet-stream\r\n\r\n");
byte[] head = sb.toString().getBytes("utf-8");
// 获得输出流
OutputStream outputStream = new DataOutputStream(httpUrlConn.getOutputStream());
// 将表头写入输出流中:输出表头
outputStream.write(head);
//3.将文件正文部分输出到微信服务器
// 把文件以流文件的方式 写入到微信服务器中
DataInputStream in = new DataInputStream(new FileInputStream(file));
int bytes = 0;
byte[] bufferOut = new byte[1024];
while ((bytes = in.read(bufferOut)) != -1) {
outputStream.write(bufferOut, 0, bytes);
}
in.close();
//4.将结尾部分输出到微信服务器
byte[] foot = ("\r\n--" + BOUNDARY + "--\r\n").getBytes("utf-8");// 定义最后数据分隔线
outputStream.write(foot);
outputStream.flush();
outputStream.close();
//5.将微信服务器返回的输入流转换成字符串
InputStream inputStream = httpUrlConn.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String str = null;
while ((str = bufferedReader.readLine()) != null) {
buffer.append(str);
}
bufferedReader.close();
inputStreamReader.close();
// 释放资源
inputStream.close();
inputStream = null;
httpUrlConn.disconnect();
} catch (IOException e) {
System.out.println("发送POST请求出现异常!" + e);
e.printStackTrace();
}
return buffer.toString();
}
/**
* 2.发起http请求获取返回结果
*
* @param requestUrl 请求地址
* @return
*/
public static String httpRequest(String requestUrl) {
StringBuffer buffer = new StringBuffer();
try {
URL url = new URL(requestUrl);
HttpURLConnection httpUrlConn = (HttpURLConnection) url.openConnection();
httpUrlConn.setDoOutput(false);
httpUrlConn.setDoInput(true);
httpUrlConn.setUseCaches(false);
httpUrlConn.setRequestMethod("GET");
httpUrlConn.connect();
// 将返回的输入流转换成字符串
InputStream inputStream = httpUrlConn.getInputStream();
//InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8");
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String str = null;
while ((str = bufferedReader.readLine()) != null) {
buffer.append(str);
}
bufferedReader.close();
inputStreamReader.close();
// 释放资源
inputStream.close();
inputStream = null;
httpUrlConn.disconnect();
} catch (Exception e) {
}
return buffer.toString();
}
/**
* 3.获取access_token
*
* @param appid 凭证
* @param appsecret 密钥
* @return
*/
public static AccessToken getAccessToken(String appid, String appsecret) {
AccessToken accessToken = null;
String requestUrl = access_token_url.replace("{corpId}", appid).replace("{corpsecret}", appsecret);
JSONObject jsonObject = httpRequest(requestUrl, "GET", null);
// 如果请求成功
if (null != jsonObject) {
try {
accessToken = new AccessToken();
accessToken.setToken(jsonObject.getString("access_token"));
accessToken.setExpiresIn(jsonObject.getInteger("expires_in"));
} catch (JSONException e) {
accessToken = null;
// 获取token失败
log.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInteger("errcode"), jsonObject.getString("errmsg"));
}
}
return accessToken;
}
/**
* 4. 获取JsapiTicket
* @param accessToken
* @return
*/
public static String getJsapiTicket(String accessToken){
String requestUrl = jsapi_ticket_url.replace("ACCESSTOKEN", accessToken);
JSONObject jsonObject = httpRequest(requestUrl, "GET", null);
String jsapi_ticket="";
// 如果请求成功
if (null != jsonObject) {
try {
jsapi_ticket=jsonObject.getString("ticket");
} catch (JSONException e) {
// 获取token失败
log.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInteger("errcode"), jsonObject.getString("errmsg"));
}
}
return jsapi_ticket;
}
/**
* 3.获取企业微信的JSSDK配置信息
* @param request
* @return
*/
public static Map<String, Object> getWxConfig(HttpServletRequest request) {
Map<String, Object> ret = new HashMap<String, Object>();
//1.准备好参与签名的字段
String nonceStr = UUID.randomUUID().toString(); // 必填,生成签名的随机串
//System.out.println("nonceStr:"+nonceStr);
String accessToken=WeiXinUtil.getAccessToken(Global.corpId, Global.agentSecret).getToken();
String jsapi_ticket =getJsapiTicket(accessToken);// 必填,生成签名的H5应用调用企业微信JS接口的临时票据
//System.out.println("jsapi_ticket:"+jsapi_ticket);
String timestamp = Long.toString(System.currentTimeMillis() / 1000); // 必填,生成签名的时间戳
//System.out.println("timestamp:"+timestamp);
String url=request.getRequestURL().toString();
//System.out.println("url:"+url);
//2.字典序 ,注意这里参数名必须全部小写,且必须有序
String sign = "jsapi_ticket=" + jsapi_ticket + "&noncestr=" + nonceStr+ "&timestamp=" + timestamp + "&url=" + url;
//3.sha1签名
String signature = "";
try {
MessageDigest crypt = MessageDigest.getInstance("SHA-1");
crypt.reset();
crypt.update(sign.getBytes("UTF-8"));
signature = byteToHex(crypt.digest());
//System.out.println("signature:"+signature);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
ret.put("appId", Global.corpId);
ret.put("timestamp", timestamp);
ret.put("nonceStr", nonceStr);
ret.put("signature", signature);
return ret;
}
/**
* 方法名:byteToHex</br>
* 详述:字符串加密辅助方法 </br>
* 开发人员:souvc </br>
* 创建时间:2016-1-5 </br>
* @param hash
* @return 说明返回值含义
* @throws
*
*/
private static String byteToHex(final byte[] hash) {
Formatter formatter = new Formatter();
for (byte b : hash) {
formatter.format("%02x", b);
}
String result = formatter.toString();
formatter.close();
return result;
}
private static String getExt(String contentType){
if("image/jpeg".equals(contentType)){
return ".jpg";
}else if("image/png".equals(contentType)){
return ".png";
}else if("image/gif".equals(contentType)){
return ".gif";
}
return null;
}
}
\ No newline at end of file
package cn.wise.sc.cement.business.util.weixin; 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.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.http.*;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.util.*; import java.util.*;
...@@ -16,16 +13,6 @@ import java.util.*; ...@@ -16,16 +13,6 @@ import java.util.*;
*/ */
public class WeixinInterfaceUtil { 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){ public static void main(String[] args){
String param = "corpid=%s&corpsecret=%s"; String param = "corpid=%s&corpsecret=%s";
param = String.format(param, "ww348f91b2573c1867", "gFa_7XvXtCaoeAYERzjRwwz_OTJkJfgBb8weOKjmI3o"); param = String.format(param, "ww348f91b2573c1867", "gFa_7XvXtCaoeAYERzjRwwz_OTJkJfgBb8weOKjmI3o");
...@@ -37,7 +24,6 @@ public class WeixinInterfaceUtil { ...@@ -37,7 +24,6 @@ public class WeixinInterfaceUtil {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static JSONObject doGet(String url, String param) { public static JSONObject doGet(String url, String param) {
...@@ -47,55 +33,5 @@ public class WeixinInterfaceUtil { ...@@ -47,55 +33,5 @@ public class WeixinInterfaceUtil {
return resultMap; 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: ...@@ -7,8 +7,8 @@ spring:
active: dev active: dev
datasource: datasource:
# 192.168.110.85 admin!@#123 # 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://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://81.68.92.175:3306/sinoma_tcdri?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root username: root
password: admin!@#123 password: admin!@#123
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
...@@ -37,8 +37,3 @@ mybatis-plus: ...@@ -37,8 +37,3 @@ mybatis-plus:
check-config-location: true check-config-location: true
type-aliases-package: cn.wise.sc.cement.business.entity.** type-aliases-package: cn.wise.sc.cement.business.entity.**
mapper-locations: classpath:/cn/wise/sc/cement/business/mapper/xml/*Mapper.xml 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