Commit a6dc4ee5 by chongli

后台券分享记录查询

parent 4e33c7ca
......@@ -46,6 +46,7 @@ import com.ctrip.fun.admin.service.basic.DistrictService;
import com.ctrip.fun.admin.service.basic.EntityImageService;
import com.ctrip.fun.admin.service.basic.PrePayCardService;
import com.ctrip.fun.admin.service.basic.SubDistrictService;
import com.ctrip.fun.admin.service.basic.VoucherShareLogService;
import com.ctrip.fun.admin.service.finance.CourseBalanceService;
import com.ctrip.fun.admin.service.finance.CoursePayeeService;
import com.ctrip.fun.admin.service.friend.FriendService;
......@@ -105,6 +106,7 @@ import com.ctrip.fun.common.vo.basic.TagBean;
import com.ctrip.fun.common.vo.basic.UserExtQuery;
import com.ctrip.fun.common.vo.basic.UserPrepayCardInfoBean;
import com.ctrip.fun.common.vo.basic.UserPrepayCardLogQuery;
import com.ctrip.fun.common.vo.basic.VoucherItemDTO;
import com.ctrip.fun.common.vo.market.EventGameGroupBean;
import com.ctrip.fun.common.vo.market.EventGameGroupQuery;
import com.ctrip.fun.common.vo.market.EventGamePlayerBean;
......@@ -250,6 +252,9 @@ public class JsonController {
@Autowired
private EventCustomerInfoService eventCustomerInfoService = null;
@Autowired
private VoucherShareLogService voucherShareLogService = null;
@Value("${imageEndpoint}")
private String imageEndpoint;
......@@ -2448,4 +2453,16 @@ public class JsonController {
}
return response;
}
@RequestMapping(value = "/getVouchersByShareId", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public Response<List<VoucherItemDTO>> getVouchersByShareId(HttpServletRequest request, @RequestParam(value = "shareId", required = false) Integer shareId) {
Response<List<VoucherItemDTO>> response = new Response<List<VoucherItemDTO>>();
response.setStatus(ResponseStatusEnum.SUCCESS.getValue());
response.setMessage(ResponseStatusEnum.SUCCESS.getMsg());
List<VoucherItemDTO> vouchers = voucherShareLogService.getVouchersByShareId(shareId);
response.setBody(vouchers);
return response;
}
}
package com.ctrip.fun.admin.controller.basic;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.ctrip.fun.admin.form.PaginationForm;
import com.ctrip.fun.admin.service.basic.VoucherShareLogService;
import com.ctrip.fun.common.vo.PagedResponseBean;
import com.ctrip.fun.common.vo.basic.VoucherShareLogBean;
import com.ctrip.fun.common.vo.basic.VoucherShareLogQuery;
/**
* @author gaoc
*/
@Controller
@RequestMapping("/voucherShareLog")
public class VoucherShareLogController {
@Autowired
private VoucherShareLogService voucherShareLogService;
@RequestMapping(value = "/queryList", method = RequestMethod.GET)
public String queryList(HttpServletRequest request,@ModelAttribute("dto") VoucherShareLogQuery query, ModelMap model) {
int currentPage = 0;
int pageSize;
int total;
int pageCount;
if (null != request.getParameter("page")) {
try {
currentPage = Integer.parseInt(request.getParameter("page"));
} catch (Exception e) {
}
}
query.setPagerOffset(currentPage * query.getPagerPerPage());
query.setSortField("createTime");
PagedResponseBean<VoucherShareLogBean> response = voucherShareLogService.queryList(query);
pageSize = query.getPagerPerPage();
total = response.getCount();
pageCount = (0 == total % pageSize) ? (total / pageSize) : (total / pageSize + 1);
model.put("list", response.getResult());
model.put("dto", query);
model.put("paginationData", new PaginationForm(currentPage, pageSize, pageCount, total));
return "basic/voucherShareLog/list";
}
}
package com.ctrip.fun.admin.service.basic;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.web.client.RestClientException;
import com.ctrip.fun.admin.service.BaseService;
import com.ctrip.fun.common.vo.PagedResponseBean;
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.common.vo.basic.VoucherItemDTO;
import com.ctrip.fun.common.vo.basic.VoucherShareLogBean;
import com.ctrip.fun.common.vo.basic.VoucherShareLogQuery;
public class VoucherShareLogService extends BaseService {
private static final Logger logger = LoggerFactory.getLogger(VoucherShareLogService.class);
/**
* 获取现金券规则列表
*/
public PagedResponseBean<VoucherShareLogBean> queryList(VoucherShareLogQuery query) {
PagedResponseBean<VoucherShareLogBean> responseBean = new PagedResponseBean<VoucherShareLogBean>(0,
new ArrayList<VoucherShareLogBean>());
String uri = super.getServiceUri("uri.vouchershareLog.queryList");
Request<VoucherShareLogQuery> request = new Request<VoucherShareLogQuery>("", query);
HttpEntity<Request<VoucherShareLogQuery>> entity = new HttpEntity<Request<VoucherShareLogQuery>>(request);
Response<PagedResponseBean<VoucherShareLogBean>> response = null;
try {
response = super.exchange(uri, HttpMethod.POST, entity,new ParameterizedTypeReference<Response<PagedResponseBean<VoucherShareLogBean>>>() {}).getBody();
} catch (RestClientException e) {
logger.error(e.getMessage());
}
if (null != response && response.getStatus() == ResponseStatusEnum.SUCCESS.getValue()) {
responseBean = response.getBody();
} else {
logger.error("{} status: {}, msg: {}", "获取现金券分享列表", response.getStatus(),
response.getMessage());
}
return responseBean;
}
/**
* 获取现金券规则列表
*/
public List<VoucherItemDTO> getVouchersByShareId(Integer shareId) {
List<VoucherItemDTO> responseBean = new ArrayList<VoucherItemDTO>();
String uri = super.getServiceUri("uri.vouchershareLog.getVouchersByShareId");
Request<Integer> request = new Request<Integer>("", shareId);
HttpEntity<Request<Integer>> entity = new HttpEntity<Request<Integer>>(request);
Response<List<VoucherItemDTO>> response = null;
try {
response = super.exchange(uri, HttpMethod.POST, entity,new ParameterizedTypeReference<Response<List<VoucherItemDTO>>>() {}).getBody();
} catch (RestClientException e) {
logger.error(e.getMessage());
}
if (null != response && response.getStatus() == ResponseStatusEnum.SUCCESS.getValue()) {
responseBean = response.getBody();
} else {
logger.error("{} status: {}, msg: {}", "获取现金券分享列表", response.getStatus(),
response.getMessage());
}
return responseBean;
}
}
......@@ -244,6 +244,8 @@
<!-- 现金券 -->
<bean name="voucherRuleService" class="com.ctrip.fun.admin.service.basic.VoucherRuleService"
parent="baseService" />
<!-- 现金券分享记录 -->
<bean name="voucherShareLogService" class="com.ctrip.fun.admin.service.basic.VoucherShareLogService" parent="baseService" />
<!-- Finance -->
<bean name="courseFinanceService"
class="com.ctrip.fun.admin.service.finance.CourseFinanceService"
......
......@@ -430,6 +430,10 @@ uri.voucherRule.modify=/fun-golf-service/voucherRule/modify
uri.voucherRule.updateValidFlag=/fun-golf-service/voucherRule/updateValidFlag
uri.voucherRule.addVoucherRoleUsers=/fun-golf-service/voucherRule/addVoucherRoleUsers/{id}
#voucherShareLog
uri.vouchershareLog.queryList=/fun-golf-service/voucherShareLog/queryList
uri.vouchershareLog.getVouchersByShareId=/fun-golf-service/voucherShareLog/getVouchersByShareId
#CourseFinance
uri.courseFinance.queryCourseOrderForFinance=/fun-golf-service/courseFinance/queryCourseOrderForFinance
uri.courseFinance.queryCourseOrderForDayFinance=/fun-golf-service/courseFinance/queryCourseOrderForDayFinance
......
<#assign pageJsContent>
<script>
$(".detail").click(
function () {
$.ajax({
url: "/j/getVouchersByShareId",
type: "get",
data: {
shareId: this.getAttribute('shareid')
},
success: function (obj) {
var template = Handlebars.compile($("#table_template_supplier").html());
$('#supplierList').html(template(obj));
$("#supplierModal").modal('show');
}
})
}
);
</script>
</#assign>
<#assign pageCssContent>
<style>
.table th, .table td{ text-align:center;vertical-align:middle;}
.widthShow {
width: 1100px;
}
</style>
</#assign>
<@com.layout title="查询现金券规则" module="marketing" current="voucherShareLog_list" pageCss=pageCssContent pageJs=pageJsContent>
<form class="form-inline search-box widthShow" action="" method="get" autocomplete="off" >
<@com.textInput "dto.uid" "style=\"margin-left: 5px;\"" "分享人UID"/>
<@com.textInput "dto.id" "style=\"margin-left: 5px;\"" "分享记录ID"/>
<@com.textInputTwoDate "dto.startCreateTime" "dto.endCreateTime" "style=\"margin-left: 5px;\"" "创建时间"/>
<button type="submit" class="btn btn-primary">查询</button>
<button type="button" class="btn btn-success" onclick="javascript:location.href='/voucherShareLog/queryList';" style="margin-left:20px;">重置</button>
</form>
<table class="table table-bordered table-striped widthShow">
<thead>
<tr>
<th style="width:5%">ID</th>
<th style="width:5%">分享人UID</th>
<th style="width:20%">创建时间</th>
<th style="width:15%">状态</th>
<th style="width:5%">被抢量/券总量</th>
</tr>
</thead>
<tbody>
<#list list as item>
<tr>
<td>${item.id!}</td>
<td style="text-align:center">${item.uid!}</td>
<td>${item.createTime?string("yyyy-MM-dd HH:mm:ss")}</td>
<td style="text-align:center">${item.statusDesc!}</td>
<td style="text-align:center"> <a class="detail" shareid='${item.id!}'>${item.sharedVoucherAmount!}/${item.voucherAmount!}</a> </td>
</tr>
</#list>
</tbody>
</table>
<div class="modal hide fade" id="supplierModal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3>券详情</h3>
</div>
<div class="modal-body">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>金额</th>
<th>有效期</th>
<th>是否被抢</th>
<th>抢券人</th>
</tr>
</thead>
<tbody id="supplierList">
</tbody>
</table>
<div class="pagination pagination-mini">
<ul>
</ul>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
</div>
</div>
<div class="pagination pagination-right widthShow">
<ul>
<@paginator.first />
<@paginator.previous />
<@paginator.numbers separator=""/>
<@paginator.next />
<@paginator.last />
</ul>
<@paginator.statistics />
</div>
<script id="table_template_supplier" type="text/x-handlebars-template">
{{#each body}}
<tr>
<td>{{id}}</td>
<td>{{amount}}</td>
<td>{{startUseDate}}~{{endUseDate}}</td>
<td>{{alreadyShared}}</td>
<td>{{qiangQuanUid}}</td>
</tr>
{{/each}}
</script>
</@com.layout>
\ No newline at end of file
......@@ -255,6 +255,9 @@ ${pageCss}
<li <#if current == "voucher_list">class="active"</#if>>
<a href="/voucher/queryList">使用列表</a>
</li>
<li <#if current == "voucherShareLog_list">class="active"</#if>>
<a href="/voucherShareLog/queryList">现金券分享记录</a>
</li>
<li class="nav-header">签到</li>
<li <#if current == "sign_get">class="active"</#if>>
......
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