Commit 147382ac by chongli

微信小程序

parent 88e2b4d9
......@@ -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>
......@@ -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;
}
......
/**
* 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;
}
}
/**
* 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;
}
}
......@@ -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>
/**
* 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;
}
}
......@@ -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;
}
}
......@@ -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;
}
}
......@@ -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;
}
}
/**
* 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;
}
}
......@@ -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;
......
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;
}
}
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;
}
}
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;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment