Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-yunqueyilian
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.wechat
pica-cloud-yunqueyilian
提交
889088e3
提交
889088e3
编写于
11月 07, 2018
作者:
yongbo.wang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'release' into 'master'
Release See merge request
!7
上级
61230df8
43e6da05
变更
53
隐藏空白字符变更
内嵌
并排
正在显示
53 个修改的文件
包含
2966 行增加
和
759 行删除
+2966
-759
.gitignore
.gitignore
+1
-1
pom.xml
common/pom.xml
+13
-0
App.java
...n/java/com/pica/cloud/wechat/yunqueyilian.common/App.java
+0
-8
CommonUtils.java
...om/pica/cloud/wechat/yunqueyilian/common/CommonUtils.java
+155
-0
Constants.java
.../com/pica/cloud/wechat/yunqueyilian/common/Constants.java
+53
-0
PicaLogAspectForXml.java
...d/wechat/yunqueyilian/common/aop/PicaLogAspectForXml.java
+147
-0
WeChatConstants.java
...wechat/yunqueyilian/common/constants/WeChatConstants.java
+70
-0
YunQueYiLianResultCode.java
...hat/yunqueyilian/common/enums/YunQueYiLianResultCode.java
+70
-0
BaseMessage.java
...ica/cloud/wechat/yunqueyilian/common/req/BaseMessage.java
+54
-0
TextMessage.java
...ica/cloud/wechat/yunqueyilian/common/req/TextMessage.java
+20
-0
CloudPropertiesUtil.java
.../wechat/yunqueyilian/common/util/CloudPropertiesUtil.java
+51
-0
HttpClientUtil.java
...cloud/wechat/yunqueyilian/common/util/HttpClientUtil.java
+241
-0
MyX509TrustManager.java
...d/wechat/yunqueyilian/common/util/MyX509TrustManager.java
+24
-0
WeChatToolUtil.java
...cloud/wechat/yunqueyilian/common/util/WeChatToolUtil.java
+230
-0
AccessToken.java
...d/wechat/yunqueyilian/common/wechat/pojo/AccessToken.java
+64
-0
BaseEntity.java
...ud/wechat/yunqueyilian/common/wechat/pojo/BaseEntity.java
+61
-0
Button.java
.../cloud/wechat/yunqueyilian/common/wechat/pojo/Button.java
+19
-0
CommonButton.java
.../wechat/yunqueyilian/common/wechat/pojo/CommonButton.java
+38
-0
ComplexButton.java
...wechat/yunqueyilian/common/wechat/pojo/ComplexButton.java
+20
-0
Industry.java
...loud/wechat/yunqueyilian/common/wechat/pojo/Industry.java
+27
-0
JsapiTicket.java
...d/wechat/yunqueyilian/common/wechat/pojo/JsapiTicket.java
+36
-0
Menu.java
...ca/cloud/wechat/yunqueyilian/common/wechat/pojo/Menu.java
+19
-0
SendTemplate.java
.../wechat/yunqueyilian/common/wechat/pojo/SendTemplate.java
+48
-0
Template.java
...loud/wechat/yunqueyilian/common/wechat/pojo/Template.java
+17
-0
TemplateData.java
.../wechat/yunqueyilian/common/wechat/pojo/TemplateData.java
+77
-0
TemplateKeynote.java
...chat/yunqueyilian/common/wechat/pojo/TemplateKeynote.java
+27
-0
User.java
...ca/cloud/wechat/yunqueyilian/common/wechat/pojo/User.java
+163
-0
WSLocation.java
...ud/wechat/yunqueyilian/common/wechat/pojo/WSLocation.java
+60
-0
WSUser.java
.../cloud/wechat/yunqueyilian/common/wechat/pojo/WSUser.java
+178
-0
pom.xml
pom.xml
+15
-21
pom.xml
server/pom.xml
+15
-15
App.java
...n/java/com/pica/cloud/wechat/yunqueyilian/server/App.java
+6
-4
IWechatsServiceClient.java
...hat/yunqueyilian/server/client/IWechatsServiceClient.java
+23
-0
WechatsServiceFailFactory.java
...eyilian/server/client/impl/WechatsServiceFailFactory.java
+37
-0
MyTypeExcludeFilter.java
...unqueyilian/server/configuration/MyTypeExcludeFilter.java
+23
-0
MyTypeExcludeFilterApplicationContextInitializer.java
...ion/MyTypeExcludeFilterApplicationContextInitializer.java
+56
-0
CoreController.java
...wechat/yunqueyilian/server/controller/CoreController.java
+44
-0
DemoController.java
...wechat/yunqueyilian/server/controller/DemoController.java
+0
-73
Hospital.java
...ica/cloud/wechat/yunqueyilian/server/entity/Hospital.java
+0
-265
PWechatUser.java
.../cloud/wechat/yunqueyilian/server/entity/PWechatUser.java
+235
-0
HospitalMapper.java
...oud/wechat/yunqueyilian/server/mapper/HospitalMapper.java
+0
-17
PWechatUserMapper.java
.../wechat/yunqueyilian/server/mapper/PWechatUserMapper.java
+16
-0
CoreService.java
...cloud/wechat/yunqueyilian/server/service/CoreService.java
+17
-0
CoreServiceImpl.java
...hat/yunqueyilian/server/service/impl/CoreServiceImpl.java
+169
-0
MenuManagerServiceImpl.java
...queyilian/server/service/impl/MenuManagerServiceImpl.java
+108
-0
bootstrap-dev.properties
server/src/main/resources/bootstrap-dev.properties
+16
-1
bootstrap-prod.properties
server/src/main/resources/bootstrap-prod.properties
+17
-3
bootstrap-test1.properties
server/src/main/resources/bootstrap-test1.properties
+16
-2
bootstrap-test2.properties
server/src/main/resources/bootstrap-test2.properties
+16
-2
bootstrap-uat.properties
server/src/main/resources/bootstrap-uat.properties
+16
-2
mybatis-generator.xml
server/src/main/resources/mybatis-generator.xml
+6
-4
HospitalMapper.xml
server/src/main/resources/mybatis/HospitalMapper.xml
+0
-341
PWechatUserMapper.xml
server/src/main/resources/mybatis/PWechatUserMapper.xml
+132
-0
未找到文件。
.gitignore
浏览文件 @
889088e3
...
...
@@ -56,7 +56,7 @@ buildNumber.properties
*.ipr
*.bak
/server/src/main/resources/mybatis-generator.xml
# IntelliJ
/out/
...
...
common/pom.xml
浏览文件 @
889088e3
...
...
@@ -21,6 +21,19 @@
<java.version>
1.8
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
dom4j
</groupId>
<artifactId>
dom4j
</artifactId>
<version>
1.6.1
</version>
</dependency>
<dependency>
<groupId>
com.thoughtworks.xstream
</groupId>
<artifactId>
xstream
</artifactId>
<version>
1.3.1
</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>
nexus
</id>
...
...
common/src/main/java/com/pica/cloud/wechat/yunqueyilian.common/App.java
已删除
100644 → 0
浏览文件 @
61230df8
package
com
.
pica
.
cloud
.
wechat
.
common
;
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/CommonUtils.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
;
import
com.pica.cloud.wechat.yunqueyilian.common.req.TextMessage
;
import
com.thoughtworks.xstream.XStream
;
import
com.thoughtworks.xstream.core.util.QuickWriter
;
import
com.thoughtworks.xstream.io.HierarchicalStreamWriter
;
import
com.thoughtworks.xstream.io.xml.PrettyPrintWriter
;
import
com.thoughtworks.xstream.io.xml.XppDriver
;
import
org.dom4j.Document
;
import
org.dom4j.Element
;
import
org.dom4j.io.SAXReader
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.InputStream
;
import
java.io.Writer
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Auther wangyongbo
* @Date 2018/6/8 下午7:10
*/
public
class
CommonUtils
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CommonUtils
.
class
);
/**
* 验证签名
*
* @param signature
* @param timestamp
* @param nonce
* @return
*/
public
static
boolean
checkSignature
(
String
signature
,
String
timestamp
,
String
nonce
)
{
String
[]
arr
=
new
String
[]
{
Constants
.
WECHAT_YQYL_TOKEN
,
timestamp
,
nonce
};
// 将token、timestamp、nonce三个参数进行字典序排序
Arrays
.
sort
(
arr
);
StringBuilder
content
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
arr
.
length
;
i
++)
{
content
.
append
(
arr
[
i
]);
}
MessageDigest
md
=
null
;
String
tmpStr
=
null
;
try
{
md
=
MessageDigest
.
getInstance
(
"SHA-1"
);
// 将三个参数字符串拼接成一个字符串进行sha1加密
byte
[]
digest
=
md
.
digest
(
content
.
toString
().
getBytes
());
tmpStr
=
byteToStr
(
digest
);
}
catch
(
NoSuchAlgorithmException
e
)
{
logger
.
error
(
"异常抛出exception "
,
e
);
}
content
=
null
;
// 将sha1加密后的字符串可与signature对比,标识该请求来源于微信
return
tmpStr
!=
null
?
tmpStr
.
toUpperCase
().
equals
(
signature
.
toUpperCase
())
:
false
;
}
/**
* 将字节数组转换为十六进制字符串
*
* @param byteArray
* @return
*/
private
static
String
byteToStr
(
byte
[]
byteArray
)
{
String
strDigest
=
""
;
for
(
int
i
=
0
;
i
<
byteArray
.
length
;
i
++)
{
strDigest
+=
byteToHexStr
(
byteArray
[
i
]);
}
return
strDigest
;
}
/**
* 将字节转换为十六进制字符串
*
* @param mByte
* @return
*/
private
static
String
byteToHexStr
(
byte
mByte
)
{
char
[]
Digit
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
char
[]
tempArr
=
new
char
[
2
];
tempArr
[
0
]
=
Digit
[(
mByte
>>>
4
)
&
0X0F
];
tempArr
[
1
]
=
Digit
[
mByte
&
0X0F
];
String
s
=
new
String
(
tempArr
);
return
s
;
}
/**
* 解析微信发来的请求(XML)
*
* @param request
* @return
* @throws Exception
*/
public
static
Map
<
String
,
String
>
parseXml
(
HttpServletRequest
request
)
throws
Exception
{
// 将解析结果存储在HashMap中
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
// 从request中取得输入流
InputStream
inputStream
=
request
.
getInputStream
();
// 读取输入流
SAXReader
reader
=
new
SAXReader
();
Document
document
=
reader
.
read
(
inputStream
);
// 得到xml根元素
Element
root
=
document
.
getRootElement
();
// 得到根元素的所有子节点
List
<
Element
>
elementList
=
root
.
elements
();
// 遍历所有子节点
for
(
Element
e
:
elementList
)
map
.
put
(
e
.
getName
(),
e
.
getText
());
// 释放资源
inputStream
.
close
();
inputStream
=
null
;
return
map
;
}
/**
* 扩展xstream,使其支持CDATA块
*
* @date 2014-12-03
*/
private
static
XStream
xstream
=
new
XStream
(
new
XppDriver
()
{
public
HierarchicalStreamWriter
createWriter
(
Writer
out
)
{
return
new
PrettyPrintWriter
(
out
)
{
// 对所有xml节点的转换都增加CDATA标记
boolean
cdata
=
true
;
protected
void
writeText
(
QuickWriter
writer
,
String
text
)
{
if
(
cdata
)
{
writer
.
write
(
"<![CDATA["
);
writer
.
write
(
text
);
writer
.
write
(
"]]>"
);
}
else
{
writer
.
write
(
text
);
}
}
};
}
});
/**
* 文本消息对象转换成xml
*
* @param textMessage 文本消息对象
* @return xml
*/
public
static
String
textMessageToXml
(
TextMessage
textMessage
)
{
xstream
.
alias
(
"xml"
,
textMessage
.
getClass
());
return
xstream
.
toXML
(
textMessage
);
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/Constants.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
;
/**
//考试相关常量
//@author andong
//@create 2018/7/4
*/
@SuppressWarnings
(
"unused"
)
public
class
Constants
{
// 与接口配置信息中的Token要一致
public
static
String
WECHAT_YQYL_TOKEN
=
"tokenPicaHealth"
;
//微信公众号简称
public
static
Integer
WECHAT_NAME_YQYL
=
1
;
//微信类型 1、云鹊医联 5、云鹊健康 10、基层大众版 15、云鹊医 20、基层医生版
//返回消息类型:文本
public
static
final
String
RESP_MESSAGE_TYPE_TEXT
=
"text"
;
//返回消息类型:音乐
public
static
final
String
RESP_MESSAGE_TYPE_MUSIC
=
"music"
;
//返回消息类型:图文
public
static
final
String
RESP_MESSAGE_TYPE_NEWS
=
"news"
;
//请求消息类型:文本
public
static
final
String
REQ_MESSAGE_TYPE_TEXT
=
"text"
;
//请求消息类型:图片
public
static
final
String
REQ_MESSAGE_TYPE_IMAGE
=
"image"
;
//请求消息类型:链接
public
static
final
String
REQ_MESSAGE_TYPE_LINK
=
"link"
;
//请求消息类型:地理位置
public
static
final
String
REQ_MESSAGE_TYPE_LOCATION
=
"location"
;
//请求消息类型:音频
public
static
final
String
REQ_MESSAGE_TYPE_VOICE
=
"voice"
;
//请求消息类型:推送
public
static
final
String
REQ_MESSAGE_TYPE_EVENT
=
"event"
;
//事件类型:subscribe(订阅)
public
static
final
String
EVENT_TYPE_SUBSCRIBE
=
"subscribe"
;
//事件类型:unsubscribe(取消订阅)
public
static
final
String
EVENT_TYPE_UNSUBSCRIBE
=
"unsubscribe"
;
//事件类型:CLICK(自定义菜单点击事件)
public
static
final
String
EVENT_TYPE_CLICK
=
"CLICK"
;
//事件类型:VIEW(自定义菜单点击事件)
public
static
final
String
EVENT_TYPE_VIEW
=
"VIEW"
;
//事件类型:LOCATION(自定义菜单点击事件)
public
static
final
String
EVENT_TYPE_LOCATION
=
"LOCATION"
;
//事件类型:LOCATION_SELECT(自定义菜单点击事件)
public
static
final
String
EVENT_TYPE_LOCATION_SELECT
=
"LOCATION_SELECT"
;
//事件类型:SCAN(扫描二维码事件)
public
static
final
String
EVENT_TYPE_SCAN
=
"SCAN"
;
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/aop/PicaLogAspectForXml.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
aop
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
com.pica.cloud.foundation.utils.utils.StringUtil
;
import
org.apache.commons.fileupload.servlet.ServletFileUpload
;
import
org.apache.commons.io.IOUtils
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.dom4j.Element
;
import
org.dom4j.io.SAXReader
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author: zhehao.chen
* @version: V1.0
* @Description:
* @date: 2018/8/21 10:55
*/
@Aspect
@Component
public
class
PicaLogAspectForXml
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PicaLogAspectForXml
.
class
);
ThreadLocal
<
Long
>
startTime
=
new
ThreadLocal
();
ThreadLocal
<
HttpServletRequest
>
request
=
new
ThreadLocal
();
ThreadLocal
<
String
>
contentType
=
new
ThreadLocal
();
@Pointcut
(
"execution(public * com.pica.cloud..*Controller.*(..))"
)
public
void
weblog
()
{
}
@Around
(
"weblog()"
)
public
Object
doAround
(
ProceedingJoinPoint
pjp
)
throws
Throwable
{
RequestAttributes
ra
=
RequestContextHolder
.
getRequestAttributes
();
ServletRequestAttributes
sra
=
(
ServletRequestAttributes
)
ra
;
HttpServletRequest
request
=
sra
.
getRequest
();
this
.
request
.
set
(
request
);
this
.
contentType
.
set
(
StringUtil
.
isNotNull
(
request
.
getHeader
(
"Content-Type"
))
?
request
.
getHeader
(
"Content-Type"
)
:
""
);
String
url
=
request
.
getRequestURL
().
toString
();
String
method
=
request
.
getMethod
();
String
uri
=
request
.
getRequestURI
();
String
queryString
;
if
(
"GET"
.
equalsIgnoreCase
(
method
))
{
queryString
=
request
.
getQueryString
();
}
else
if
(!
this
.
parseMultipart
())
{
Gson
g
=
new
Gson
();
queryString
=
g
.
toJson
(
this
.
getBeanFromJsonBody
());
}
else
{
queryString
=
""
;
}
this
.
startTime
.
set
(
System
.
currentTimeMillis
());
logger
.
info
(
"request start, controller params==>, url: {}, method: {}, uri: {}, params: {}"
,
new
Object
[]{
url
,
method
,
uri
,
queryString
});
Object
result
=
pjp
.
proceed
();
String
res
=
""
;
if
(
"text/xml"
.
equals
(
this
.
contentType
.
get
()))
{
if
(
StringUtil
.
isNotNull
(
result
))
{
res
=
result
.
toString
();
}
}
else
{
Gson
gson
=
new
Gson
();
res
=
gson
.
toJson
(
result
);
}
logger
.
info
(
"request spent time milliSeconds ==>"
+
(
System
.
currentTimeMillis
()
-
(
Long
)
this
.
startTime
.
get
()));
if
(
this
.
parseMultipart
())
{
res
=
"upload/download"
;
}
logger
.
info
(
"request over,controller result ==> "
+
res
);
return
result
;
}
protected
Map
<
String
,
Object
>
getBeanFromJsonBody
()
throws
Exception
{
if
(
"text/xml"
.
equals
(
this
.
contentType
.
get
()))
{
// 读取输入流
SAXReader
reader
=
new
SAXReader
();
org
.
dom4j
.
Document
document
=
reader
.
read
(
this
.
request
.
get
().
getInputStream
());
// 得到xml根元素
Element
root
=
document
.
getRootElement
();
List
<
Element
>
elementList
=
root
.
elements
();
// 遍历所有子节点
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
for
(
Element
e
:
elementList
)
map
.
put
(
e
.
getName
(),
e
.
getText
());
return
map
;
}
else
{
Gson
gson
=
new
Gson
();
return
(
Map
)
gson
.
fromJson
(
IOUtils
.
toString
(
new
InputStreamReader
(((
HttpServletRequest
)
this
.
request
.
get
()).
getInputStream
(),
"utf-8"
)),
(
new
TypeToken
<
Map
<
String
,
Object
>>()
{
}).
getType
());
}
}
protected
boolean
parseMultipart
()
throws
Exception
{
return
ServletFileUpload
.
isMultipartContent
((
HttpServletRequest
)
this
.
request
.
get
());
}
public
static
String
getBodyString
(
BufferedReader
br
)
{
String
str
=
""
;
try
{
String
inputLine
;
while
((
inputLine
=
br
.
readLine
())
!=
null
)
{
str
=
str
+
inputLine
;
}
br
.
close
();
}
catch
(
IOException
var4
)
{
System
.
out
.
println
(
"IOException: "
+
var4
);
}
return
str
;
}
public
static
String
getHeaderString
(
HttpServletRequest
request
)
{
JSONObject
jsonObject
=
new
JSONObject
();
Enumeration
enu
=
request
.
getHeaderNames
();
String
str
;
while
(
enu
.
hasMoreElements
())
{
str
=
(
String
)
enu
.
nextElement
();
String
headerValue
=
request
.
getHeader
(
str
);
jsonObject
.
put
(
str
,
headerValue
);
System
.
out
.
println
(
str
+
":"
+
headerValue
);
}
str
=
jsonObject
.
toJSONString
();
return
str
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/constants/WeChatConstants.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
constants
;
import
com.pica.cloud.wechat.yunqueyilian.common.util.CloudPropertiesUtil
;
public
class
WeChatConstants
{
public
static
String
WECHAT_URL
=
CloudPropertiesUtil
.
getValue
(
"wechat_url"
);
// 第三方用户唯一凭证
public
static
String
APP_ID
=
CloudPropertiesUtil
.
getValue
(
"AppID"
);
// 第三方用户唯一凭证密钥
public
static
String
APP_SECRET
=
CloudPropertiesUtil
.
getValue
(
"AppSecret"
);
// 与接口配置信息中的Token要一致
public
static
String
TOKEN
=
"tokenPicaHealth"
;
public
static
String
EncodingAESKey
=
"5MXFOzFXcoA4t6tUIOP8C0N19NyWZIDiuKXKBRvUBEN"
;
/** access_token过期时间 */
public
static
int
EXPIRES_PERIOD_DATE
=
7200
;
// 获取access_token的接口地址(GET) 限200(次/天)
public
final
static
String
ACCESS_TOKEN_URL
=
"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET"
;
// 菜单创建(POST) 限100(次/天)
public
static
String
MENU_CREATE_URL
=
"https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN"
;
// 通过code获取openid、access_token信息
public
static
String
AUTH_ACCESS_TOKEN_URL
=
"https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code"
;
// 检验授权凭证(access_token)是否有效
public
static
String
VERIFY_AUTH_ACCESS_TOKEN_URL
=
"https://api.weixin.qq.com/sns/auth?access_token=ACCESS_TOKEN&openid=OPENID"
;
// 获取用户的基本信息
public
static
String
GET_USER_INFO_URL
=
"https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN"
;
/** 网页授权 拉取用户信息(需scope为 snsapi_userinfo) */
public
static
final
String
GET_SNS_USER_INFO_URL
=
"https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN "
;
// 检验授权凭证(access_token)是否有效
public
static
String
VERIFY_SNS_USER_INFO_URL
=
"https://api.weixin.qq.com/sns/auth?access_token=ACCESS_TOKEN&openid=OPENID"
;
// 获取签名算法
public
static
String
GET_JSAPI_TICKET
=
"https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi"
;
/** 设置模版消息所属行业 */
public
static
String
GET_INDUSTRY
=
"https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token=ACCESS_TOKEN"
;
/** 获取设置的行业信息 */
public
static
String
API_SET_INDUSTRY
=
"https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=ACCESS_TOKEN"
;
/** 获得模板ID */
public
static
String
API_ADD_TEMPLATE
=
"https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=ACCESS_TOKEN"
;
/** 获取模板列表 */
public
static
String
GET_ALL_PRIVATE_TEMPLATE
=
"https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=ACCESS_TOKEN"
;
/** 发送模版消息 */
public
static
String
SEND_TEMPLATE
=
"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN"
;
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/enums/YunQueYiLianResultCode.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
enums
;
/**
* @Auther chenzhehao
* @Date 2018/8/10 下午1:54
* 云鹊医联微服务 204501-205000
*/
public
enum
YunQueYiLianResultCode
{
XXXX
(
""
,
""
);
private
String
code
;
private
String
message
;
private
YunQueYiLianResultCode
(
String
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
String
code
()
{
return
this
.
code
;
}
public
String
message
()
{
return
this
.
message
;
}
public
static
String
getMessage
(
String
name
)
{
YunQueYiLianResultCode
[]
var1
=
values
();
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
YunQueYiLianResultCode
item
=
var1
[
var3
];
if
(
item
.
name
().
equals
(
name
))
{
return
item
.
message
;
}
}
return
name
;
}
public
static
String
getCode
(
String
name
)
{
YunQueYiLianResultCode
[]
var1
=
values
();
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
YunQueYiLianResultCode
item
=
var1
[
var3
];
if
(
item
.
name
().
equals
(
name
))
{
return
item
.
code
;
}
}
return
null
;
}
public
static
YunQueYiLianResultCode
parse
(
String
code
)
{
YunQueYiLianResultCode
[]
var1
=
values
();
int
var2
=
var1
.
length
;
for
(
int
var3
=
0
;
var3
<
var2
;
++
var3
)
{
YunQueYiLianResultCode
result
=
var1
[
var3
];
if
(
result
.
code
().
equals
(
code
))
{
return
result
;
}
}
return
null
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/req/BaseMessage.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
req
;
/**
* 消息基类(公众帐号 -> 普通用户)
*
* @author bo.dang
* @date 2014-12-03
*/
public
class
BaseMessage
{
// 接收方帐号(收到的OpenID)
private
String
ToUserName
;
// 开发者微信号
private
String
FromUserName
;
// 消息创建时间 (整型)
private
long
CreateTime
;
// 消息类型(text/music/news)
private
String
MsgType
;
// 位0x0001被标志时,星标刚收到的消息
//private int FuncFlag;
public
String
getToUserName
()
{
return
ToUserName
;
}
public
void
setToUserName
(
String
toUserName
)
{
ToUserName
=
toUserName
;
}
public
String
getFromUserName
()
{
return
FromUserName
;
}
public
void
setFromUserName
(
String
fromUserName
)
{
FromUserName
=
fromUserName
;
}
public
long
getCreateTime
()
{
return
CreateTime
;
}
public
void
setCreateTime
(
long
createTime
)
{
CreateTime
=
createTime
;
}
public
String
getMsgType
()
{
return
MsgType
;
}
public
void
setMsgType
(
String
msgType
)
{
MsgType
=
msgType
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/req/TextMessage.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
req
;
/**
* 文本消息
*
* @author bo.dang
* @date 2014-12-03
*/
public
class
TextMessage
extends
BaseMessage
{
// 回复的消息内容
private
String
Content
;
public
String
getContent
()
{
return
Content
;
}
public
void
setContent
(
String
content
)
{
Content
=
content
;
}
}
\ No newline at end of file
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/util/CloudPropertiesUtil.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
util
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Properties
;
/**
* @author: zhehao.chen
* @version: V1.0
* @Description:
* @date: 2018/8/13 9:57
*/
public
class
CloudPropertiesUtil
{
private
static
Properties
proper
=
new
Properties
();
public
CloudPropertiesUtil
()
{
}
public
static
void
read
(
String
env
)
throws
IOException
{
if
(
env
.
equals
(
"dev"
))
{
load
(
"bootstrap-dev.properties"
);
}
else
if
(
env
.
equals
(
"test1"
))
{
load
(
"bootstrap-test1.properties"
);
}
else
if
(
env
.
equals
(
"test2"
))
{
load
(
"bootstrap-test2.properties"
);
}
else
if
(
env
.
equals
(
"uat"
))
{
load
(
"bootstrap-uat.properties"
);
}
else
if
(
env
.
equals
(
"pro"
))
{
load
(
"bootstrap-prod.properties"
);
}
}
public
static
void
load
(
String
file
)
throws
IOException
{
InputStream
stream
=
Thread
.
currentThread
().
getContextClassLoader
().
getResourceAsStream
(
file
);
proper
.
load
(
stream
);
}
public
static
String
getValue
(
String
key
)
{
return
proper
.
getProperty
(
key
);
}
public
static
Integer
getIntValue
(
String
key
)
{
return
Integer
.
valueOf
(
proper
.
getProperty
(
key
));
}
public
static
void
updateProperties
(
String
key
,
String
value
)
{
proper
.
setProperty
(
key
,
value
);
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/util/HttpClientUtil.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
util
;
import
com.alibaba.fastjson.JSON
;
import
net.sf.json.JSONObject
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpStatus
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.ContentType
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
;
import
org.apache.http.util.EntityUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.*
;
import
java.net.ConnectException
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.Map
;
/**
* @ClassName:HttpclientUtil.java
* @Description: Httpclient处理类
* @author bo.dang
* @date 2016年1月26日 下午2:45:52
* @version V1.0
*/
public
class
HttpClientUtil
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
HttpClientUtil
.
class
);
private
static
final
CloseableHttpClient
hc
;
static
{
PoolingHttpClientConnectionManager
cm
=
new
PoolingHttpClientConnectionManager
();
cm
.
setDefaultMaxPerRoute
(
20
);
cm
.
setMaxTotal
(
200
);
hc
=
HttpClients
.
custom
().
setConnectionManager
(
cm
).
build
();
}
public
static
int
postForm
(
String
url
,
Map
<
String
,
String
>
params
,
HttpEntity
entity
)
throws
IOException
{
HttpPost
post
=
new
HttpPost
(
url
);
for
(
Map
.
Entry
<
String
,
String
>
param
:
params
.
entrySet
())
{
post
.
setHeader
(
param
.
getKey
(),
param
.
getValue
());
}
post
.
setEntity
(
entity
);
CloseableHttpResponse
resp
=
null
;
try
{
resp
=
hc
.
execute
(
post
);
return
resp
.
getStatusLine
().
getStatusCode
();
}
catch
(
Exception
e
){
logger
.
error
(
"异常抛出exception "
,
e
);
}
finally
{
if
(
resp
!=
null
)
{
try
{
resp
.
close
();
}
catch
(
IOException
e1
)
{
logger
.
error
(
"异常抛出exception "
,
e1
);
}
}
}
return
0
;
}
public
static
String
httpExecute
(
String
url
,
String
data
){
String
result
=
""
;
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
httpClient
=
HttpClients
.
createDefault
();
HttpPost
postRequest
=
new
HttpPost
(
url
);
postRequest
.
setHeader
(
"Content-Type"
,
"application/json;charset=utf-8"
);
postRequest
.
setHeader
(
"Accept"
,
"application/json"
);
//StringEntity input = new StringEntity("{\"token\":\"08b7377d22a88a8951e66ce97f4a06f6\"}");
StringEntity
input
=
new
StringEntity
(
data
,
ContentType
.
APPLICATION_JSON
);
logger
.
info
(
"data:"
+
data
);
postRequest
.
setEntity
(
input
);
response
=
httpClient
.
execute
(
postRequest
);
if
(
response
.
getStatusLine
().
getStatusCode
()
!=
201
)
{
int
statusCode
=
response
.
getStatusLine
().
getStatusCode
();
if
(
statusCode
==
HttpStatus
.
SC_OK
)
{
result
=
EntityUtils
.
toString
(
response
.
getEntity
(),
"utf-8"
);
}
else
{
logger
.
warn
(
"调用失败,param:{}, result:{}"
,
JSON
.
toJSONString
(
data
),
JSON
.
toJSONString
(
response
));
}
}
logger
.
info
(
"response:"
+
response
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取session出错:"
+
e
);
}
finally
{
try
{
if
(
response
!=
null
)
{
response
.
close
();
}
}
catch
(
Exception
e
){
logger
.
warn
(
"CloseableHttpResponse关闭异常"
);
}
}
return
result
;
}
public
static
String
httpExecute
(
String
url
,
String
data
,
Map
map
){
String
result
=
""
;
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
httpClient
=
HttpClients
.
createDefault
();
HttpPost
postRequest
=
new
HttpPost
(
url
);
postRequest
.
setHeader
(
"Content-Type"
,
"application/json;charset=utf-8"
);
postRequest
.
setHeader
(
"Accept"
,
"application/json"
);
StringEntity
input
=
new
StringEntity
(
data
,
ContentType
.
APPLICATION_JSON
);
logger
.
warn
(
"{}-{} data:{}"
,
map
.
get
(
"module"
),
map
.
get
(
"type"
),
data
);
postRequest
.
setEntity
(
input
);
response
=
httpClient
.
execute
(
postRequest
);
if
(
response
.
getStatusLine
().
getStatusCode
()
!=
201
)
{
int
statusCode
=
response
.
getStatusLine
().
getStatusCode
();
if
(
statusCode
==
HttpStatus
.
SC_OK
)
{
result
=
EntityUtils
.
toString
(
response
.
getEntity
(),
"utf-8"
);
}
else
{
logger
.
warn
(
"{}-{} 调用失败,param:{}, result:{}"
,
map
.
get
(
"module"
),
map
.
get
(
"type"
),
JSON
.
toJSONString
(
data
),
JSON
.
toJSONString
(
response
));
}
}
logger
.
warn
(
"{}-{} response:{}"
,
map
.
get
(
"module"
),
map
.
get
(
"type"
),
JSON
.
toJSONString
(
response
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"{}-{} 获取session出错:"
,
map
.
get
(
"module"
),
map
.
get
(
"type"
),
e
);
}
finally
{
try
{
if
(
response
!=
null
)
{
response
.
close
();
}
}
catch
(
Exception
e
){
logger
.
warn
(
"{}-{} CloseableHttpResponse关闭异常"
,
map
.
get
(
"module"
),
map
.
get
(
"type"
),
e
);
}
}
return
result
;
}
/**
* 发起http请求并获取结果
*
* @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
();
HttpURLConnection
httpUrlConn
=
null
;
BufferedReader
bufferedReader
=
null
;
InputStream
inputStream
=
null
;
InputStreamReader
inputStreamReader
=
null
;
try
{
URL
url
=
new
URL
(
requestUrl
);
httpUrlConn
=
(
HttpURLConnection
)
url
.
openConnection
();
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
=
httpUrlConn
.
getInputStream
();
inputStreamReader
=
new
InputStreamReader
(
inputStream
,
"utf-8"
);
bufferedReader
=
new
BufferedReader
(
inputStreamReader
);
String
str
=
null
;
while
((
str
=
bufferedReader
.
readLine
())
!=
null
)
{
buffer
.
append
(
str
);
}
logger
.
info
(
buffer
.
toString
());
jsonObject
=
JSONObject
.
fromObject
(
buffer
.
toString
());
}
catch
(
ConnectException
ce
)
{
logger
.
error
(
"Weixin server connection timed out."
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"https request error:{}"
,
e
);
}
finally
{
try
{
if
(
bufferedReader
!=
null
){
bufferedReader
.
close
();
}
if
(
inputStreamReader
!=
null
)
{
inputStreamReader
.
close
();
}
if
(
inputStream
!=
null
)
{
inputStream
.
close
();
}
if
(
httpUrlConn
!=
null
)
{
httpUrlConn
.
disconnect
();
}
}
catch
(
Exception
e
){
logger
.
warn
(
"httpUrlConn关闭异常"
);
}
}
return
jsonObject
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/util/MyX509TrustManager.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
util
;
import
javax.net.ssl.X509TrustManager
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
/**
* 证书信任管理器(用于https请求)
*
* @author bo.dang
* @date 2014-12-04
*/
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
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/util/WeChatToolUtil.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
util
;
import
com.pica.cloud.foundation.utils.utils.JsonUtil
;
import
com.pica.cloud.foundation.utils.utils.StringUtil
;
import
com.pica.cloud.foundation.utils.utils.date.DateTimeUtils
;
import
com.pica.cloud.wechat.yunqueyilian.common.constants.WeChatConstants
;
import
com.pica.cloud.wechat.yunqueyilian.common.wechat.pojo.AccessToken
;
import
com.pica.cloud.wechat.yunqueyilian.common.wechat.pojo.JsapiTicket
;
import
com.pica.cloud.wechat.yunqueyilian.common.wechat.pojo.Menu
;
import
net.sf.json.JSONException
;
import
net.sf.json.JSONObject
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.net.ssl.HttpsURLConnection
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.SSLSocketFactory
;
import
javax.net.ssl.TrustManager
;
import
java.io.BufferedReader
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.net.ConnectException
;
import
java.net.URL
;
import
java.util.Date
;
/**
* 公众平台通用接口工具类
*
* @author bo.dang
* @date 2013-08-09
*/
public
class
WeChatToolUtil
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
WeChatToolUtil
.
class
);
/**
* access_token
*/
public
static
String
access_token
;
public
static
AccessToken
accessToken
;
/**
* 获取access_token的时间
*/
public
static
Date
get_access_token_time
;
/**
* 权限签名
*/
public
static
JsapiTicket
jsapiTicket
=
null
;
/**
* 发起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
();
logger
.
info
(
buffer
.
toString
());
jsonObject
=
JSONObject
.
fromObject
(
buffer
.
toString
());
}
catch
(
ConnectException
ce
)
{
logger
.
error
(
"Weixin server connection timed out."
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"https request error:{}"
,
e
);
}
return
jsonObject
;
}
/**
* 获取access_token
*
* @param appid 凭证
* @param appsecret 密钥
* @return
*/
public
static
AccessToken
getAccessToken
(
String
appid
,
String
appsecret
)
{
AccessToken
accessToken
=
null
;
String
requestUrl
=
WeChatConstants
.
ACCESS_TOKEN_URL
.
replace
(
"APPID"
,
appid
).
replace
(
"APPSECRET"
,
appsecret
);
JSONObject
jsonObject
=
httpRequest
(
requestUrl
,
"GET"
,
null
);
// 如果请求成功
if
(
null
!=
jsonObject
)
{
try
{
access_token
=
jsonObject
.
getString
(
"access_token"
);
if
(!
StringUtil
.
isEmpty
(
access_token
))
{
get_access_token_time
=
new
Date
();
accessToken
=
JsonUtil
.
toGsonBean
(
jsonObject
.
toString
(),
AccessToken
.
class
);
logger
.
info
(
"获取token成功 accessToken:{}"
,
jsonObject
.
toString
());
}
else
{
get_access_token_time
=
new
Date
();
logger
.
error
(
"获取token失败 errcode:{} errmsg:{}"
,
jsonObject
.
getInt
(
"errcode"
),
jsonObject
.
getString
(
"errmsg"
));
}
}
catch
(
JSONException
e
)
{
accessToken
=
null
;
// 获取token失败
logger
.
error
(
"获取token失败 errcode:{} errmsg:{}"
,
jsonObject
.
getInt
(
"errcode"
),
jsonObject
.
getString
(
"errmsg"
));
}
}
else
{
// 获取token失败
logger
.
error
(
"获取token失败 errcode:{} errmsg:{}"
,
jsonObject
.
getInt
(
"errcode"
),
jsonObject
.
getString
(
"errmsg"
));
}
WeChatToolUtil
.
accessToken
=
accessToken
;
return
accessToken
;
}
/**
* 校验accessToken是否过期
*
* @param access_token
* @return
*/
public
static
AccessToken
checkAccessToken
(
String
access_token
)
{
AccessToken
accessToken
=
WeChatToolUtil
.
accessToken
;
if
(
WeChatToolUtil
.
isExpired
()
||
StringUtil
.
isEmpty
(
access_token
))
{
logger
.
info
(
"access_token已过期,重新获取 start"
);
accessToken
=
WeChatToolUtil
.
getAccessToken
(
WeChatConstants
.
APP_ID
,
WeChatConstants
.
APP_SECRET
);
}
return
accessToken
;
}
/**
* 获得jsapi_ticket
*
* @return
*/
public
static
JsapiTicket
getJsapi_ticket
()
{
String
requestUrl
=
WeChatConstants
.
GET_JSAPI_TICKET
.
replace
(
"ACCESS_TOKEN"
,
access_token
);
JSONObject
jsonObject
=
httpRequest
(
requestUrl
,
"GET"
,
null
);
JsapiTicket
jsapiTicket
=
null
;
if
(
StringUtil
.
isNotNull
(
jsonObject
))
{
jsapiTicket
=
JsonUtil
.
toGsonBean
(
jsonObject
.
toString
(),
JsapiTicket
.
class
);
}
return
jsapiTicket
;
}
/**
* 创建菜单
*
* @param menu 菜单实例
* @param accessToken 有效的access_token
* @return 0表示成功,其他值表示失败
*/
public
static
Boolean
createMenu
(
Menu
menu
,
String
accessToken
)
{
Boolean
flag
=
true
;
// 拼装创建菜单的url
String
url
=
WeChatConstants
.
MENU_CREATE_URL
.
replace
(
"ACCESS_TOKEN"
,
accessToken
);
// 将菜单对象转换成json字符串
String
jsonMenu
=
JSONObject
.
fromObject
(
menu
).
toString
();
// 调用接口创建菜单
JSONObject
jsonObject
=
httpRequest
(
url
,
"POST"
,
jsonMenu
);
if
(
null
!=
jsonObject
)
{
if
(
0
!=
jsonObject
.
getInt
(
"errcode"
))
{
flag
=
false
;
logger
.
error
(
"创建菜单失败 errcode:{} errmsg:{}"
,
jsonObject
.
getInt
(
"errcode"
),
jsonObject
.
getString
(
"errmsg"
));
}
else
{
logger
.
info
(
"创建菜单成功! errcode:{} errmsg:{}"
,
jsonObject
.
getInt
(
"errcode"
),
jsonObject
.
getString
(
"errmsg"
));
}
}
return
flag
;
}
/**
* 判断access_token是否过期
*/
public
static
Boolean
isExpired
()
{
if
(
null
!=
get_access_token_time
)
{
logger
.
info
(
"判断access_token是否过期 get_access_token_time:{} currentTime:{}"
,
DateTimeUtils
.
DateTimeFormater
.
format
(
get_access_token_time
),
DateTimeUtils
.
currentDateTime
());
return
DateTimeUtils
.
compare2Date
(
new
Date
(),
DateTimeUtils
.
addDateSeconds
(
get_access_token_time
,
(
7200
-
60
)
*
1000
));
}
else
{
return
true
;
}
}
}
\ No newline at end of file
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/AccessToken.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
/**
* 微信通用接口凭证
*
* @author bo.dang
* @date 2014-12-04
*/
public
class
AccessToken
{
/** 获取到的凭证 */
private
String
access_token
;
/** 凭证有效时间,单位:秒 */
private
int
expires_in
;
/** 用户刷新access_token */
private
String
refresh_token
;
/** 用户唯一标识,请注意,在未关注公众号时,用户访问公众号的网页,也会产生一个用户和公众号唯一的OpenID */
private
String
openid
;
/** 用户授权的作用域,使用逗号(,)分隔 */
private
String
scope
;
/**
* @return the access_token
*/
public
String
getAccess_token
()
{
return
access_token
;
}
/**
* @param access_token the access_token to set
*/
public
void
setAccess_token
(
String
access_token
)
{
this
.
access_token
=
access_token
;
}
/**
* @return the expires_in
*/
public
int
getExpires_in
()
{
return
expires_in
;
}
/**
* @param expires_in the expires_in to set
*/
public
void
setExpires_in
(
int
expires_in
)
{
this
.
expires_in
=
expires_in
;
}
public
String
getRefresh_token
()
{
return
refresh_token
;
}
public
void
setRefresh_token
(
String
refresh_token
)
{
this
.
refresh_token
=
refresh_token
;
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
public
String
getScope
()
{
return
scope
;
}
public
void
setScope
(
String
scope
)
{
this
.
scope
=
scope
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/BaseEntity.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
import
com.pica.cloud.foundation.utils.utils.date.DateAdapter
;
import
javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter
;
import
java.util.Date
;
/**
* Created by wangxinxu on 16/9/25.
*/
public
class
BaseEntity
{
private
Integer
delete_flag
;
private
Integer
creat_id
;
@XmlJavaTypeAdapter
(
DateAdapter
.
class
)
protected
Date
creat_time
;
private
Integer
modify_id
;
@XmlJavaTypeAdapter
(
DateAdapter
.
class
)
protected
Date
modify_time
;
public
Integer
getDelete_flag
()
{
return
delete_flag
;
}
public
void
setDelete_flag
(
Integer
delete_flag
)
{
this
.
delete_flag
=
delete_flag
;
}
public
Integer
getCreat_id
()
{
return
creat_id
;
}
public
void
setCreat_id
(
Integer
creat_id
)
{
this
.
creat_id
=
creat_id
;
}
public
Date
getCreat_time
()
{
return
creat_time
;
}
public
void
setCreat_time
(
Date
creat_time
)
{
this
.
creat_time
=
creat_time
;
}
public
Integer
getModify_id
()
{
return
modify_id
;
}
public
void
setModify_id
(
Integer
modify_id
)
{
this
.
modify_id
=
modify_id
;
}
public
Date
getModify_time
()
{
return
modify_time
;
}
public
void
setModify_time
(
Date
modify_time
)
{
this
.
modify_time
=
modify_time
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/Button.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
/**
* 按钮的基类
*
* @author bo.dang
* @date 2014-12-04
*/
public
class
Button
{
private
String
name
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/CommonButton.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
/**
* 普通按钮(子按钮)
*
* @author bo.dang
* @date 2014-12-04
*/
public
class
CommonButton
extends
Button
{
private
String
type
;
private
String
key
;
private
String
url
;
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/ComplexButton.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
/**
* 复杂按钮(父按钮)
*
* @author bo.dang
* @date 2014-12-04
*/
public
class
ComplexButton
extends
Button
{
private
Button
[]
sub_button
;
public
Button
[]
getSub_button
()
{
return
sub_button
;
}
public
void
setSub_button
(
Button
[]
sub_button
)
{
this
.
sub_button
=
sub_button
;
}
}
\ No newline at end of file
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/Industry.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
/**
* Created by Vino on 2016/12/22.
*/
public
class
Industry
{
private
String
industry_id1
;
private
String
industry_id2
;
public
String
getIndustry_id1
()
{
return
industry_id1
;
}
public
void
setIndustry_id1
(
String
industry_id1
)
{
this
.
industry_id1
=
industry_id1
;
}
public
String
getIndustry_id2
()
{
return
industry_id2
;
}
public
void
setIndustry_id2
(
String
industry_id2
)
{
this
.
industry_id2
=
industry_id2
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/JsapiTicket.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
public
class
JsapiTicket
{
/** 状态码 */
private
Integer
errcode
;
/** 状态 */
private
String
errmsg
;
/** 签名 */
private
String
ticket
;
/** 有效期 */
private
Integer
expires_in
;
public
Integer
getErrcode
()
{
return
errcode
;
}
public
void
setErrcode
(
Integer
errcode
)
{
this
.
errcode
=
errcode
;
}
public
String
getErrmsg
()
{
return
errmsg
;
}
public
void
setErrmsg
(
String
errmsg
)
{
this
.
errmsg
=
errmsg
;
}
public
String
getTicket
()
{
return
ticket
;
}
public
void
setTicket
(
String
ticket
)
{
this
.
ticket
=
ticket
;
}
public
Integer
getExpires_in
()
{
return
expires_in
;
}
public
void
setExpires_in
(
Integer
expires_in
)
{
this
.
expires_in
=
expires_in
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/Menu.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
/**
* 菜单
*
* @author bo.dang
* @date 2014-12-04
*/
public
class
Menu
{
private
Button
[]
button
;
public
Button
[]
getButton
()
{
return
button
;
}
public
void
setButton
(
Button
[]
button
)
{
this
.
button
=
button
;
}
}
\ No newline at end of file
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/SendTemplate.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
/**
* Created by Vino on 2016/12/22.
*/
public
class
SendTemplate
{
private
String
touser
;
private
String
template_id
;
private
String
url
;
private
TemplateData
data
;
public
String
getTouser
()
{
return
touser
;
}
public
void
setTouser
(
String
touser
)
{
this
.
touser
=
touser
;
}
public
String
getTemplate_id
()
{
return
template_id
;
}
public
void
setTemplate_id
(
String
template_id
)
{
this
.
template_id
=
template_id
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
TemplateData
getData
()
{
return
data
;
}
public
void
setData
(
TemplateData
data
)
{
this
.
data
=
data
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/Template.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
/**
* Created by Vino on 2016/12/22.
*/
public
class
Template
{
private
String
template_id
;
public
String
getTemplate_id
()
{
return
template_id
;
}
public
void
setTemplate_id
(
String
template_id
)
{
this
.
template_id
=
template_id
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/TemplateData.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
/**
* Created by Vino on 2016/12/22.
*/
public
class
TemplateData
{
private
TemplateKeynote
first
;
private
TemplateKeynote
keynote1
;
private
TemplateKeynote
keynote2
;
private
TemplateKeynote
keynote3
;
private
TemplateKeynote
subject
;
private
TemplateKeynote
sender
;
private
TemplateKeynote
remark
;
public
TemplateKeynote
getFirst
()
{
return
first
;
}
public
void
setFirst
(
TemplateKeynote
first
)
{
this
.
first
=
first
;
}
public
TemplateKeynote
getKeynote1
()
{
return
keynote1
;
}
public
void
setKeynote1
(
TemplateKeynote
keynote1
)
{
this
.
keynote1
=
keynote1
;
}
public
TemplateKeynote
getKeynote2
()
{
return
keynote2
;
}
public
void
setKeynote2
(
TemplateKeynote
keynote2
)
{
this
.
keynote2
=
keynote2
;
}
public
TemplateKeynote
getKeynote3
()
{
return
keynote3
;
}
public
void
setKeynote3
(
TemplateKeynote
keynote3
)
{
this
.
keynote3
=
keynote3
;
}
public
TemplateKeynote
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
TemplateKeynote
remark
)
{
this
.
remark
=
remark
;
}
public
TemplateKeynote
getSubject
()
{
return
subject
;
}
public
void
setSubject
(
TemplateKeynote
subject
)
{
this
.
subject
=
subject
;
}
public
TemplateKeynote
getSender
()
{
return
sender
;
}
public
void
setSender
(
TemplateKeynote
sender
)
{
this
.
sender
=
sender
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/TemplateKeynote.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
/**
* Created by Vino on 2016/12/22.
*/
public
class
TemplateKeynote
{
private
String
value
;
private
String
color
;
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
String
getColor
()
{
return
color
;
}
public
void
setColor
(
String
color
)
{
this
.
color
=
color
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/User.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
public
class
User
{
/** 是否订阅该公众号标识 */
private
String
subscribe
;
/** 用户标识 */
private
String
openid
;
/** 昵称 */
private
String
nickname
;
/** 性别 */
private
String
sex
;
/** 用户所在城市 */
private
String
city
;
/** 用户所在省份 */
private
String
province
;
/** 用户的语言 */
private
String
language
;
/** 用户头像 */
private
String
headimgrul
;
/** 用户关注时间 */
private
String
subscribe_time
;
/** 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段 */
private
String
unionid
;
/** 纬度 */
private
String
latitude
;
/** 经度 */
private
String
longitude
;
/**
* @return the subscribe
*/
public
String
getSubscribe
()
{
return
subscribe
;
}
/**
* @param subscribe the subscribe to set
*/
public
void
setSubscribe
(
String
subscribe
)
{
this
.
subscribe
=
subscribe
;
}
/**
* @return the openid
*/
public
String
getOpenid
()
{
return
openid
;
}
/**
* @param openid the openid to set
*/
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
/**
* @return the nickname
*/
public
String
getNickname
()
{
return
nickname
;
}
/**
* @param nickname the nickname to set
*/
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
/**
* @return the sex
*/
public
String
getSex
()
{
return
sex
;
}
/**
* @param sex the sex to set
*/
public
void
setSex
(
String
sex
)
{
this
.
sex
=
sex
;
}
/**
* @return the city
*/
public
String
getCity
()
{
return
city
;
}
/**
* @param city the city to set
*/
public
void
setCity
(
String
city
)
{
this
.
city
=
city
;
}
/**
* @return the province
*/
public
String
getProvince
()
{
return
province
;
}
/**
* @param province the province to set
*/
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
;
}
/**
* @return the language
*/
public
String
getLanguage
()
{
return
language
;
}
/**
* @param language the language to set
*/
public
void
setLanguage
(
String
language
)
{
this
.
language
=
language
;
}
/**
* @return the headimgrul
*/
public
String
getHeadimgrul
()
{
return
headimgrul
;
}
/**
* @param headimgrul the headimgrul to set
*/
public
void
setHeadimgrul
(
String
headimgrul
)
{
this
.
headimgrul
=
headimgrul
;
}
/**
* @return the subscribe_time
*/
public
String
getSubscribe_time
()
{
return
subscribe_time
;
}
/**
* @param subscribe_time the subscribe_time to set
*/
public
void
setSubscribe_time
(
String
subscribe_time
)
{
this
.
subscribe_time
=
subscribe_time
;
}
/**
* @return the unionid
*/
public
String
getUnionid
()
{
return
unionid
;
}
/**
* @param unionid the unionid to set
*/
public
void
setUnionid
(
String
unionid
)
{
this
.
unionid
=
unionid
;
}
public
String
getLatitude
()
{
return
latitude
;
}
public
void
setLatitude
(
String
latitude
)
{
this
.
latitude
=
latitude
;
}
public
String
getLongitude
()
{
return
longitude
;
}
public
void
setLongitude
(
String
longitude
)
{
this
.
longitude
=
longitude
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/WSLocation.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
public
class
WSLocation
extends
BaseEntity
{
/** openid */
private
String
openid
;
/** 纬度 */
private
String
latitude
;
/** 经度 */
private
String
longitude
;
/** 精度 */
private
String
precision
;
/**
* @return the latitude
*/
public
String
getLatitude
()
{
return
latitude
;
}
/**
* @param latitude the latitude to set
*/
public
void
setLatitude
(
String
latitude
)
{
this
.
latitude
=
latitude
;
}
/**
* @return the longitude
*/
public
String
getLongitude
()
{
return
longitude
;
}
/**
* @param longitude the longitude to set
*/
public
void
setLongitude
(
String
longitude
)
{
this
.
longitude
=
longitude
;
}
/**
* @return the openid
*/
public
String
getOpenid
()
{
return
openid
;
}
/**
* @param openid the openid to set
*/
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
/**
* @return the precision
*/
public
String
getPrecision
()
{
return
precision
;
}
/**
* @param precision the precision to set
*/
public
void
setPrecision
(
String
precision
)
{
this
.
precision
=
precision
;
}
}
common/src/main/java/com/pica/cloud/wechat/yunqueyilian/common/wechat/pojo/WSUser.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
common
.
wechat
.
pojo
;
import
java.util.Date
;
public
class
WSUser
extends
BaseEntity
{
/**
* 是否订阅该公众号标识
*/
private
Integer
subscribe
;
/**
* 用户标识
*/
private
String
openid
;
/**
* 昵称
*/
private
String
nickname
;
/**
* 性别
*/
private
String
sex
;
/**
* 用户所在城市
*/
private
String
city
;
/**
* 用户所在省份
*/
private
String
province
;
/**
* 用户的语言
*/
private
String
language
;
/**
* 用户头像
*/
private
String
headimgurl
;
/**
* 用户关注时间
*/
private
Date
subscribe_time
;
/**
* 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段
*/
private
String
unionid
;
/**
* @return the subscribe
*/
public
Integer
getSubscribe
()
{
return
subscribe
;
}
/**
* @param subscribe the subscribe to set
*/
public
void
setSubscribe
(
Integer
subscribe
)
{
this
.
subscribe
=
subscribe
;
}
/**
* @return the sex
*/
public
String
getSex
()
{
return
sex
;
}
/**
* @param sex the sex to set
*/
public
void
setSex
(
String
sex
)
{
this
.
sex
=
sex
;
}
/**
* @return the city
*/
public
String
getCity
()
{
return
city
;
}
/**
* @param city the city to set
*/
public
void
setCity
(
String
city
)
{
this
.
city
=
city
;
}
/**
* @return the province
*/
public
String
getProvince
()
{
return
province
;
}
/**
* @param province the province to set
*/
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
;
}
/**
* @return the language
*/
public
String
getLanguage
()
{
return
language
;
}
/**
* @param language the language to set
*/
public
void
setLanguage
(
String
language
)
{
this
.
language
=
language
;
}
/**
* @return the subscribe_time
*/
public
Date
getSubscribe_time
()
{
return
subscribe_time
;
}
/**
* @param subscribe_time the subscribe_time to set
*/
public
void
setSubscribe_time
(
Date
subscribe_time
)
{
this
.
subscribe_time
=
subscribe_time
;
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
public
String
getNickname
()
{
return
nickname
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
/**
* @return the headimgurl
*/
public
String
getHeadimgurl
()
{
return
headimgurl
;
}
/**
* @param headimgurl the headimgurl to set
*/
public
void
setHeadimgurl
(
String
headimgurl
)
{
this
.
headimgurl
=
headimgurl
;
}
/**
* @return the unionid
*/
public
String
getUnionid
()
{
return
unionid
;
}
/**
* @param unionid the unionid to set
*/
public
void
setUnionid
(
String
unionid
)
{
this
.
unionid
=
unionid
;
}
}
pom.xml
浏览文件 @
889088e3
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.pica.cloud.wechat
</groupId>
...
...
@@ -8,25 +9,18 @@
<packaging>
pom
</packaging>
<name>
pica-cloud-yunqueyilian
</name>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>
com.pica.cloud.foundation
</groupId>
<artifactId>
pica-cloud-utils
</artifactId>
<version>
1.0.7-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<modules>
<module>
server
</module>
<module>
common
</module>
<module>
client
</module>
</modules>
<modules>
<module>
server
</module>
<module>
common
</module>
<module>
client
</module>
</modules>
</project>
\ No newline at end of file
server/pom.xml
浏览文件 @
889088e3
...
...
@@ -25,6 +25,12 @@
</properties>
<dependencies>
<dependency>
<groupId>
com.pica.cloud.wechat
</groupId>
<artifactId>
pica-cloud-yunqueyilian-common
</artifactId>
<version>
1.0.0
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
...
...
@@ -96,12 +102,6 @@
<version>
1.1.2
</version>
</dependency>
<dependency>
<groupId>
com.pica.cloud.foundation
</groupId>
<artifactId>
pica-cloud-utils
</artifactId>
<version>
1.0.7-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.zaxxer
</groupId>
<artifactId>
HikariCP
</artifactId>
...
...
@@ -216,15 +216,15 @@
<version>
1.3.2
</version>
</dependency>
</dependencies>
<
executions
>
<
execution
>
<
id>
Generate MyBatis Artifacts
</id
>
<
phase>
package
</phase
>
<
goals
>
<
goal>
generate
</goal
>
<
/goals
>
<
/execution
>
<
/executions
>
<
!--<executions>--
>
<
!--<execution>--
>
<
!--<id>Generate MyBatis Artifacts</id>--
>
<
!--<phase>package</phase>--
>
<
!--<goals>--
>
<
!--<goal>generate</goal>--
>
<
!--</goals>--
>
<
!--</execution>--
>
<
!--</executions>--
>
<configuration>
<verbose>
true
</verbose>
<overwrite>
true
</overwrite>
...
...
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/App.java
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
;
import
com.pica.cloud.wechat.yunqueyilian.server.configuration.MyTypeExcludeFilterApplicationContextInitializer
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
...
...
@@ -9,14 +10,15 @@ import org.springframework.cloud.netflix.feign.EnableFeignClients;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@EnableCircuitBreaker
@SpringBootApplication
@SpringBootApplication
(
scanBasePackages
=
"com.pica.cloud"
)
@EnableDiscoveryClient
@EnableSwagger2
@EnableFeignClients
@MapperScan
(
"com.pica.cloud.wechat.yunqueyilian.server.mapper"
)
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
App
.
class
,
args
);
public
static
void
main
(
String
[]
args
)
{
SpringApplication
springApplication
=
new
SpringApplication
(
App
.
class
);
springApplication
.
addInitializers
(
new
MyTypeExcludeFilterApplicationContextInitializer
());
springApplication
.
run
(
args
);
}
}
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/client/IWechatsServiceClient.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
client
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.wechat.yunqueyilian.server.client.impl.WechatsServiceFailFactory
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.Map
;
/**
* @author: zhehao.chen
* @version: V1.0
* @Description:
* @date: 2018/8/9 13:15
*/
@FeignClient
(
value
=
"10102-PICA-CLOUD-WECHAT"
,
fallbackFactory
=
WechatsServiceFailFactory
.
class
)
@RequestMapping
(
value
=
"/wechats"
,
headers
=
"sysCode=21"
,
produces
=
"application/json;charset=UTF-8"
)
public
interface
IWechatsServiceClient
{
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/users"
)
PicaResponse
<
Map
<
String
,
Object
>>
users
(
@RequestParam
(
value
=
"type"
)
Integer
type
,
@RequestParam
(
value
=
"openId"
)
String
openId
);
}
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/client/impl/WechatsServiceFailFactory.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
client
.
impl
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.wechat.yunqueyilian.server.client.IWechatsServiceClient
;
import
feign.hystrix.FallbackFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
java.util.Map
;
/**
* @author: zhehao.chen
* @version: V1.0
* @Description:
* @date: 2018/8/10 10:57
*/
@Component
public
class
WechatsServiceFailFactory
implements
FallbackFactory
<
IWechatsServiceClient
>
{
public
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WechatsServiceFailFactory
.
class
);
@Override
public
IWechatsServiceClient
create
(
Throwable
cause
)
{
PicaResponse
response
=
(
new
PicaResponse
.
Builder
<
Map
<
String
,
Object
>>()).
build
();
response
.
setCode
(
PicaResultCode
.
INTERFACE_INVOKE_ERROR
.
code
());
response
.
setMessage
(
PicaResultCode
.
INTERFACE_INVOKE_ERROR
.
message
());
return
new
IWechatsServiceClient
()
{
@Override
public
PicaResponse
users
(
Integer
type
,
String
openId
)
{
logger
.
error
(
"service:IWechatsServiceClient interface:users 触发熔断机制fallback"
,
cause
);
return
response
;
}
};
}
}
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/configuration/MyTypeExcludeFilter.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
configuration
;
import
org.springframework.boot.context.TypeExcludeFilter
;
import
org.springframework.core.type.classreading.MetadataReader
;
import
org.springframework.core.type.classreading.MetadataReaderFactory
;
/**
* @author: zhehao.chen
* @version: V1.0
* @Description:自定义bean过滤
* @date: 2018/8/20 18:12
*/
public
class
MyTypeExcludeFilter
extends
TypeExcludeFilter
{
@Override
public
boolean
match
(
MetadataReader
metadataReader
,
MetadataReaderFactory
metadataReaderFactory
)
{
//common包中的PicaLogAspect过滤掉,使用自定义的PicaLogAspectForXml
if
(
"com.pica.cloud.foundation.utils.aop.PicaLogAspect"
.
equals
(
metadataReader
.
getClassMetadata
().
getClassName
()))
{
return
true
;
}
return
false
;
}
}
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/configuration/MyTypeExcludeFilterApplicationContextInitializer.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
configuration
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.support.BeanDefinitionRegistry
;
import
org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
;
import
org.springframework.beans.factory.support.RootBeanDefinition
;
import
org.springframework.context.ApplicationContextInitializer
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.PriorityOrdered
;
/**
* @author: zhehao.chen
* @version: V1.0
* @Description:
* @date: 2018/8/20 18:25
*/
public
class
MyTypeExcludeFilterApplicationContextInitializer
implements
ApplicationContextInitializer
<
ConfigurableApplicationContext
>,
Ordered
{
@Override
public
void
initialize
(
ConfigurableApplicationContext
applicationContext
)
{
applicationContext
.
addBeanFactoryPostProcessor
(
new
MyTypeExcludeFilterPostProcessor
());
}
@Override
public
int
getOrder
()
{
return
0
;
}
private
static
class
MyTypeExcludeFilterPostProcessor
implements
PriorityOrdered
,
BeanDefinitionRegistryPostProcessor
{
public
static
final
String
BEAN_NAME
=
"com.pica.cloud.wechat.yunqueyilian.server.configuration.myTypeExcludeFilter"
;
@Override
public
int
getOrder
()
{
return
Ordered
.
HIGHEST_PRECEDENCE
;
}
@Override
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
}
@Override
public
void
postProcessBeanDefinitionRegistry
(
BeanDefinitionRegistry
registry
)
throws
BeansException
{
RootBeanDefinition
definition
=
new
RootBeanDefinition
(
MyTypeExcludeFilter
.
class
);
registry
.
registerBeanDefinition
(
BEAN_NAME
,
definition
);
}
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/controller/CoreController.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
controller
;
import
com.pica.cloud.foundation.utils.controller.BaseController
;
import
com.pica.cloud.wechat.yunqueyilian.server.service.CoreService
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @author: zhehao.chen
* @version: V1.0
* @Description:
* @date: 2018/8/9 10:08
*/
@RestController
@RequestMapping
(
"/core"
)
public
class
CoreController
extends
BaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CoreController
.
class
);
@Autowired
private
CoreService
coreService
;
@ApiOperation
(
value
=
"微信验证接口"
,
response
=
String
.
class
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
produces
=
"text/xml;charset=UTF-8"
)
// @RequestMapping
public
String
check
(
final
HttpServletRequest
request
)
throws
Exception
{
// 创建一个ResponseBuilder
return
coreService
.
requestCheck
(
request
);
// 返回Response
}
@ApiOperation
(
value
=
"微信推送事件接口"
,
response
=
String
.
class
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
produces
=
"text/xml;charset=UTF-8"
)
// @RequestMapping
public
String
msg
(
final
HttpServletRequest
request
)
throws
Exception
{
// 创建一个ResponseBuilder
return
coreService
.
processRequest
(
request
);
// 返回Response
}
}
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/controller/DemoController.java
已删除
100644 → 0
浏览文件 @
61230df8
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.client.loadbalancer.LoadBalancerClient
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.pica.cloud.wechat.yunqueyilian.server.client.IConfigServiceClient
;
import
com.pica.cloud.wechat.yunqueyilian.server.configuration.PropertiesConfiguration
;
import
com.pica.cloud.wechat.yunqueyilian.server.mapper.HospitalMapper
;
import
com.pica.cloud.wechat.yunqueyilian.server.entity.Hospital
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.redis.RedisClient
;
@RestController
@RequestMapping
(
"/demo"
)
@Api
(
value
=
"冒烟测试"
,
description
=
"测试 db,redis,读取自定义配置 以及使用 feign 调用微服务"
)
public
class
DemoController
{
@Autowired
private
HospitalMapper
personMapper
;
@Autowired
private
RedisClient
redisClient
;
@Autowired
private
PropertiesConfiguration
properties
;
@Autowired
private
LoadBalancerClient
slb
;
@Autowired
private
IConfigServiceClient
client
;
@ApiOperation
(
value
=
"DB连接测试:更新Person对象"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/db"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
Hospital
>
saveToDB
()
{
// 创建一个ResponseBuilder
PicaResponse
.
Builder
<
Hospital
>
builder
=
new
PicaResponse
.
Builder
<>();
builder
.
setData
(
personMapper
.
selectByPrimaryKey
(
1008
));
// 返回Response
return
builder
.
build
();
}
@ApiOperation
(
value
=
"Redis连接测试:插入一个Person对象到Redis"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/redis"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
String
>
saveToCache
()
{
PicaResponse
.
Builder
<
String
>
builder
=
new
PicaResponse
.
Builder
<>();
redisClient
.
set
(
"keyname"
,
personMapper
.
selectByPrimaryKey
(
1008
));
return
builder
.
setData
(
redisClient
.
get
(
"keyname"
)).
build
();
}
@ApiOperation
(
value
=
"读取配置测试"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/config"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
String
>
readFromConfiguration
()
{
PicaResponse
.
Builder
<
String
>
builder
=
new
PicaResponse
.
Builder
<>();
builder
.
setData
(
properties
.
toString
());
return
builder
.
build
();
}
@ApiOperation
(
value
=
"Feign调用微服务"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/beans"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
String
beans
()
{
return
client
.
beans
();
}
}
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/entity/Hospital.java
已删除
100644 → 0
浏览文件 @
61230df8
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
entity
;
import
java.util.Date
;
public
class
Hospital
{
private
Integer
id
;
private
Integer
provinceId
;
private
String
provinceName
;
private
Long
cityId
;
private
String
cityName
;
private
Long
countyId
;
private
String
countyName
;
private
Long
townId
;
private
String
townName
;
private
Long
villageId
;
private
String
villageName
;
private
String
name
;
private
String
hospitalAddress
;
private
Integer
type
;
private
Integer
deleteFlag
;
private
Integer
creatId
;
private
Date
creatTime
;
private
Integer
modifyId
;
private
Date
modifyTime
;
private
Integer
hospitalStatisticsType
;
private
Integer
hospitalRank
;
private
String
hospitalAlias
;
private
Integer
parentId
;
private
String
hospitalClass
;
private
String
hospitalLevel
;
private
String
hospitalGrade
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getProvinceId
()
{
return
provinceId
;
}
public
void
setProvinceId
(
Integer
provinceId
)
{
this
.
provinceId
=
provinceId
;
}
public
String
getProvinceName
()
{
return
provinceName
;
}
public
void
setProvinceName
(
String
provinceName
)
{
this
.
provinceName
=
provinceName
==
null
?
null
:
provinceName
.
trim
();
}
public
Long
getCityId
()
{
return
cityId
;
}
public
void
setCityId
(
Long
cityId
)
{
this
.
cityId
=
cityId
;
}
public
String
getCityName
()
{
return
cityName
;
}
public
void
setCityName
(
String
cityName
)
{
this
.
cityName
=
cityName
==
null
?
null
:
cityName
.
trim
();
}
public
Long
getCountyId
()
{
return
countyId
;
}
public
void
setCountyId
(
Long
countyId
)
{
this
.
countyId
=
countyId
;
}
public
String
getCountyName
()
{
return
countyName
;
}
public
void
setCountyName
(
String
countyName
)
{
this
.
countyName
=
countyName
==
null
?
null
:
countyName
.
trim
();
}
public
Long
getTownId
()
{
return
townId
;
}
public
void
setTownId
(
Long
townId
)
{
this
.
townId
=
townId
;
}
public
String
getTownName
()
{
return
townName
;
}
public
void
setTownName
(
String
townName
)
{
this
.
townName
=
townName
==
null
?
null
:
townName
.
trim
();
}
public
Long
getVillageId
()
{
return
villageId
;
}
public
void
setVillageId
(
Long
villageId
)
{
this
.
villageId
=
villageId
;
}
public
String
getVillageName
()
{
return
villageName
;
}
public
void
setVillageName
(
String
villageName
)
{
this
.
villageName
=
villageName
==
null
?
null
:
villageName
.
trim
();
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
==
null
?
null
:
name
.
trim
();
}
public
String
getHospitalAddress
()
{
return
hospitalAddress
;
}
public
void
setHospitalAddress
(
String
hospitalAddress
)
{
this
.
hospitalAddress
=
hospitalAddress
==
null
?
null
:
hospitalAddress
.
trim
();
}
public
Integer
getType
()
{
return
type
;
}
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
}
public
Integer
getDeleteFlag
()
{
return
deleteFlag
;
}
public
void
setDeleteFlag
(
Integer
deleteFlag
)
{
this
.
deleteFlag
=
deleteFlag
;
}
public
Integer
getCreatId
()
{
return
creatId
;
}
public
void
setCreatId
(
Integer
creatId
)
{
this
.
creatId
=
creatId
;
}
public
Date
getCreatTime
()
{
return
creatTime
;
}
public
void
setCreatTime
(
Date
creatTime
)
{
this
.
creatTime
=
creatTime
;
}
public
Integer
getModifyId
()
{
return
modifyId
;
}
public
void
setModifyId
(
Integer
modifyId
)
{
this
.
modifyId
=
modifyId
;
}
public
Date
getModifyTime
()
{
return
modifyTime
;
}
public
void
setModifyTime
(
Date
modifyTime
)
{
this
.
modifyTime
=
modifyTime
;
}
public
Integer
getHospitalStatisticsType
()
{
return
hospitalStatisticsType
;
}
public
void
setHospitalStatisticsType
(
Integer
hospitalStatisticsType
)
{
this
.
hospitalStatisticsType
=
hospitalStatisticsType
;
}
public
Integer
getHospitalRank
()
{
return
hospitalRank
;
}
public
void
setHospitalRank
(
Integer
hospitalRank
)
{
this
.
hospitalRank
=
hospitalRank
;
}
public
String
getHospitalAlias
()
{
return
hospitalAlias
;
}
public
void
setHospitalAlias
(
String
hospitalAlias
)
{
this
.
hospitalAlias
=
hospitalAlias
==
null
?
null
:
hospitalAlias
.
trim
();
}
public
Integer
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Integer
parentId
)
{
this
.
parentId
=
parentId
;
}
public
String
getHospitalClass
()
{
return
hospitalClass
;
}
public
void
setHospitalClass
(
String
hospitalClass
)
{
this
.
hospitalClass
=
hospitalClass
==
null
?
null
:
hospitalClass
.
trim
();
}
public
String
getHospitalLevel
()
{
return
hospitalLevel
;
}
public
void
setHospitalLevel
(
String
hospitalLevel
)
{
this
.
hospitalLevel
=
hospitalLevel
==
null
?
null
:
hospitalLevel
.
trim
();
}
public
String
getHospitalGrade
()
{
return
hospitalGrade
;
}
public
void
setHospitalGrade
(
String
hospitalGrade
)
{
this
.
hospitalGrade
=
hospitalGrade
==
null
?
null
:
hospitalGrade
.
trim
();
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/entity/PWechatUser.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
entity
;
import
java.util.Date
;
public
class
PWechatUser
{
private
Integer
id
;
private
String
openid
;
private
Integer
patientId
;
private
Integer
type
;
private
Integer
sex
;
private
String
nickname
;
private
String
province
;
private
String
city
;
private
String
country
;
private
String
headimgurl
;
private
String
privilege
;
private
String
unionid
;
private
Integer
subscribe
;
private
String
language
;
private
Date
subscribeTime
;
private
String
remark
;
private
String
groupid
;
private
String
tagidList
;
private
Integer
deleteFlag
;
private
Integer
creatId
;
private
Date
creatTime
;
private
Integer
modifyId
;
private
Date
modifyTime
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
==
null
?
null
:
openid
.
trim
();
}
public
Integer
getPatientId
()
{
return
patientId
;
}
public
void
setPatientId
(
Integer
patientId
)
{
this
.
patientId
=
patientId
;
}
public
Integer
getType
()
{
return
type
;
}
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
}
public
Integer
getSex
()
{
return
sex
;
}
public
void
setSex
(
Integer
sex
)
{
this
.
sex
=
sex
;
}
public
String
getNickname
()
{
return
nickname
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
==
null
?
null
:
nickname
.
trim
();
}
public
String
getProvince
()
{
return
province
;
}
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
==
null
?
null
:
province
.
trim
();
}
public
String
getCity
()
{
return
city
;
}
public
void
setCity
(
String
city
)
{
this
.
city
=
city
==
null
?
null
:
city
.
trim
();
}
public
String
getCountry
()
{
return
country
;
}
public
void
setCountry
(
String
country
)
{
this
.
country
=
country
==
null
?
null
:
country
.
trim
();
}
public
String
getHeadimgurl
()
{
return
headimgurl
;
}
public
void
setHeadimgurl
(
String
headimgurl
)
{
this
.
headimgurl
=
headimgurl
==
null
?
null
:
headimgurl
.
trim
();
}
public
String
getPrivilege
()
{
return
privilege
;
}
public
void
setPrivilege
(
String
privilege
)
{
this
.
privilege
=
privilege
==
null
?
null
:
privilege
.
trim
();
}
public
String
getUnionid
()
{
return
unionid
;
}
public
void
setUnionid
(
String
unionid
)
{
this
.
unionid
=
unionid
==
null
?
null
:
unionid
.
trim
();
}
public
Integer
getSubscribe
()
{
return
subscribe
;
}
public
void
setSubscribe
(
Integer
subscribe
)
{
this
.
subscribe
=
subscribe
;
}
public
String
getLanguage
()
{
return
language
;
}
public
void
setLanguage
(
String
language
)
{
this
.
language
=
language
==
null
?
null
:
language
.
trim
();
}
public
Date
getSubscribeTime
()
{
return
subscribeTime
;
}
public
void
setSubscribeTime
(
Date
subscribeTime
)
{
this
.
subscribeTime
=
subscribeTime
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
==
null
?
null
:
remark
.
trim
();
}
public
String
getGroupid
()
{
return
groupid
;
}
public
void
setGroupid
(
String
groupid
)
{
this
.
groupid
=
groupid
==
null
?
null
:
groupid
.
trim
();
}
public
String
getTagidList
()
{
return
tagidList
;
}
public
void
setTagidList
(
String
tagidList
)
{
this
.
tagidList
=
tagidList
==
null
?
null
:
tagidList
.
trim
();
}
public
Integer
getDeleteFlag
()
{
return
deleteFlag
;
}
public
void
setDeleteFlag
(
Integer
deleteFlag
)
{
this
.
deleteFlag
=
deleteFlag
;
}
public
Integer
getCreatId
()
{
return
creatId
;
}
public
void
setCreatId
(
Integer
creatId
)
{
this
.
creatId
=
creatId
;
}
public
Date
getCreatTime
()
{
return
creatTime
;
}
public
void
setCreatTime
(
Date
creatTime
)
{
this
.
creatTime
=
creatTime
;
}
public
Integer
getModifyId
()
{
return
modifyId
;
}
public
void
setModifyId
(
Integer
modifyId
)
{
this
.
modifyId
=
modifyId
;
}
public
Date
getModifyTime
()
{
return
modifyTime
;
}
public
void
setModifyTime
(
Date
modifyTime
)
{
this
.
modifyTime
=
modifyTime
;
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/mapper/HospitalMapper.java
已删除
100644 → 0
浏览文件 @
61230df8
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
mapper
;
import
com.pica.cloud.wechat.yunqueyilian.server.entity.Hospital
;
public
interface
HospitalMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
Hospital
record
);
int
insertSelective
(
Hospital
record
);
Hospital
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
Hospital
record
);
int
updateByPrimaryKey
(
Hospital
record
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/mapper/PWechatUserMapper.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
mapper
;
import
com.pica.cloud.wechat.yunqueyilian.server.entity.PWechatUser
;
import
java.util.Map
;
public
interface
PWechatUserMapper
{
PWechatUser
queryByOpenId
(
Map
map
);
int
insert
(
PWechatUser
user
);
int
updateById
(
PWechatUser
user
);
int
updateSubscribeById
(
PWechatUser
user
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/service/CoreService.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
service
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Map
;
/**
* @author: zhehao.chen
* @version: V1.0
* @Description:
* @date: 2018/8/9 10:08
*/
public
interface
CoreService
{
public
String
requestCheck
(
HttpServletRequest
request
);
public
String
processRequest
(
HttpServletRequest
request
);
}
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/service/impl/CoreServiceImpl.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
service
.
impl
;
import
com.pica.cloud.foundation.entity.PicaException
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.utils.utils.JsonUtil
;
import
com.pica.cloud.foundation.utils.utils.StringUtil
;
import
com.pica.cloud.wechat.yunqueyilian.common.CommonUtils
;
import
com.pica.cloud.wechat.yunqueyilian.common.Constants
;
import
com.pica.cloud.wechat.yunqueyilian.common.req.TextMessage
;
import
com.pica.cloud.wechat.yunqueyilian.server.client.IWechatsServiceClient
;
import
com.pica.cloud.wechat.yunqueyilian.server.entity.PWechatUser
;
import
com.pica.cloud.wechat.yunqueyilian.server.mapper.PWechatUserMapper
;
import
com.pica.cloud.wechat.yunqueyilian.server.service.CoreService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.UnsupportedEncodingException
;
import
java.util.*
;
/**
* @author: zhehao.chen
* @version: V1.0
* @Description:
* @date: 2018/8/9 10:09
*/
@Service
public
class
CoreServiceImpl
implements
CoreService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CoreServiceImpl
.
class
);
@Autowired
IWechatsServiceClient
userServiceClient
;
@Autowired
PWechatUserMapper
wechatUserMapper
;
@Override
public
String
requestCheck
(
HttpServletRequest
request
)
{
// 微信加密签名
String
signature
=
request
.
getParameter
(
"signature"
);
// 时间戳
String
timestamp
=
request
.
getParameter
(
"timestamp"
);
// 随机数
String
nonce
=
request
.
getParameter
(
"nonce"
);
// 随机字符串
String
echostr
=
request
.
getParameter
(
"echostr"
);
logger
.
info
(
"微信验证接口信息signature:"
+
signature
+
" timestamp:"
+
timestamp
+
" nonce:"
+
nonce
+
" echostr:"
+
echostr
);
// 通过检验signature对请求进行校验,若校验成功则原样返回echostr,表示接入成功,否则接入失败
if
(
CommonUtils
.
checkSignature
(
signature
,
timestamp
,
nonce
))
{
return
echostr
;
}
logger
.
error
(
"微信验证接口异常"
);
return
null
;
}
@Override
public
String
processRequest
(
HttpServletRequest
request
)
{
String
respMessage
=
null
;
try
{
// 默认返回的文本消息内容
String
respContent
=
""
;
Map
<
String
,
String
>
requestMap
=
CommonUtils
.
parseXml
(
request
);
// xml请求解析
// 发送方帐号(open_id)
String
fromUserName
=
requestMap
.
get
(
"FromUserName"
);
// 公众帐号
String
toUserName
=
requestMap
.
get
(
"ToUserName"
);
// 消息类型
String
msgType
=
requestMap
.
get
(
"MsgType"
);
String
MsgId
=
requestMap
.
get
(
"MsgId"
);
String
Content
=
requestMap
.
get
(
"Content"
);
logger
.
info
(
"requestMap:"
+
requestMap
.
toString
());
if
(
msgType
.
equals
(
Constants
.
REQ_MESSAGE_TYPE_EVENT
))
{
// 事件推送
// 事件类型
String
eventType
=
requestMap
.
get
(
"Event"
);
logger
.
info
(
"eventType:"
+
eventType
);
//关注、取消关注流程处理
if
(
eventType
.
equals
(
Constants
.
EVENT_TYPE_SUBSCRIBE
)
||
eventType
.
equals
(
Constants
.
EVENT_TYPE_UNSUBSCRIBE
))
{
String
openId
=
fromUserName
;
//获得openId
Map
mapIn
=
new
HashMap
();
mapIn
.
put
(
"type"
,
1
);
//1云鹊医联
mapIn
.
put
(
"openId"
,
openId
);
PWechatUser
userGet
=
wechatUserMapper
.
queryByOpenId
(
mapIn
);
//从wechat表中获取数据
PicaResponse
<
Map
<
String
,
Object
>>
response
=
userServiceClient
.
users
(
Constants
.
WECHAT_NAME_YQYL
,
openId
);
//调用微信的接口,获取微信用户的详细信息
logger
.
info
(
"调用微信接口获取用户信息:"
+
response
);
if
(!
PicaResultCode
.
SUCCESS
.
code
().
equals
(
response
.
getCode
()))
{
throw
new
PicaException
(
response
.
getCode
(),
response
.
getMessage
());
}
//1.首先处理p_wechat_user表,存在信息就补全,不存在就新增
respContent
=
insertOrUpdataWechatUser
(
requestMap
,
response
.
getData
(),
userGet
);
}
}
if
(!
StringUtil
.
isEmpty
(
respContent
))
{
// 回复消息
TextMessage
textMessage
=
new
TextMessage
();
textMessage
.
setToUserName
(
fromUserName
);
textMessage
.
setFromUserName
(
toUserName
);
textMessage
.
setCreateTime
(
new
Date
().
getTime
());
textMessage
.
setMsgType
(
Constants
.
RESP_MESSAGE_TYPE_TEXT
);
textMessage
.
setContent
(
respContent
);
respMessage
=
CommonUtils
.
textMessageToXml
(
textMessage
);
logger
.
info
(
"textMessage:"
+
JsonUtil
.
toJSONString
(
textMessage
));
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"微信消息处理流程异常"
,
e
);
}
return
respMessage
;
}
private
String
insertOrUpdataWechatUser
(
Map
<
String
,
String
>
requestMap
,
Map
map
,
PWechatUser
wechatUser
)
throws
UnsupportedEncodingException
{
String
eventType
=
requestMap
.
get
(
"Event"
);
if
(
eventType
.
equals
(
Constants
.
EVENT_TYPE_SUBSCRIBE
))
{
//关注
boolean
newFlag
=
false
;
if
(
StringUtil
.
isNull
(
wechatUser
))
{
//新增
wechatUser
=
new
PWechatUser
();
newFlag
=
true
;
}
wechatUser
.
setOpenid
((
String
)
map
.
get
(
"openid"
));
wechatUser
.
setType
(
1
);
//1、云鹊医联
wechatUser
.
setSex
((
Integer
)
map
.
get
(
"sex"
));
wechatUser
.
setNickname
((
String
)
map
.
get
(
"nickname"
));
wechatUser
.
setProvince
((
String
)
map
.
get
(
"province"
));
wechatUser
.
setCity
((
String
)
map
.
get
(
"city"
));
wechatUser
.
setCountry
((
String
)
map
.
get
(
"country"
));
wechatUser
.
setHeadimgurl
((
String
)
map
.
get
(
"headimgurl"
));
wechatUser
.
setPrivilege
((
String
)
map
.
get
(
"privilege"
));
wechatUser
.
setUnionid
((
String
)
map
.
get
(
"unionid"
));
wechatUser
.
setSubscribe
((
Integer
)
map
.
get
(
"subscribe"
));
wechatUser
.
setLanguage
((
String
)
map
.
get
(
"language"
));
Integer
subscribe_time
=
(
Integer
)
map
.
get
(
"subscribe_time"
);
wechatUser
.
setSubscribeTime
(
StringUtil
.
isNull
(
subscribe_time
)
?
new
Date
()
:
new
Date
((
long
)
subscribe_time
*
1000
));
wechatUser
.
setRemark
((
String
)
map
.
get
(
"remark"
));
wechatUser
.
setGroupid
(
String
.
valueOf
(
map
.
get
(
"groupid"
)));
List
tagid_list
=
(
ArrayList
)
map
.
get
(
"tagid_list"
);
wechatUser
.
setTagidList
(
StringUtil
.
isNull
(
tagid_list
)
?
""
:
tagid_list
.
toString
());
wechatUser
.
setDeleteFlag
(
1
);
wechatUser
.
setCreatId
(
0
);
wechatUser
.
setModifyId
(
0
);
if
(
newFlag
)
{
//新增
wechatUserMapper
.
insert
(
wechatUser
);
}
else
{
//更新
wechatUserMapper
.
updateById
(
wechatUser
);
}
String
url
=
"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx1ee39338694703b0"
+
"&redirect_uri=https://test1-yunqueyilian.yunqueyi.com/goBind"
+
"&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect"
;
String
resContent
=
"您好!欢迎关注云鹊医联公众号。\n绑定个人资料后可以预约挂号、查看随访记录;还可以收到公众号推送患教和通知。\n<a href='"
+
url
+
"'>立即去绑定</a>"
;
return
resContent
;
}
else
if
(
eventType
.
equals
(
Constants
.
EVENT_TYPE_UNSUBSCRIBE
))
{
//取消关注
if
(
StringUtil
.
isNull
(
wechatUser
))
{
//新增
logger
.
error
(
"取消关注未能从数据库中获取到用户信息异常"
);
return
""
;
}
wechatUser
.
setSubscribe
(
0
);
wechatUserMapper
.
updateSubscribeById
(
wechatUser
);
}
return
""
;
}
}
server/src/main/java/com/pica/cloud/wechat/yunqueyilian/server/service/impl/MenuManagerServiceImpl.java
0 → 100644
浏览文件 @
889088e3
package
com
.
pica
.
cloud
.
wechat
.
yunqueyilian
.
server
.
service
.
impl
;
import
com.pica.cloud.wechat.yunqueyilian.common.constants.WeChatConstants
;
import
com.pica.cloud.wechat.yunqueyilian.common.util.CloudPropertiesUtil
;
import
com.pica.cloud.wechat.yunqueyilian.common.util.WeChatToolUtil
;
import
com.pica.cloud.wechat.yunqueyilian.common.wechat.pojo.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
/**
* @author: zhehao.chen
* @version: V1.0
* @Description:菜单管理器类
* @date: 2018/8/10 18:12
*/
public
class
MenuManagerServiceImpl
{
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
MenuManagerServiceImpl
.
class
);
public
static
void
main
(
String
[]
args
)
throws
IOException
{
// CloudPropertiesUtil.read("dev");
CloudPropertiesUtil
.
read
(
"test1"
);
AccessToken
accessToken
=
WeChatToolUtil
.
getAccessToken
(
CloudPropertiesUtil
.
getValue
(
"AppID"
),
CloudPropertiesUtil
.
getValue
(
"AppSecret"
));
Boolean
flag
=
WeChatToolUtil
.
createMenu
(
getMenu
(),
accessToken
.
getAccess_token
());
if
(
flag
)
{
System
.
out
.
println
(
"菜单创建成功"
);
}
else
{
System
.
out
.
println
(
"菜单创建失败"
);
}
}
/**
* 组装菜单数据
*
* @return
*/
private
static
Menu
getMenu
()
throws
UnsupportedEncodingException
{
//test1
String
btn11Url
=
"https://test1-yunqueyilian.yunqueyi.com/message"
;
String
btn21Url
=
"http://mp.weixin.qq.com/mp/homepage?__biz=MzIzNjM5NDA1OQ==&hid=2&sn=f52aa8659aa75f32aae5ea62d23e64ca&scene=18#wechat_redirect"
;
String
btn31Url
=
"https://test1-yunqueyilian.yunqueyi.com/goBind"
;
String
btn32Url
=
"https://test1-yunqueyilian.yunqueyi.com/applyIndex"
;
String
btn33Url
=
"https://test1-yunqueyilian.yunqueyi.com/followUp"
;
//pro
// String btn11Url = "https://yunqueyilian.yunqueyi.com/message";
// String btn21Url = "http://mp.weixin.qq.com/mp/homepage?__biz=MzIzNjM5NDA1OQ==&hid=2&sn=f52aa8659aa75f32aae5ea62d23e64ca&scene=18#wechat_redirect";
// String btn31Url = "https://yunqueyilian.yunqueyi.com/goBind";
// String btn32Url = "https://yunqueyilian.yunqueyi.com/applyIndex";
// String btn33Url = "https://yunqueyilian.yunqueyi.com/followUp";
String
utl_end
=
"&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect"
;
CommonButton
btn11
=
new
CommonButton
();
btn11
.
setName
(
"消息"
);
btn11
.
setType
(
"view"
);
String
url11
=
"https://open.weixin.qq.com/connect/oauth2/authorize?appid="
+
WeChatConstants
.
APP_ID
+
"&redirect_uri="
+
URLEncoder
.
encode
(
btn11Url
,
"UTF-8"
);
btn11
.
setUrl
(
url11
+
utl_end
);
CommonButton
btn21
=
new
CommonButton
();
btn21
.
setName
(
"健康漫画"
);
btn21
.
setType
(
"view"
);
String
h_knowledge_redirect_uri
=
btn21Url
;
btn21
.
setUrl
(
h_knowledge_redirect_uri
);
CommonButton
btn31
=
new
CommonButton
();
btn31
.
setName
(
"个人信息"
);
btn31
.
setType
(
"view"
);
String
url31
=
"https://open.weixin.qq.com/connect/oauth2/authorize?appid="
+
WeChatConstants
.
APP_ID
+
"&redirect_uri="
+
URLEncoder
.
encode
(
btn31Url
,
"UTF-8"
);
btn31
.
setUrl
(
url31
+
utl_end
);
CommonButton
btn32
=
new
CommonButton
();
btn32
.
setName
(
"门诊预约"
);
btn32
.
setType
(
"view"
);
String
url32
=
"https://open.weixin.qq.com/connect/oauth2/authorize?appid="
+
WeChatConstants
.
APP_ID
+
"&redirect_uri="
+
URLEncoder
.
encode
(
btn32Url
,
"UTF-8"
);
btn32
.
setUrl
(
url32
+
utl_end
);
CommonButton
btn33
=
new
CommonButton
();
btn33
.
setName
(
"随访记录"
);
btn33
.
setType
(
"view"
);
String
url33
=
"https://open.weixin.qq.com/connect/oauth2/authorize?appid="
+
WeChatConstants
.
APP_ID
+
"&redirect_uri="
+
URLEncoder
.
encode
(
btn33Url
,
"UTF-8"
);
btn33
.
setUrl
(
url33
+
utl_end
);
ComplexButton
mainBtn3
=
new
ComplexButton
();
mainBtn3
.
setName
(
"我的"
);
mainBtn3
.
setSub_button
(
new
CommonButton
[]{
btn31
,
btn32
,
btn33
});
/**
* 这是公众号xiaoqrobot目前的菜单结构,每个一级菜单都有二级菜单项<br>
*
* 在某个一级菜单下没有二级菜单的情况,menu该如何定义呢?<br>
* 比如,第三个一级菜单项不是“更多体验”,而直接是“幽默笑话”,那么menu应该这样定义:<br>
* menu.setButton(new Button[] { mainBtn1, mainBtn2, btn33 });
*/
Menu
menu
=
new
Menu
();
menu
.
setButton
(
new
Button
[]{
btn11
,
btn21
,
mainBtn3
});
return
menu
;
}
}
\ No newline at end of file
server/src/main/resources/bootstrap-dev.properties
浏览文件 @
889088e3
server.port
=
8080
server.port
=
10601
server.context-path
=
/yunqueyilian
spring.application.name
=
${server.port}-pica-cloud-yunqueyilian
#config server settings
...
...
@@ -23,11 +24,25 @@ spring.rabbitmq.port=5672
spring.rabbitmq.username
=
appuser
spring.rabbitmq.password
=
AqLfvyWOvLQEUzdI
#\u5FAE\u4FE1\u767B\u5F55\u4FE1\u606F
AppID
=
wx1ee39338694703b0
AppSecret
=
69e2c741d0cf8fd7eb8877ab9f3a236b
#local settings
feign.hystrix.enabled
=
true
#\u5F00\u542Fhystrix\u8BF7\u6C42\u8D85\u65F6\u673A\u5236
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
=
10000
#\u8BF7\u6C42\u8FDE\u63A5\u7684\u8D85\u65F6\u65F6\u95F4
ribbon.ConnectTimeout
=
6000
#\u8BF7\u6C42\u5904\u7406\u7684\u8D85\u65F6\u65F6\u95F4
ribbon.ReadTimeout
=
6000
management.security.enabled
=
false
spring.zipkin.base-url
=
http://192.168.110.124:7895
spring.sleuth.sampler.percentage
=
1.0
logging.config
=
classpath:log4j2-dev.xml
wechat_url
=
https://test1-yunqueyilian.yunqueyi.com
\ No newline at end of file
server/src/main/resources/bootstrap-prod.properties
浏览文件 @
889088e3
server.port
=
8080
server.port
=
10601
server.context-path
=
/yunqueyilian
spring.application.name
=
${server.port}-pica-cloud-yunqueyilian
#config server settings
...
...
@@ -23,11 +24,24 @@ spring.rabbitmq.port=5672
spring.rabbitmq.username
=
appuser
spring.rabbitmq.password
=
AqLfvyWOvLQEUzdI
#local setting
#\u5FAE\u4FE1\u767B\u5F55\u4FE1\u606F
AppID
=
wxcf79dbdc24cb684b
AppSecret
=
febe33eec4d0c05d62a2393be35c35c4
#local settings
feign.hystrix.enabled
=
true
#\u5F00\u542Fhystrix\u8BF7\u6C42\u8D85\u65F6\u673A\u5236
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
=
10000
#\u8BF7\u6C42\u8FDE\u63A5\u7684\u8D85\u65F6\u65F6\u95F4
ribbon.ConnectTimeout
=
6000
#\u8BF7\u6C42\u5904\u7406\u7684\u8D85\u65F6\u65F6\u95F4
ribbon.ReadTimeout
=
6000
management.security.enabled
=
true
spring.zipkin.base-url
=
http://172.19.137.19:7895
spring.sleuth.sampler.percentage
=
1.0
logging.config
=
classpath:log4j2-prod.xml
\ No newline at end of file
logging.config
=
classpath:log4j2-prod.xml
wechat_url
=
https://yunqueyilian.yunqueyi.com
\ No newline at end of file
server/src/main/resources/bootstrap-test1.properties
浏览文件 @
889088e3
server.port
=
8080
server.port
=
10601
server.context-path
=
/yunqueyilian
spring.application.name
=
${server.port}-pica-cloud-yunqueyilian
#config server settings
...
...
@@ -23,11 +24,24 @@ spring.rabbitmq.port=5672
spring.rabbitmq.username
=
appuser
spring.rabbitmq.password
=
AqLfvyWOvLQEUzdI
#\u5FAE\u4FE1\u767B\u5F55\u4FE1\u606F
AppID
=
wx1ee39338694703b0
AppSecret
=
69e2c741d0cf8fd7eb8877ab9f3a236b
#local settings
feign.hystrix.enabled
=
true
#\u5F00\u542Fhystrix\u8BF7\u6C42\u8D85\u65F6\u673A\u5236
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
=
10000
#\u8BF7\u6C42\u8FDE\u63A5\u7684\u8D85\u65F6\u65F6\u95F4
ribbon.ConnectTimeout
=
6000
#\u8BF7\u6C42\u5904\u7406\u7684\u8D85\u65F6\u65F6\u95F4
ribbon.ReadTimeout
=
6000
management.security.enabled
=
false
spring.zipkin.base-url
=
http://192.168.110.133:7895
spring.sleuth.sampler.percentage
=
1.0
logging.config
=
classpath:log4j2-test1.xml
\ No newline at end of file
logging.config
=
classpath:log4j2-test1.xml
wechat_url
=
https://test1-yunqueyilian.yunqueyi.com
\ No newline at end of file
server/src/main/resources/bootstrap-test2.properties
浏览文件 @
889088e3
server.port
=
8080
server.port
=
10601
server.context-path
=
/yunqueyilian
spring.application.name
=
${server.port}-pica-cloud-yunqueyilian
#config server settings
...
...
@@ -23,11 +24,24 @@ spring.rabbitmq.port=5672
spring.rabbitmq.username
=
appuser
spring.rabbitmq.password
=
AqLfvyWOvLQEUzdI
#\u5FAE\u4FE1\u767B\u5F55\u4FE1\u606F
AppID
=
wx1ee39338694703b0
AppSecret
=
69e2c741d0cf8fd7eb8877ab9f3a236b
#local settings
feign.hystrix.enabled
=
true
#\u5F00\u542Fhystrix\u8BF7\u6C42\u8D85\u65F6\u673A\u5236
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
=
10000
#\u8BF7\u6C42\u8FDE\u63A5\u7684\u8D85\u65F6\u65F6\u95F4
ribbon.ConnectTimeout
=
6000
#\u8BF7\u6C42\u5904\u7406\u7684\u8D85\u65F6\u65F6\u95F4
ribbon.ReadTimeout
=
6000
management.security.enabled
=
false
spring.zipkin.base-url
=
http://192.168.110.133:7895
spring.sleuth.sampler.percentage
=
1.0
logging.config
=
classpath:log4j2-test1.xml
\ No newline at end of file
logging.config
=
classpath:log4j2-test1.xml
wechat_url
=
https://test2-yunqueyilian.yunqueyi.com
\ No newline at end of file
server/src/main/resources/bootstrap-uat.properties
浏览文件 @
889088e3
server.port
=
8080
server.port
=
10601
server.context-path
=
/yunqueyilian
spring.application.name
=
${server.port}-pica-cloud-yunqueyilian
#config server settings
...
...
@@ -23,11 +24,24 @@ spring.rabbitmq.port=5672
spring.rabbitmq.username
=
picacloud
spring.rabbitmq.password
=
123456
#\u5FAE\u4FE1\u767B\u5F55\u4FE1\u606F
AppID
=
wx1ee39338694703b0
AppSecret
=
69e2c741d0cf8fd7eb8877ab9f3a236b
#local settings
feign.hystrix.enabled
=
true
#\u5F00\u542Fhystrix\u8BF7\u6C42\u8D85\u65F6\u673A\u5236
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
=
10000
#\u8BF7\u6C42\u8FDE\u63A5\u7684\u8D85\u65F6\u65F6\u95F4
ribbon.ConnectTimeout
=
6000
#\u8BF7\u6C42\u5904\u7406\u7684\u8D85\u65F6\u65F6\u95F4
ribbon.ReadTimeout
=
6000
management.security.enabled
=
false
spring.zipkin.base-url
=
http://192.168.110.141:7895
spring.sleuth.sampler.percentage
=
1.0
logging.config
=
classpath:log4j2-uat.xml
\ No newline at end of file
logging.config
=
classpath:log4j2-uat.xml
wechat_url
=
https://uat-yunqueyilian.yunqueyi.com
\ No newline at end of file
server/src/main/resources/mybatis-generator.xml
浏览文件 @
889088e3
...
...
@@ -6,7 +6,8 @@
<generatorConfiguration>
<!-- 数据库驱动:选择你的本地硬盘上面的数据库驱动包-->
<classPathEntry
location=
"D:/maven/repository/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar"
/>
<classPathEntry
location=
"C:\Users\DELL\.m2\repository\mysql\mysql-connector-java\5.1.39\mysql-connector-java-5.1.39.jar"
/>
<!--<classPathEntry location="D:/maven/repository/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar"/>-->
<context
id=
"tableEntity"
targetRuntime=
"MyBatis3"
>
<commentGenerator>
<property
name=
"suppressDate"
value=
"true"
/>
...
...
@@ -18,8 +19,8 @@
</commentGenerator>
<!--数据库链接URL,用户名、密码 -->
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
"jdbc:mysql://192.168.1
10.6
0:3306/pica"
userId=
"pica
_test"
password=
"pkv#sqvSGn@O1@tg
"
>
connectionURL=
"jdbc:mysql://192.168.1
30.20
0:3306/pica"
userId=
"pica
"
password=
"Joa5@73&8yAYJ2fe
"
>
</jdbcConnection>
<javaTypeResolver>
<property
name=
"forceBigDecimals"
value=
"false"
/>
...
...
@@ -38,7 +39,8 @@
<property
name=
"enableSubPackages"
value=
"true"
/>
</javaClientGenerator>
<table
tableName=
"pica.p_hospital"
domainObjectName=
"Hospital"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
></table>
<!--<table tableName="pica.p_hospital" domainObjectName="Hospital" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<table
tableName=
"pica.p_wechat_user"
domainObjectName=
"PWechatUser"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
></table>
</context>
</generatorConfiguration>
...
...
server/src/main/resources/mybatis/HospitalMapper.xml
已删除
100644 → 0
浏览文件 @
61230df8
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pica.cloud.wechat.yunqueyilian.server.mapper.HospitalMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pica.cloud.wechat.yunqueyilian.server.entity.Hospital"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"province_id"
property=
"provinceId"
jdbcType=
"INTEGER"
/>
<result
column=
"province_name"
property=
"provinceName"
jdbcType=
"VARCHAR"
/>
<result
column=
"city_id"
property=
"cityId"
jdbcType=
"BIGINT"
/>
<result
column=
"city_name"
property=
"cityName"
jdbcType=
"VARCHAR"
/>
<result
column=
"county_id"
property=
"countyId"
jdbcType=
"BIGINT"
/>
<result
column=
"county_name"
property=
"countyName"
jdbcType=
"VARCHAR"
/>
<result
column=
"town_id"
property=
"townId"
jdbcType=
"BIGINT"
/>
<result
column=
"town_name"
property=
"townName"
jdbcType=
"VARCHAR"
/>
<result
column=
"village_id"
property=
"villageId"
jdbcType=
"BIGINT"
/>
<result
column=
"village_name"
property=
"villageName"
jdbcType=
"VARCHAR"
/>
<result
column=
"name"
property=
"name"
jdbcType=
"VARCHAR"
/>
<result
column=
"hospital_address"
property=
"hospitalAddress"
jdbcType=
"VARCHAR"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"INTEGER"
/>
<result
column=
"delete_flag"
property=
"deleteFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"creat_id"
property=
"creatId"
jdbcType=
"INTEGER"
/>
<result
column=
"creat_time"
property=
"creatTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"modify_id"
property=
"modifyId"
jdbcType=
"INTEGER"
/>
<result
column=
"modify_time"
property=
"modifyTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"hospital_statistics_type"
property=
"hospitalStatisticsType"
jdbcType=
"INTEGER"
/>
<result
column=
"hospital_rank"
property=
"hospitalRank"
jdbcType=
"INTEGER"
/>
<result
column=
"hospital_alias"
property=
"hospitalAlias"
jdbcType=
"VARCHAR"
/>
<result
column=
"parent_id"
property=
"parentId"
jdbcType=
"INTEGER"
/>
<result
column=
"hospital_class"
property=
"hospitalClass"
jdbcType=
"VARCHAR"
/>
<result
column=
"hospital_level"
property=
"hospitalLevel"
jdbcType=
"VARCHAR"
/>
<result
column=
"hospital_grade"
property=
"hospitalGrade"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, province_id, province_name, city_id, city_name, county_id, county_name, town_id,
town_name, village_id, village_name, name, hospital_address, type, delete_flag, creat_id,
creat_time, modify_id, modify_time, hospital_statistics_type, hospital_rank, hospital_alias,
parent_id, hospital_class, hospital_level, hospital_grade
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from p_hospital
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from p_hospital
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.wechat.yunqueyilian.server.entity.Hospital"
>
insert into p_hospital (id, province_id, province_name,
city_id, city_name, county_id,
county_name, town_id, town_name,
village_id, village_name, name,
hospital_address, type, delete_flag,
creat_id, creat_time, modify_id,
modify_time, hospital_statistics_type, hospital_rank,
hospital_alias, parent_id, hospital_class,
hospital_level, hospital_grade)
values (#{id,jdbcType=INTEGER}, #{provinceId,jdbcType=INTEGER}, #{provinceName,jdbcType=VARCHAR},
#{cityId,jdbcType=BIGINT}, #{cityName,jdbcType=VARCHAR}, #{countyId,jdbcType=BIGINT},
#{countyName,jdbcType=VARCHAR}, #{townId,jdbcType=BIGINT}, #{townName,jdbcType=VARCHAR},
#{villageId,jdbcType=BIGINT}, #{villageName,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{hospitalAddress,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{deleteFlag,jdbcType=INTEGER},
#{creatId,jdbcType=INTEGER}, #{creatTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=INTEGER},
#{modifyTime,jdbcType=TIMESTAMP}, #{hospitalStatisticsType,jdbcType=INTEGER}, #{hospitalRank,jdbcType=INTEGER},
#{hospitalAlias,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{hospitalClass,jdbcType=VARCHAR},
#{hospitalLevel,jdbcType=VARCHAR}, #{hospitalGrade,jdbcType=VARCHAR})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pica.cloud.wechat.yunqueyilian.server.entity.Hospital"
>
insert into p_hospital
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"provinceId != null"
>
province_id,
</if>
<if
test=
"provinceName != null"
>
province_name,
</if>
<if
test=
"cityId != null"
>
city_id,
</if>
<if
test=
"cityName != null"
>
city_name,
</if>
<if
test=
"countyId != null"
>
county_id,
</if>
<if
test=
"countyName != null"
>
county_name,
</if>
<if
test=
"townId != null"
>
town_id,
</if>
<if
test=
"townName != null"
>
town_name,
</if>
<if
test=
"villageId != null"
>
village_id,
</if>
<if
test=
"villageName != null"
>
village_name,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"hospitalAddress != null"
>
hospital_address,
</if>
<if
test=
"type != null"
>
type,
</if>
<if
test=
"deleteFlag != null"
>
delete_flag,
</if>
<if
test=
"creatId != null"
>
creat_id,
</if>
<if
test=
"creatTime != null"
>
creat_time,
</if>
<if
test=
"modifyId != null"
>
modify_id,
</if>
<if
test=
"modifyTime != null"
>
modify_time,
</if>
<if
test=
"hospitalStatisticsType != null"
>
hospital_statistics_type,
</if>
<if
test=
"hospitalRank != null"
>
hospital_rank,
</if>
<if
test=
"hospitalAlias != null"
>
hospital_alias,
</if>
<if
test=
"parentId != null"
>
parent_id,
</if>
<if
test=
"hospitalClass != null"
>
hospital_class,
</if>
<if
test=
"hospitalLevel != null"
>
hospital_level,
</if>
<if
test=
"hospitalGrade != null"
>
hospital_grade,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"provinceId != null"
>
#{provinceId,jdbcType=INTEGER},
</if>
<if
test=
"provinceName != null"
>
#{provinceName,jdbcType=VARCHAR},
</if>
<if
test=
"cityId != null"
>
#{cityId,jdbcType=BIGINT},
</if>
<if
test=
"cityName != null"
>
#{cityName,jdbcType=VARCHAR},
</if>
<if
test=
"countyId != null"
>
#{countyId,jdbcType=BIGINT},
</if>
<if
test=
"countyName != null"
>
#{countyName,jdbcType=VARCHAR},
</if>
<if
test=
"townId != null"
>
#{townId,jdbcType=BIGINT},
</if>
<if
test=
"townName != null"
>
#{townName,jdbcType=VARCHAR},
</if>
<if
test=
"villageId != null"
>
#{villageId,jdbcType=BIGINT},
</if>
<if
test=
"villageName != null"
>
#{villageName,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"hospitalAddress != null"
>
#{hospitalAddress,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=INTEGER},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"creatId != null"
>
#{creatId,jdbcType=INTEGER},
</if>
<if
test=
"creatTime != null"
>
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifyId != null"
>
#{modifyId,jdbcType=INTEGER},
</if>
<if
test=
"modifyTime != null"
>
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"hospitalStatisticsType != null"
>
#{hospitalStatisticsType,jdbcType=INTEGER},
</if>
<if
test=
"hospitalRank != null"
>
#{hospitalRank,jdbcType=INTEGER},
</if>
<if
test=
"hospitalAlias != null"
>
#{hospitalAlias,jdbcType=VARCHAR},
</if>
<if
test=
"parentId != null"
>
#{parentId,jdbcType=INTEGER},
</if>
<if
test=
"hospitalClass != null"
>
#{hospitalClass,jdbcType=VARCHAR},
</if>
<if
test=
"hospitalLevel != null"
>
#{hospitalLevel,jdbcType=VARCHAR},
</if>
<if
test=
"hospitalGrade != null"
>
#{hospitalGrade,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pica.cloud.wechat.yunqueyilian.server.entity.Hospital"
>
update p_hospital
<set
>
<if
test=
"provinceId != null"
>
province_id = #{provinceId,jdbcType=INTEGER},
</if>
<if
test=
"provinceName != null"
>
province_name = #{provinceName,jdbcType=VARCHAR},
</if>
<if
test=
"cityId != null"
>
city_id = #{cityId,jdbcType=BIGINT},
</if>
<if
test=
"cityName != null"
>
city_name = #{cityName,jdbcType=VARCHAR},
</if>
<if
test=
"countyId != null"
>
county_id = #{countyId,jdbcType=BIGINT},
</if>
<if
test=
"countyName != null"
>
county_name = #{countyName,jdbcType=VARCHAR},
</if>
<if
test=
"townId != null"
>
town_id = #{townId,jdbcType=BIGINT},
</if>
<if
test=
"townName != null"
>
town_name = #{townName,jdbcType=VARCHAR},
</if>
<if
test=
"villageId != null"
>
village_id = #{villageId,jdbcType=BIGINT},
</if>
<if
test=
"villageName != null"
>
village_name = #{villageName,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"hospitalAddress != null"
>
hospital_address = #{hospitalAddress,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
type = #{type,jdbcType=INTEGER},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"creatId != null"
>
creat_id = #{creatId,jdbcType=INTEGER},
</if>
<if
test=
"creatTime != null"
>
creat_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifyId != null"
>
modify_id = #{modifyId,jdbcType=INTEGER},
</if>
<if
test=
"modifyTime != null"
>
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"hospitalStatisticsType != null"
>
hospital_statistics_type = #{hospitalStatisticsType,jdbcType=INTEGER},
</if>
<if
test=
"hospitalRank != null"
>
hospital_rank = #{hospitalRank,jdbcType=INTEGER},
</if>
<if
test=
"hospitalAlias != null"
>
hospital_alias = #{hospitalAlias,jdbcType=VARCHAR},
</if>
<if
test=
"parentId != null"
>
parent_id = #{parentId,jdbcType=INTEGER},
</if>
<if
test=
"hospitalClass != null"
>
hospital_class = #{hospitalClass,jdbcType=VARCHAR},
</if>
<if
test=
"hospitalLevel != null"
>
hospital_level = #{hospitalLevel,jdbcType=VARCHAR},
</if>
<if
test=
"hospitalGrade != null"
>
hospital_grade = #{hospitalGrade,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pica.cloud.wechat.yunqueyilian.server.entity.Hospital"
>
update p_hospital
set province_id = #{provinceId,jdbcType=INTEGER},
province_name = #{provinceName,jdbcType=VARCHAR},
city_id = #{cityId,jdbcType=BIGINT},
city_name = #{cityName,jdbcType=VARCHAR},
county_id = #{countyId,jdbcType=BIGINT},
county_name = #{countyName,jdbcType=VARCHAR},
town_id = #{townId,jdbcType=BIGINT},
town_name = #{townName,jdbcType=VARCHAR},
village_id = #{villageId,jdbcType=BIGINT},
village_name = #{villageName,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
hospital_address = #{hospitalAddress,jdbcType=VARCHAR},
type = #{type,jdbcType=INTEGER},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
creat_id = #{creatId,jdbcType=INTEGER},
creat_time = #{creatTime,jdbcType=TIMESTAMP},
modify_id = #{modifyId,jdbcType=INTEGER},
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
hospital_statistics_type = #{hospitalStatisticsType,jdbcType=INTEGER},
hospital_rank = #{hospitalRank,jdbcType=INTEGER},
hospital_alias = #{hospitalAlias,jdbcType=VARCHAR},
parent_id = #{parentId,jdbcType=INTEGER},
hospital_class = #{hospitalClass,jdbcType=VARCHAR},
hospital_level = #{hospitalLevel,jdbcType=VARCHAR},
hospital_grade = #{hospitalGrade,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
server/src/main/resources/mybatis/PWechatUserMapper.xml
0 → 100644
浏览文件 @
889088e3
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pica.cloud.wechat.yunqueyilian.server.mapper.PWechatUserMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pica.cloud.wechat.yunqueyilian.server.entity.PWechatUser"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"openid"
property=
"openid"
jdbcType=
"VARCHAR"
/>
<result
column=
"patient_id"
property=
"patientId"
jdbcType=
"INTEGER"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"INTEGER"
/>
<result
column=
"sex"
property=
"sex"
jdbcType=
"INTEGER"
/>
<result
column=
"nickname"
property=
"nickname"
jdbcType=
"VARCHAR"
/>
<result
column=
"province"
property=
"province"
jdbcType=
"VARCHAR"
/>
<result
column=
"city"
property=
"city"
jdbcType=
"VARCHAR"
/>
<result
column=
"country"
property=
"country"
jdbcType=
"VARCHAR"
/>
<result
column=
"headimgurl"
property=
"headimgurl"
jdbcType=
"VARCHAR"
/>
<result
column=
"privilege"
property=
"privilege"
jdbcType=
"VARCHAR"
/>
<result
column=
"unionid"
property=
"unionid"
jdbcType=
"VARCHAR"
/>
<result
column=
"subscribe"
property=
"subscribe"
jdbcType=
"INTEGER"
/>
<result
column=
"language"
property=
"language"
jdbcType=
"VARCHAR"
/>
<result
column=
"subscribe_time"
property=
"subscribeTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"remark"
property=
"remark"
jdbcType=
"VARCHAR"
/>
<result
column=
"groupid"
property=
"groupid"
jdbcType=
"VARCHAR"
/>
<result
column=
"tagid_list"
property=
"tagidList"
jdbcType=
"VARCHAR"
/>
<result
column=
"delete_flag"
property=
"deleteFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"created_id"
property=
"creatId"
jdbcType=
"INTEGER"
/>
<result
column=
"created_time"
property=
"creatTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"modified_id"
property=
"modifyId"
jdbcType=
"INTEGER"
/>
<result
column=
"modified_time"
property=
"modifyTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, openid, patient_id, type, sex, nickname, province, city, country, headimgurl,
privilege, unionid, subscribe, language, subscribe_time, remark, groupid, tagid_list,
delete_flag, created_id, created_time, modified_id, modified_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.wechat.yunqueyilian.server.entity.PWechatUser"
>
insert into pat_wechat_user (openid, patient_id,
type, sex, nickname,
province, city, country,
headimgurl, privilege, unionid,
subscribe, language, subscribe_time,
remark, groupid, tagid_list,
delete_flag, created_id, created_time,
modified_id, modified_time)
values (#{openid,jdbcType=VARCHAR}, #{patientId,jdbcType=INTEGER},
#{type,jdbcType=INTEGER}, #{sex,jdbcType=INTEGER}, #{nickname,jdbcType=VARCHAR},
#{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{country,jdbcType=VARCHAR},
#{headimgurl,jdbcType=VARCHAR}, #{privilege,jdbcType=VARCHAR}, #{unionid,jdbcType=VARCHAR},
#{subscribe,jdbcType=INTEGER}, #{language,jdbcType=VARCHAR}, #{subscribeTime,jdbcType=TIMESTAMP},
#{remark,jdbcType=VARCHAR}, #{groupid,jdbcType=VARCHAR}, #{tagidList,jdbcType=VARCHAR},
#{deleteFlag,jdbcType=INTEGER}, #{creatId,jdbcType=INTEGER}, now(),
#{modifyId,jdbcType=INTEGER}, now())
</insert>
<update
id=
"updateById"
parameterType=
"com.pica.cloud.wechat.yunqueyilian.server.entity.PWechatUser"
>
update pat_wechat_user
<set>
<if
test=
"openid != null"
>
openid = #{openid,jdbcType=VARCHAR},
</if>
<if
test=
"patientId != null"
>
patient_id = #{patientId,jdbcType=INTEGER},
</if>
<if
test=
"type != null"
>
type = #{type,jdbcType=INTEGER},
</if>
<if
test=
"sex != null"
>
sex = #{sex,jdbcType=INTEGER},
</if>
<if
test=
"nickname != null"
>
nickname = #{nickname,jdbcType=VARCHAR},
</if>
<if
test=
"province != null"
>
province = #{province,jdbcType=VARCHAR},
</if>
<if
test=
"city != null"
>
city = #{city,jdbcType=VARCHAR},
</if>
<if
test=
"country != null"
>
country = #{country,jdbcType=VARCHAR},
</if>
<if
test=
"headimgurl != null"
>
headimgurl = #{headimgurl,jdbcType=VARCHAR},
</if>
<if
test=
"privilege != null"
>
privilege = #{privilege,jdbcType=VARCHAR},
</if>
<if
test=
"unionid != null"
>
unionid = #{unionid,jdbcType=VARCHAR},
</if>
<if
test=
"subscribe != null"
>
subscribe = #{subscribe,jdbcType=INTEGER},
</if>
<if
test=
"language != null"
>
language = #{language,jdbcType=VARCHAR},
</if>
<if
test=
"subscribeTime != null"
>
subscribe_time = #{subscribeTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"remark != null"
>
remark = #{remark,jdbcType=VARCHAR},
</if>
<if
test=
"groupid != null"
>
groupid = #{groupid,jdbcType=VARCHAR},
</if>
<if
test=
"tagidList != null"
>
tagid_list = #{tagidList,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"creatId != null"
>
created_id = #{creatId,jdbcType=INTEGER},
</if>
<if
test=
"creatTime != null"
>
created_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifyId != null"
>
modified_id = #{modifyId,jdbcType=INTEGER},
</if>
modified_time = now()
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<select
id=
"queryByOpenId"
resultMap=
"BaseResultMap"
parameterType=
"java.util.Map"
>
select
<include
refid=
"Base_Column_List"
/>
from pat_wechat_user
where type = #{type} and openid = #{openId}
</select>
<update
id=
"updateSubscribeById"
parameterType=
"com.pica.cloud.wechat.yunqueyilian.server.entity.PWechatUser"
>
update pat_wechat_user set subscribe = #{subscribe},modified_time = now() where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录