Commit d1e32013 by chongli

社员批量绑定功能

parent 21dd3672
......@@ -4,6 +4,7 @@ package com.ctrip.fun.admin.controller.communeservice;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -85,6 +86,53 @@ public class CommuneAdmController {
return "market/communeAdm/list";
}
@RequestMapping(value = "centralizedBind", method = RequestMethod.GET)
public String centralizedBind(HttpServletRequest request, String mobileOfcommunes, ModelMap model) {
Response<List<AdminUserBean>> adminsresponse = userDetailsService.getCommuneAdmUserList(null);
List<AdminUserBean> adminBeanList = adminsresponse.getBody();
model.put("adminBeanList", adminBeanList);
if(mobileOfcommunes==null){
List<CommuneAdmBean> list = new ArrayList<CommuneAdmBean>();
model.put("bindedList", list);
model.put("unBindedList", list);
model.put("nonCommuneAdm", list);
}else{
List<CommuneAdmBean> allMobile= new ArrayList<CommuneAdmBean>();
String[] mobiles = mobileOfcommunes.split(",");
for(String mobile:mobiles){
CommuneAdmBean bean = new CommuneAdmBean();
bean.setMobilePhone(mobile);
allMobile.add(bean);
}
List<CommuneAdmBean> bindedCommune = communeAdmService.findBindedCommuneByMobilePhones(mobileOfcommunes);
List<CommuneAdmBean> communeByMobilePhones = communeAdmService.findCommuneByMobilePhones(mobileOfcommunes);
List<CommuneAdmBean> list = new ArrayList<CommuneAdmBean>();
CommuneAdmBean bean = new CommuneAdmBean();
bean.setId(1);
bean.setMobilePhone("15012174236");
list.add(bean);
CommuneAdmBean bean1 = new CommuneAdmBean();
bean1.setId(1);
bean1.setMobilePhone("15012174236");
list.add(bean1);
model.put("bindedList", bindedCommune);
allMobile.removeAll(communeByMobilePhones);
communeByMobilePhones.removeAll(bindedCommune);
model.put("unBindedList", communeByMobilePhones);
model.put("nonCommuneAdm", allMobile);
}
model.put("mobileOfcommunes",mobileOfcommunes);
return "market/communeAdm/centralizedBind";
}
@RequestMapping(value = "excel", method = RequestMethod.GET)
public String excel(HttpServletResponse response, @ModelAttribute("dto") CommuneAdmQuery query, ModelMap model) {
query.setPagerPerPage(Integer.MAX_VALUE);
......
......@@ -49,7 +49,47 @@ public class CommuneAdmService extends BaseService{
return responseBean;
}
public List<CommuneAdmBean> findBindedCommuneByMobilePhones(String mobilePhones) {
String uri = super.getServiceUri("uri.communeAdm.findBindedCommuneByMobilePhones");
List<CommuneAdmBean> responseBean = new ArrayList<CommuneAdmBean>();
Request<String> request = new Request<String>("", mobilePhones);
HttpEntity<Request<String>> entity = new HttpEntity<Request<String>>(request);
Response<List<CommuneAdmBean>> response = null;
try {
response = super.exchange(uri, HttpMethod.POST, entity,new ParameterizedTypeReference<Response<List<CommuneAdmBean>>>() {
}).getBody();
} catch (RestClientException e) {
e.printStackTrace();
}
if (response != null && response.getStatus() == 0) {
responseBean = response.getBody();
} else {
logger.error(String.format("[公社会员扩展列表获取异常] status: %d, msg: %s", response.getStatus(),
response.getMessage()));
}
return responseBean;
}
public List<CommuneAdmBean> findCommuneByMobilePhones(String mobilePhones) {
String uri = super.getServiceUri("uri.communeAdm.findCommuneByMobilePhones");
List<CommuneAdmBean> responseBean = new ArrayList<CommuneAdmBean>();
Request<String> request = new Request<String>("", mobilePhones);
HttpEntity<Request<String>> entity = new HttpEntity<Request<String>>(request);
Response<List<CommuneAdmBean>> response = null;
try {
response = super.exchange(uri, HttpMethod.POST, entity,new ParameterizedTypeReference<Response<List<CommuneAdmBean>>>() {
}).getBody();
} catch (RestClientException e) {
e.printStackTrace();
}
if (response != null && response.getStatus() == 0) {
responseBean = response.getBody();
} else {
logger.error(String.format("[公社会员扩展列表获取异常] status: %d, msg: %s", response.getStatus(),
response.getMessage()));
}
return responseBean;
}
public PagedResponseBean<CommuneAdmBean> myBindList(CommuneAdmQuery query) {
String uri = super.getServiceUri("uri.communeAdm.myBindList");
......
......@@ -502,6 +502,8 @@ uri.communeExt.activeCustomer.updateOpenOrderPerson=/fun-golf-service/activeCust
#communeAdm
uri.communeAdm.findBindedCommuneByMobilePhones=/fun-golf-service/communeAdm/findBindedCommuneByMobilePhones
uri.communeAdm.findCommuneByMobilePhones=/fun-golf-service/communeAdm/findCommuneByMobilePhones
uri.communeAdm.list=/fun-golf-service/communeAdm/list
uri.communeAdm.batchBind=/fun-golf-service/communeAdm/batchBind
uri.communeAdm.batchUnbind=/fun-golf-service/communeAdm/batchUnbind
......
......@@ -506,13 +506,16 @@ ${pageCss}
</ul>
<#elseif module=="communeAdm">
<ul class="nav nav-list">
<li class="nav-header"社员管理</li>
<li class="nav-header">社员管理</li>
<li <#if current == "communeAdm_list">class="active"</#if>>
<a href="/communeservice/communeAdm/queryList">绑定管理员</a>
</li>
<li <#if current == "communeAdm_myBindList">class="active"</#if>>
<a href="/communeservice/communeAdm/myBindList">我管理的社员</a>
</li>
<li <#if current == "communeAdm_centralizedBind">class="active"</#if>>
<a href="/communeservice/communeAdm/centralizedBind">集中绑定</a>
</li>
<li class="nav-header">用户下单行为分析</li>
<li <#if current == "userOrderBehaviour_listUserCourseOrderBehaviour">class="active"</#if>>
<a href="/communeservice/userOrderBehaviour/listUserCourseOrderBehaviour?statisticsType=1">单订场下单</a>
......
<#assign pageJsContent>
<script>
//未绑定区域权限和全不选
function unBindCheckAll(){
if($('#unBind').is(':checked')) {
$(".UnBind :checkbox").prop("checked", true);
}else{
$(".UnBind :checkbox").prop("checked", false);
}
}
//绑定区域权限和全不选
function bindedCheckAll(){
if($('#binded').is(':checked')) {
$(".binded :checkbox").prop("checked", true);
}else{
$(".binded :checkbox").prop("checked", false);
}
}
//检查数据
$('#information').click(function () {
var $textArea = $('#js-textarea'),
textArea = $textArea.val();
if(textArea.indexOf(",") != -1){
alert("请将待校验的手机号英文逗号分割");
return false;
}
this.submit();
});
//批量绑定操作
$('#bindAdmBtn').click(function () {
var checkboxes = $('[name="datacheck"]:checked');
var chgids="";
var admUserId = $('#adminName').val();
if(checkboxes.length==0){
alert('请选中要绑定的社员');
return;
}
if(admUserId==0){
alert('请选择销售');
return;
}
checkboxes.each(function () {
chgids = chgids + $(this).attr("value") + ",";
});
chgids = chgids.substr(0, chgids.length - 1);
$(this).button('loading');
$.post("/communeservice/communeAdm/batchBind",{"communeExtIds":chgids,"admUserId":admUserId} ,function(msg){
if (msg['status'] == 0) {
location.reload();
}else{
alert(msg['message']);
$('#servicebtn').button("hide");
}
});
});
</script>
</#assign>
<#assign pageCssContent>
</#assign>
<@com.layout title="查询公社会员" module="communeAdm" current="communeAdm_centralizedBind" pageCss=pageCssContent pageJs=pageJsContent>
<form id="formId" class="form-inline search-box widthShow" action="/communeservice/communeAdm/centralizedBind" method="get" autocomplete="off" >
<div class="row">
<div class="span6">
<textarea name="mobileOfcommunes" id="js-textarea" rows="8" style="width:550px" placeholder="待校验社员电话,英文逗号分割,例15013241233,15013241233,15013241233">${mobileOfcommunes!}</textarea>
</div>
<div class="span3">
<select id="adminName" name="bindedAdm">
<option value="0">销售选择</option>
<#list adminBeanList as item>
<option value="${item.id}" >${item.nickName}</option>
</#list>
</select>
</div>
<div class="span3" style="margin-top:50px">
<button class="btn btn-primary" type="submit" style="margin-right:52px;" id="information">信息检查</button>
<button class="btn btn-primary" type="button" id="bindAdmBtn" >绑定销售</button>
</div>
</div>
</form>
<div class="row">
<div class="span3">
<table class="table UnBind">
<tr>
<td align="left"> <input type="checkbox" id="unBind" onclick="unBindCheckAll();"> </td> <th>未绑定销售</th>
</tr>
<#list unBindedList as item>
<tr>
<td align="left"><input type="checkbox" name="datacheck" value="${item.id}"></td> <td>${item.mobilePhone!}</td>
</tr>
</#list>
</table>
</div>
<div class="span3 binded">
<table class="table">
<tr>
<td align="left"> <input type="checkbox" id="binded" onclick="bindedCheckAll();"> </td> <th>已绑定销售</th>
</tr>
<#list bindedList as item>
<tr>
<td align="left"><input type="checkbox" name="datacheck" value="${item.id}"></td> <td>${item.mobilePhone!}</td>
</tr>
</#list>
</table>
</div>
<div class="span3">
<table class="table">
<tr>
<th align="center">未注册用户</th>
</tr>
<#list nonCommuneAdm as item>
<tr >
<td align="center">${item.mobilePhone!}</td>
</tr>
</#list>
</table>
</div>
</div>
</@com.layout>
\ No newline at end of file
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