Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
tianjin-cement
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
竹天卫
tianjin-cement
Commits
7f5f784c
Commit
7f5f784c
authored
Nov 29, 2020
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
application.yml 访问链接优化
parent
8c941a2a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
9 deletions
+27
-9
WeiXinController.java
.../wise/sc/cement/business/controller/WeiXinController.java
+19
-5
WeiXinService.java
...n/wise/sc/cement/business/service/impl/WeiXinService.java
+0
-1
Global.java
...n/java/cn/wise/sc/cement/business/util/weixin/Global.java
+5
-0
application.yml
cement-business/src/main/resources/application.yml
+3
-3
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/WeiXinController.java
View file @
7f5f784c
...
...
@@ -3,11 +3,13 @@ package cn.wise.sc.cement.business.controller;
import
cn.hutool.core.util.StrUtil
;
import
cn.wise.sc.cement.business.model.BaseResponse
;
import
cn.wise.sc.cement.business.service.impl.WeiXinService
;
import
cn.wise.sc.cement.business.util.weixin.Global
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
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.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -36,9 +38,9 @@ public class WeiXinController {
log
.
debug
(
"============================================="
);
try
{
//测试服务器
return
weiXinService
.
getTestToken
(
code
);
//
return weiXinService.getTestToken(code);
//正式服务器
//
return weiXinService.getToken(code, "APP");
return
weiXinService
.
getToken
(
code
,
"APP"
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"获取登录token{}"
,
e
);
}
...
...
@@ -50,9 +52,9 @@ public class WeiXinController {
public
BaseResponse
getPCToken
(
String
code
)
{
try
{
//测试服务器
return
weiXinService
.
getTestToken
(
code
);
//
return weiXinService.getTestToken(code);
//正式服务器
//
return weiXinService.getToken(code, "PC");
return
weiXinService
.
getToken
(
code
,
"PC"
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"获取登录token{}"
,
e
);
}
...
...
@@ -129,11 +131,23 @@ public class WeiXinController {
return
s
;
}
@Value
(
"${weixin.systemUrl}"
)
private
String
systemUrl
;
@ApiOperation
(
value
=
"发送消息"
)
@GetMapping
(
"/sendTextMessage"
)
public
BaseResponse
sendTextMessage
()
{
try
{
weiXinService
.
sendTextMessage
(
"1"
,
"hello"
);
//发送企业微信消息内容
String
content
=
"你好!"
+
"竹天卫"
+
"向您申请了一条委托,请前往\n"
+
systemUrl
+
"进行评审。"
;
System
.
out
.
println
(
"**************************content**********************"
);
System
.
out
.
println
(
content
);
weiXinService
.
sendTextMessage
(
"ZhuTianWei"
,
content
);
// weiXinService.sendTextMessage("1","hello");
return
BaseResponse
.
okData
(
"成功"
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"发送消息{}"
,
e
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/WeiXinService.java
View file @
7f5f784c
...
...
@@ -215,7 +215,6 @@ public class WeiXinService {
return
BaseResponse
.
okData
(
loginUser
);
}
/**
* 发送消息
* @param touser 指定接收消息的成员,成员ID列表(多个接收者用‘|’分隔,最多支持1000个)。
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/weixin/Global.java
View file @
7f5f784c
package
cn
.
wise
.
sc
.
cement
.
business
.
util
.
weixin
;
import
org.springframework.beans.factory.annotation.Value
;
/**
* 功能说明:企业微信全局接口地址
* 修改说明:
...
...
@@ -27,6 +29,9 @@ public interface Global {
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>,"
;
public
final
static
String
systemUrlTmp
=
"<a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww348f91b2573c1867&redirect_uri=https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">物化检测流程"
+
"</a>,"
;
/**
* 微信公众平台,获取AccessToken的接口地址,Https请求方式:GET
* 接口地址示例:https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=id&corpsecret=secrect
...
...
cement-business/src/main/resources/application.yml
View file @
7f5f784c
...
...
@@ -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://47.93.148.213: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://47.93.148.213:3306/sinoma_tcdri?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username
:
root
password
:
admin!@#123
driverClassName
:
com.mysql.cj.jdbc.Driver
...
...
@@ -45,7 +45,7 @@ weixin:
agentSecret
:
gFa_7XvXtCaoeAYERzjRwwz_OTJkJfgBb8weOKjmI3o
agentSecretPC
:
itCLYcwl9ggA9VfZam_iz96Ikp9StDFfVr4Adb0yY7A
backUrl
:
https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system
systemUrl
:
<a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid="ww348f91b2573c1867"&redirect_uri="https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system"%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">物化检测流程</a>,
systemUrl
:
'
<a
href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww348f91b2573c1867&redirect_uri=https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect">物化检测流程</a>,'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment