Commit 0d09c753 by zhangchen

1.添加点击领券功能

parent d453a91f
......@@ -25,6 +25,7 @@ import com.ctrip.fun.common.vo.basic.VoucherGetLogBean;
import com.ctrip.fun.common.vo.basic.VoucherItemDTO;
import com.ctrip.fun.common.vo.basic.VoucherQueryDto;
import com.ctrip.fun.common.vo.basic.VoucherQueryRequestDTO;
import com.ctrip.fun.common.vo.basic.VoucherRequestDto;
import com.ctrip.fun.common.vo.basic.VoucherShareLogBean;
import com.ctrip.fun.common.vo.basic.VoucherShareLogQuery;
import com.ctrip.fun.common.vo.membership.MbsOrderBean;
......@@ -257,5 +258,26 @@ public class VoucherMController {
voucherQuery.setUid(UserContext.getUserId());
return voucherService.getRedeemCodeForMallOrder(voucherQuery);
}
/**
* 用户是否拥有指定券
*/
@ResponseBody
@Security
@RequestMapping(value = "/voucher/findUserVoucherById", method = RequestMethod.GET, params = { "token", "voucherId" })
public Object findUserVoucherById(@RequestParam String token, VoucherRequestDto voucherQuery) {
voucherQuery.setUid(UserContext.getUserId());
return voucherService.findUserVoucherById(voucherQuery);
}
/**
* 发送指定券
*/
@ResponseBody
@Security
@RequestMapping(value = "/voucher/sendVoucherToUser", method = RequestMethod.GET, params = { "token", "voucherId" })
public Object sendVoucherToUser(@RequestParam String token, VoucherRequestDto voucherQuery) {
Response<Boolean> response = voucherService.addVourcherRoleUsers(voucherQuery.getVoucherId(), UserContext.getUserId());
return response;
}
}
package com.ctrip.fun.golf.service.basic;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -16,6 +17,7 @@ import com.ctrip.fun.common.vo.basic.VoucherGetLogBean;
import com.ctrip.fun.common.vo.basic.VoucherItemDTO;
import com.ctrip.fun.common.vo.basic.VoucherQueryDto;
import com.ctrip.fun.common.vo.basic.VoucherQueryRequestDTO;
import com.ctrip.fun.common.vo.basic.VoucherRequestDto;
import com.ctrip.fun.common.vo.basic.VoucherShareLogBean;
import com.ctrip.fun.common.vo.basic.VoucherShareLogQuery;
import com.ctrip.fun.golf.service.BaseService;
......@@ -268,4 +270,32 @@ public class VoucherMService extends BaseService {
}
return response;
}
public Object findUserVoucherById(VoucherRequestDto query) {
String uri = super.getServiceUri("uri.voucher.findUserVoucherById");
HttpEntity<Request<VoucherRequestDto>> entity = new HttpEntity<Request<VoucherRequestDto>>(new Request<VoucherRequestDto>(null, query));
Response<Boolean> response = new Response<Boolean>();
try {
response = super.exchange(uri, HttpMethod.POST, entity, new ParameterizedTypeReference<Response<Boolean>>() {}).getBody();
} catch (Exception e) {
logger.error(e.getMessage());
return response;
}
return response;
}
/**
* @param id
* @param userIds
*/
public Response<Boolean> addVourcherRoleUsers(int id, String userids) {
String uri = super.getServiceUri("uri.voucherRule.addVoucherRoleUsers").replace("{id}",
String.valueOf(id));
Request<String> request = new Request<String>("", userids);
HttpEntity<Request<String>> entity = new HttpEntity<Request<String>>(request);
Response<Boolean> response = super.exchange(uri, HttpMethod.POST, entity,
new ParameterizedTypeReference<Response<Boolean>>() {
}).getBody();
return response;
}
}
......@@ -129,6 +129,8 @@ uri.voucher.queryListForTourOrder=/fun-golf-service/Voucher/queryListForTourOrde
uri.voucher.queryListForEventActivityOrder=/fun-golf-service/Voucher/queryListForEventActivityOrder
uri.voucher.queryListForMallOrder=/fun-golf-service/Voucher/queryListForMallOrder
uri.voucher.getRedeemCodeForMallOrder=/fun-golf-service/Voucher/getRedeemCodeForMallOrder
uri.voucher.findUserVoucherById=/fun-golf-service/Voucher/findUserVoucherById
uri.voucherRule.addVoucherRoleUsers=/fun-golf-service/voucherRule/addVoucherRoleUsers/{id}
uri.tour.search=/fun-golf-service/tour/search
uri.tour.cities=/fun-golf-service/tour/cities
......
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