Commit 9cb03dac authored by jay's avatar jay

云迹查询修改

parent c3e382b3
......@@ -208,6 +208,7 @@
}
function cleanVisitTime() {
$("#signTimeNew").val("");
$("#seeStartTime").val("");
$("#seeEndTime").val("");
return false;
......@@ -262,6 +263,7 @@
click: function () {
$(this).dialog("close");
window.open("/house365-hgs-web/cloudcustomer/list/" + $("#activeId").val(), "_self");
// window.open("/house365-hgs-web/cloudcustomer/list/" + $("#activeId").val(), "_blank");
return true;
}
}
......
package com.house365.ws.interfaces.impl;
import com.house365.beans.entity.CloudActivityEntity;
import com.house365.beans.entity.CloudCustomerEntity;
import com.house365.beans.entity.CustomerEntity;
import com.house365.beans.entity.UserEntity;
......@@ -7,8 +8,7 @@ import com.house365.ws.beans.request.MapListRequest;
import com.house365.ws.beans.response.MapListResponse;
import com.house365.ws.beans.util.HResult;
import com.house365.ws.cached.RedisUtilsInterface;
import com.house365.ws.dao.mapper.CloudCustomerMapper;
import com.house365.ws.dao.mapper.CustomerMapper;
import com.house365.ws.dao.mapper.*;
import com.house365.ws.interfaces.server.ICloudCustomerInterface;
import com.house365.ws.system.ReturnResult;
import org.apache.commons.collections4.CollectionUtils;
......@@ -34,11 +34,19 @@ public class CloudCustomerImpl implements ICloudCustomerInterface {
private CustomerMapper customerMapper;
@Autowired
private RedisUtilsInterface redisUtil;
@Autowired
private CloudActivityMapper activityMapper;
@Autowired
private CustomerCallbackMapper callbackMapper;
@Autowired
private CustomerStatusLogMapper statusLogMapper;
@Override
public MapListResponse list(MapListRequest request, int activeId) {
MapListResponse response = new MapListResponse();
try {
CloudActivityEntity activityEntity = activityMapper.getById(activeId);
int type = activityEntity.getType();
Map<String, Object> map = new HashMap<>(10);
Map<String, Object> searchParams = request.getSearchParams();
map.put("city", searchParams.get("city"));
......@@ -60,42 +68,133 @@ public class CloudCustomerImpl implements ICloudCustomerInterface {
if (null != searchParams.get("status")) {
int status = Integer.parseInt(searchParams.get("status").toString());
int backStatus = Integer.parseInt(searchParams.get("backStatus").toString());
String backIdKey = "cloud_back_id" + activeId;
String seeIdKey = "cloud_see_Id" + activeId;
String daoIdKey = "cloud_dao_Id" + activeId;
String buyIdKey = "cloud_buy_Id" + activeId;
String signIdKey = "cloud_sign_Id" + activeId;
String cancelIdKey = "cloud_cancel_Id" + activeId;
String renIdKey = "cloud_ren_Id" + activeId;
list = mapper.queryList(map);
if (backStatus == 1) {
String value = redisUtil.getValByKey(backIdKey);
dealList(list, value);
} else if (backStatus == 2) {
String value = redisUtil.getValByKey(backIdKey);
list.removeIf(l -> value.contains(l.get("phone").toString()));
}
if (status == 1) {
String value = redisUtil.getValByKey(seeIdKey);
dealList(list, value);
} else if (status == 2) {
String value = redisUtil.getValByKey(daoIdKey);
dealList(list, value);
} else if (status == 3) {
String value = redisUtil.getValByKey(renIdKey);
dealList(list, value);
} else if (status == 4) {
String value = redisUtil.getValByKey(buyIdKey);
dealList(list, value);
} else if (status == 5) {
String value = redisUtil.getValByKey(signIdKey);
dealList(list, value);
} else if (status == 6) {
String value = redisUtil.getValByKey(cancelIdKey);
dealList(list, value);
if (type == 0) {
String backIdKey = "cloud_back_id" + activeId;
String seeIdKey = "cloud_see_Id" + activeId;
String daoIdKey = "cloud_dao_Id" + activeId;
String buyIdKey = "cloud_buy_Id" + activeId;
String signIdKey = "cloud_sign_Id" + activeId;
String cancelIdKey = "cloud_cancel_Id" + activeId;
String renIdKey = "cloud_ren_Id" + activeId;
list = mapper.queryList(map);
if (backStatus == 1) {
String value = redisUtil.getValByKey(backIdKey);
dealList(list, value);
} else if (backStatus == 2) {
String value = redisUtil.getValByKey(backIdKey);
list.removeIf(l -> value.contains(l.get("phone").toString()));
}
if (status == 1) {
String value = redisUtil.getValByKey(seeIdKey);
dealList(list, value);
} else if (status == 2) {
String value = redisUtil.getValByKey(daoIdKey);
dealList(list, value);
} else if (status == 3) {
String value = redisUtil.getValByKey(renIdKey);
dealList(list, value);
} else if (status == 4) {
String value = redisUtil.getValByKey(buyIdKey);
dealList(list, value);
} else if (status == 5) {
String value = redisUtil.getValByKey(signIdKey);
dealList(list, value);
} else if (status == 6) {
String value = redisUtil.getValByKey(cancelIdKey);
dealList(list, value);
}
} else {
list = mapper.queryList(map);
if (status > 0 || backStatus > 0) {
Map<String, Object> searchMap = new HashMap<>(10);
searchMap.put("activeId", activeId);
searchMap.put("type", 2);
List<CloudCustomerEntity> cloudList = mapper.queryByConditions(searchMap);
List<Integer> idList = new ArrayList<>();
List<Integer> seaIdList = new ArrayList<>();
List<Integer> idAllList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(cloudList)) {
cloudList.forEach(c -> {
if (c.getManagerId() > 0) {
idList.add(c.getCustomerId());
} else {
seaIdList.add(c.getCustomerId());
}
});
Date time = cloudList.get(0).getCreateTime();
dealList(idList, idAllList, time, 1);
dealSeaList(seaIdList, idAllList, time);
idAllList = removeDuplicate(idAllList);
Map<String, Object> backMap = new HashMap<>(10);
backMap.put("idList", idAllList);
backMap.put("notId", 1);
if (backStatus > 0 && CollectionUtils.isNotEmpty(idAllList)) {
StringBuilder builderBack = new StringBuilder();
List<String> backKeyIdList = new ArrayList<>();
List<Map<String, Object>> backList = callbackMapper.queryCloudBackCount(backMap);
if (CollectionUtils.isNotEmpty(backList)) {
backList.forEach(s -> backKeyIdList.add(s.get("phone").toString()));
backKeyIdList.forEach(s -> builderBack.append(s).append(","));
}
String value = builderBack.toString();
if (backStatus == 1) {
dealList(list, value);
} else if (backStatus == 2) {
list.removeIf(l -> value.contains(l.get("phone").toString()));
}
}
if (status > 0 && CollectionUtils.isNotEmpty(idAllList)) {
Map<String, Object> queryMap = new HashMap<>(5);
StringBuilder builder1 = new StringBuilder();
StringBuilder builder2 = new StringBuilder();
StringBuilder builder3 = new StringBuilder();
StringBuilder builder4 = new StringBuilder();
StringBuilder builder5 = new StringBuilder();
StringBuilder builder6 = new StringBuilder();
if (status == 1) {
queryMap.put("status", 1);
List<Map<String, Object>> seeList = statusLogMapper.queryCloudCount(queryMap);
seeList.forEach(s -> builder1.append(s.get("phone").toString()).append(","));
String value = builder1.toString();
dealList(list, value);
} else if (status == 2) {
queryMap.put("status", 2);
List<Map<String, Object>> daoList = statusLogMapper.queryCloudCount(queryMap);
daoList.forEach(s -> builder2.append(s.get("phone").toString()).append(","));
String value = builder2.toString();
dealList(list, value);
} else if (status == 3) {
queryMap.put("status", 3);
List<Map<String, Object>> renList = statusLogMapper.queryCloudCount(queryMap);
renList.forEach(s -> builder3.append(s.get("phone").toString()).append(","));
String value = builder3.toString();
dealList(list, value);
} else if (status == 4) {
queryMap.put("status", 4);
List<Map<String, Object>> buyList = statusLogMapper.queryCloudCount(queryMap);
buyList.forEach(s -> builder4.append(s.get("phone").toString()).append(","));
String value = builder4.toString();
dealList(list, value);
} else if (status == 5) {
queryMap.put("status", 5);
List<Map<String, Object>> signList = statusLogMapper.queryCloudCount(queryMap);
signList.forEach(s -> builder5.append(s.get("phone").toString()).append(","));
String value = builder5.toString();
dealList(list, value);
} else if (status == 6) {
queryMap.put("status", 6);
List<Map<String, Object>> cancelList = statusLogMapper.queryCloudCount(queryMap);
cancelList.forEach(s -> builder6.append(s.get("phone").toString()).append(","));
String value = builder6.toString();
dealList(list, value);
}
}
}
}
}
int total = list.size();
List<Map<String, Object>> subList = new ArrayList<>();
//手动分页,需要先查出全部然后筛选重新分页
for (int i = 0; i <= total; i++) {
// 开始索引
......@@ -147,6 +246,58 @@ public class CloudCustomerImpl implements ICloudCustomerInterface {
return response;
}
private static List removeDuplicate(List<Integer> list) {
HashSet<Integer> h = new HashSet<>(list);
list.clear();
list.addAll(h);
return list;
}
private void dealList(List<Integer> idList, List<Integer> idAllList, Date time, int type) {
for (Integer id : idList) {
CustomerEntity entity = customerMapper.queryById(id);
if (null != entity && StringUtils.isNotBlank(entity.getPhone()) && entity.getManagerId() != null) {
String phone = entity.getPhone();
Map<String, Object> map = new HashMap<>(10);
map.put("phone", phone);
map.put("isPrivate", 1);
int managerId = entity.getManagerId();
map.put("managerId", managerId);
if (type == 1) {
map.put("createTime", time);
}
List<CustomerEntity> customerList = customerMapper.queryByConditions(map);
if (CollectionUtils.isNotEmpty(customerList)) {
for (CustomerEntity c : customerList) {
idAllList.add(c.getId());
}
}
}
}
}
private void dealSeaList(List<Integer> seaIdList, List<Integer> idAllList, Date time) {
for (Integer id : seaIdList) {
CustomerEntity entity = customerMapper.queryById(id);
if (null != entity && StringUtils.isNotBlank(entity.getPhone()) && StringUtils.isNotBlank(entity.getLastManager())) {
String phone = entity.getPhone();
String lastManager = entity.getLastManager();
Map<String, Object> map = new HashMap<>(10);
map.put("phone", phone);
map.put("isPrivate", 1);
map.put("lastManager", lastManager);
map.put("createTime", time);
List<CustomerEntity> customerList = customerMapper.queryByConditions(map);
if (CollectionUtils.isNotEmpty(customerList)) {
for (CustomerEntity c : customerList) {
idAllList.add(c.getId());
}
}
}
}
}
private void dealList(List<Map<String, Object>> list, String value) {
Iterator<Map<String, Object>> iterator = list.iterator();
while (iterator.hasNext()) {
......
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 to comment