Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
caosy
/
fun-common
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
147382ac
authored
Aug 03, 2018
by
chongli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信小程序
parent
88e2b4d9
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
405 additions
and
4 deletions
fun-common-core/pom.xml
fun-common-soa/src/main/java/com/ctrip/fun/golf/api/payment/NotifyController.java
fun-common-soa/src/main/java/com/ctrip/fun/golf/api/weixin/WeiXinController.java
fun-common-soa/src/main/java/com/ctrip/fun/golf/service/weixin/WeiXinService.java
fun-common-soa/src/main/resources/base.spring.xml
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherGetLogBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherItemDTO.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherQueryDto.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherRuleBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherShareLogBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherSourceEnum.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/user/MiniAppLoginBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/user/MiniAppLoginResultBean.java
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/user/WeChatAppLoginReq.java
fun-common-core/pom.xml
View file @
147382ac
...
...
@@ -71,5 +71,16 @@
<artifactId>
jackson-databind
</artifactId>
<version>
2.2.3
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-ext-jdk16
</artifactId>
<version>
1.46
</version>
</dependency>
<dependency>
<groupId>
com.thoughtworks.xstream
</groupId>
<artifactId>
xstream
</artifactId>
<version>
1.4.7
</version>
</dependency>
</dependencies>
</project>
fun-common-soa/src/main/java/com/ctrip/fun/golf/api/payment/NotifyController.java
View file @
147382ac
...
...
@@ -39,6 +39,19 @@ public class NotifyController {
return
notifyResponseBean
;
}
/**
* 支付通知
*
* @param createPayOrderRequestBean CreatePayOrderRequestBean
*/
@ResponseBody
@RequestMapping
(
value
=
"/miniApp"
,
method
=
RequestMethod
.
POST
)
public
Object
notifyForMiniApp
(
@RequestBody
PaymentResponse
paymentResponse
,
@PathVariable
String
orderType
)
{
NotifyResponseBean
notifyResponseBean
=
this
.
notifyService
.
notify
(
paymentResponse
,
orderType
);
return
notifyResponseBean
;
}
public
NotifyService
getNotifyService
()
{
return
notifyService
;
}
...
...
fun-common-soa/src/main/java/com/ctrip/fun/golf/api/weixin/WeiXinController.java
0 → 100644
View file @
147382ac
/**
* Copyright 2014 CTRIP Co.,Ltd. All rights reserved.
*/
package
com
.
ctrip
.
fun
.
golf
.
api
.
weixin
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.ctrip.fun.common.vo.Request
;
import
com.ctrip.fun.common.vo.Response
;
import
com.ctrip.fun.common.vo.ResponseStatusEnum
;
import
com.ctrip.fun.golf.service.weixin.WeiXinService
;
/**
* @author zgsong
* @version 1.0.0
*/
@Controller
@RequestMapping
(
value
=
"/weiXin"
)
public
class
WeiXinController
{
@Autowired
private
WeiXinService
weiXinService
;
/**
* 创建支付交易
*
* @param createPayOrderRequestBean CreatePayOrderRequestBean
*/
@ResponseBody
@RequestMapping
(
value
=
"/jscodeToSessionPath"
,
method
=
RequestMethod
.
POST
)
public
Response
<
String
>
createPayOrder
(
@RequestBody
Request
<
String
>
request
)
{
Response
<
String
>
response
=
new
Response
<
String
>();
response
.
setBody
(
weiXinService
.
jscodeToSessionPath
(
request
.
getBody
()).
getBody
());
response
.
setStatus
(
ResponseStatusEnum
.
SUCCESS
.
getValue
());
return
response
;
}
}
fun-common-soa/src/main/java/com/ctrip/fun/golf/service/weixin/WeiXinService.java
0 → 100644
View file @
147382ac
/**
* Copyright 2014 CTRIP Co.,Ltd. All rights reserved.
*/
package
com
.
ctrip
.
fun
.
golf
.
service
.
weixin
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.client.RestTemplate
;
/**
* 微信服务
*
* @author zgsong
* @version 1.0.0
*/
public
class
WeiXinService
{
/**
*微信jscodeToSession
*/
private
String
jscodeToSessionPath
=
"https://api.weixin.qq.com/sns/jscode2session"
;
public
ResponseEntity
<
String
>
jscodeToSessionPath
(
String
code
)
{
String
APPID
=
"wx51a2695abf1a0b12"
;
String
SECRET
=
"d2be0d1219f11d0a4373380e9f959de9"
;
String
url
=
jscodeToSessionPath
+
"?appid="
+
APPID
+
"&secret="
+
SECRET
+
"&js_code="
+
code
+
"&grant_type=authorization_code"
;
RestTemplate
restTemplate
=
new
RestTemplate
();
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
GET
,
null
,
String
.
class
);
return
responseEntity
;
}
}
fun-common-soa/src/main/resources/base.spring.xml
View file @
147382ac
...
...
@@ -132,8 +132,7 @@
<property
name=
"proxyHostname"
value=
"${proxyHost}"
></property>
<property
name=
"proxyPort"
value=
"${proxyPort}"
></property>
</bean>
<bean
name=
"weiXinService"
class=
"com.ctrip.fun.golf.service.weixin.WeiXinService"
>
</bean>
</beans>
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherGetLogBean.java
0 → 100644
View file @
147382ac
/**
* Copyright 2014 CTRIP Co.,Ltd. All rights reserved.
*/
package
com
.
ctrip
.
fun
.
common
.
vo
.
basic
;
import
java.io.Serializable
;
import
java.util.Date
;
public
class
VoucherGetLogBean
implements
Serializable
{
/**
* serialVersionUID
*/
private
static
final
long
serialVersionUID
=
-
5198881174057011384L
;
/**
* 主键
*/
private
Integer
id
;
/**
* 分享日志表中的id
*/
private
String
shareid
;
/**
* 抢券人的uid
*/
private
String
uid
;
/**
* 抢走的券id
*/
private
Integer
voucherid
;
/**
* 抢券时间
*/
private
Date
getTime
;
public
Integer
getId
()
{
return
id
;
}
public
String
getShareid
()
{
return
shareid
;
}
public
String
getUid
()
{
return
uid
;
}
public
Integer
getVoucherid
()
{
return
voucherid
;
}
public
Date
getGetTime
()
{
return
getTime
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
void
setShareid
(
String
shareid
)
{
this
.
shareid
=
shareid
;
}
public
void
setUid
(
String
uid
)
{
this
.
uid
=
uid
;
}
public
void
setVoucherid
(
Integer
voucherid
)
{
this
.
voucherid
=
voucherid
;
}
public
void
setGetTime
(
Date
getTime
)
{
this
.
getTime
=
getTime
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherItemDTO.java
View file @
147382ac
...
...
@@ -44,6 +44,7 @@ public class VoucherItemDTO implements Serializable {
private
int
multiple
;
private
String
multiAmount
;
private
Integer
onlyMe
;
//是否本人使用1是本人使用;0是非本人使用
private
Integer
isShare
;
//是否正在分享中
public
void
doExecuteNullField
()
{
if
(
description
==
null
)
{
...
...
@@ -270,4 +271,13 @@ public class VoucherItemDTO implements Serializable {
this
.
onlyMe
=
onlyMe
;
}
public
Integer
getIsShare
()
{
return
isShare
;
}
public
void
setIsShare
(
Integer
isShare
)
{
this
.
isShare
=
isShare
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherQueryDto.java
View file @
147382ac
...
...
@@ -16,6 +16,10 @@ public class VoucherQueryDto extends AbstractPagedQuery {
private
String
uid
;
private
Integer
type
;
private
Integer
used
;
//优惠券是否过期
private
Integer
expired
;
//优惠券是否可分享
private
Integer
shared
;
// 新增的字段
private
Integer
resourceId
;
...
...
@@ -112,4 +116,20 @@ public class VoucherQueryDto extends AbstractPagedQuery {
this
.
redeemCode
=
redeemCode
;
}
public
Integer
getExpired
()
{
return
expired
;
}
public
void
setExpired
(
Integer
expired
)
{
this
.
expired
=
expired
;
}
public
Integer
getShared
()
{
return
shared
;
}
public
void
setShared
(
Integer
shared
)
{
this
.
shared
=
shared
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherRuleBean.java
View file @
147382ac
...
...
@@ -157,6 +157,11 @@ public class VoucherRuleBean implements java.io.Serializable {
*/
private
int
onlyMe
;
//仅限本人使用:1是;0否
/**
* 是否可分享
*/
private
int
shared
;
//是否可分享:1是;0否
@SuppressWarnings
(
"rawtypes"
)
public
AbstractRuleConditionBean
getRuleCondition
()
{
...
...
@@ -402,4 +407,12 @@ public class VoucherRuleBean implements java.io.Serializable {
this
.
onlyMe
=
onlyMe
;
}
public
int
getShared
()
{
return
shared
;
}
public
void
setShared
(
int
shared
)
{
this
.
shared
=
shared
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherShareLogBean.java
0 → 100644
View file @
147382ac
/**
* Copyright 2014 CTRIP Co.,Ltd. All rights reserved.
*/
package
com
.
ctrip
.
fun
.
common
.
vo
.
basic
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
public
class
VoucherShareLogBean
implements
Serializable
{
/**
* serialVersionUID
*/
private
static
final
long
serialVersionUID
=
-
5198881174057011384L
;
/**
* 主键
*/
private
Integer
id
;
/**
* 分享人id
*/
private
String
uid
;
/**
* 传入的参数:被分享的券id
*/
private
String
voucherIds
;
/**
* 本次分享日志中,所有被分享的券信息
*/
private
List
<
VoucherItemDTO
>
voucherList
;
/**
* 分享发生时间
*/
private
Date
createTime
;
public
Integer
getId
()
{
return
id
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
String
getUid
()
{
return
uid
;
}
public
String
getVoucherIds
()
{
return
voucherIds
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
void
setUid
(
String
uid
)
{
this
.
uid
=
uid
;
}
public
void
setVoucherIds
(
String
voucherIds
)
{
this
.
voucherIds
=
voucherIds
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
List
<
VoucherItemDTO
>
getVoucherList
()
{
return
voucherList
;
}
public
void
setVoucherList
(
List
<
VoucherItemDTO
>
voucherList
)
{
this
.
voucherList
=
voucherList
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/basic/VoucherSourceEnum.java
View file @
147382ac
...
...
@@ -15,7 +15,9 @@ public enum VoucherSourceEnum {
RULE_JOB
(
2
,
"通过发送规则Job发放"
),
RULE_RIGHT_NOW
(
3
,
"立刻发送"
);
RULE_RIGHT_NOW
(
3
,
"立刻发送"
),
RULE_FRIEND_PRESENT
(
4
,
"好友赠送"
);
private
int
value
;
private
String
msg
;
...
...
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/user/MiniAppLoginBean.java
0 → 100644
View file @
147382ac
package
com
.
ctrip
.
fun
.
common
.
vo
.
user
;
import
java.io.Serializable
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
MiniAppLoginBean
implements
Serializable
{
private
String
token
;
private
String
userMobilePhone
;
private
String
verifyCode
;
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
String
getUserMobilePhone
()
{
return
userMobilePhone
;
}
public
void
setUserMobilePhone
(
String
userMobilePhone
)
{
this
.
userMobilePhone
=
userMobilePhone
;
}
public
String
getVerifyCode
()
{
return
verifyCode
;
}
public
void
setVerifyCode
(
String
verifyCode
)
{
this
.
verifyCode
=
verifyCode
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/user/MiniAppLoginResultBean.java
0 → 100644
View file @
147382ac
package
com
.
ctrip
.
fun
.
common
.
vo
.
user
;
import
java.io.Serializable
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
MiniAppLoginResultBean
implements
Serializable
{
private
String
token
;
private
String
userMobilePhone
;
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
String
getUserMobilePhone
()
{
return
userMobilePhone
;
}
public
void
setUserMobilePhone
(
String
userMobilePhone
)
{
this
.
userMobilePhone
=
userMobilePhone
;
}
}
fun-common-vo/src/main/java/com/ctrip/fun/common/vo/user/WeChatAppLoginReq.java
0 → 100644
View file @
147382ac
package
com
.
ctrip
.
fun
.
common
.
vo
.
user
;
import
java.io.Serializable
;
public
class
WeChatAppLoginReq
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1770264954143496552L
;
private
String
code
;
private
String
rawData
;
private
String
encryptedData
;
private
String
iv
;
private
String
signature
;
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getRawData
()
{
return
rawData
;
}
public
void
setRawData
(
String
rawData
)
{
this
.
rawData
=
rawData
;
}
public
String
getEncryptedData
()
{
return
encryptedData
;
}
public
void
setEncryptedData
(
String
encryptedData
)
{
this
.
encryptedData
=
encryptedData
;
}
public
String
getIv
()
{
return
iv
;
}
public
void
setIv
(
String
iv
)
{
this
.
iv
=
iv
;
}
public
String
getSignature
()
{
return
signature
;
}
public
void
setSignature
(
String
signature
)
{
this
.
signature
=
signature
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment