|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.kiisoo.ic.customer;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
@ -665,102 +666,46 @@ public class CustomerService {
|
|
|
|
|
return results;
|
|
|
|
|
}
|
|
|
|
|
Long shopId = stafferInfoVOS.get(0).getStoreId();
|
|
|
|
|
List<FriendDTO> thisList;
|
|
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
|
|
IPage<FriendDTO> thisList;
|
|
|
|
|
// PageHelper.startPage(pageNum, pageSize);
|
|
|
|
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<FriendDTO> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum,pageSize);
|
|
|
|
|
|
|
|
|
|
if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
|
|
|
|
|
// 0、新增好友 1、累计好友
|
|
|
|
|
if (flag == 0) {
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, startDate, endDate, type);
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(page,shopId, sellerId, search, startDate, endDate, type);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopIdAndDate(shopId, sellerId, search, startDate, endDate, type);
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopIdAndDate(page, shopId, sellerId, search, startDate, endDate, type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(thisList)) {
|
|
|
|
|
for (int i = 0; i < thisList.size(); i++) {
|
|
|
|
|
if (CollectionUtils.isNotEmpty(thisList.getRecords())) {
|
|
|
|
|
for (int i = 0; i < thisList.getRecords().size(); i++) {
|
|
|
|
|
// 设置导购名称
|
|
|
|
|
if (!thisList.get(i).getInviteSellerId().equals(0L)) {
|
|
|
|
|
if (!thisList.getRecords().get(i).getInviteSellerId().equals(0L)) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("id", thisList.get(i).getInviteSellerId());
|
|
|
|
|
String userName = poiStoreStaffDOMapper.selectUserNameById(thisList.get(i).getInviteSellerId());
|
|
|
|
|
map.put("id", thisList.getRecords().get(i).getInviteSellerId());
|
|
|
|
|
String userName = poiStoreStaffDOMapper.selectUserNameById(thisList.getRecords().get(i).getInviteSellerId());
|
|
|
|
|
if (StringUtils.isNotEmpty(userName)) {
|
|
|
|
|
thisList.get(i).setInviteSellerName(userName);
|
|
|
|
|
thisList.getRecords().get(i).setInviteSellerName(userName);
|
|
|
|
|
} else {
|
|
|
|
|
thisList.get(i).setInviteSellerName("");
|
|
|
|
|
thisList.getRecords().get(i).setInviteSellerName("");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
thisList.get(i).setInviteSellerName("");
|
|
|
|
|
thisList.getRecords().get(i).setInviteSellerName("");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 0、新增好友 1、累计好友
|
|
|
|
|
if (flag == 0) {
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, startDate, endDate, type);
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(page, userId, search, startDate, endDate, type);
|
|
|
|
|
} else {
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySellerAndDate(userId, search, startDate, endDate, type);
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySellerAndDate(page, userId, search, startDate, endDate, type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
results.put("this", new PageInfo<>(thisList));
|
|
|
|
|
return results;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param userId
|
|
|
|
|
* @param sellerId
|
|
|
|
|
* @param search
|
|
|
|
|
* @param roleCode
|
|
|
|
|
*/
|
|
|
|
|
public Map<String, Object> listCustomer(Long userId, Long sellerId, String search, String roleCode, Integer type, Date startDate, Date endDate) throws Exception {
|
|
|
|
|
Map<String, Object> results = new HashMap<>();
|
|
|
|
|
Date thisDate = new Date();
|
|
|
|
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, -24);
|
|
|
|
|
Date lastDate = dateFormat.parse(dateFormat.format(calendar.getTime()));
|
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, -24);
|
|
|
|
|
Date earlyDate = dateFormat.parse(dateFormat.format(calendar.getTime()));
|
|
|
|
|
List<StafferInfoVO> stafferInfoVOS = poiStoreStaffDOMapper.selectInfoById(userId);
|
|
|
|
|
if (CollectionUtils.isEmpty(stafferInfoVOS)) {
|
|
|
|
|
results.put("this", null);
|
|
|
|
|
results.put("last", null);
|
|
|
|
|
results.put("early", null);
|
|
|
|
|
return results;
|
|
|
|
|
}
|
|
|
|
|
Long shopId = stafferInfoVOS.get(0).getStoreId();
|
|
|
|
|
if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
|
|
|
|
|
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, startDate, endDate, type);
|
|
|
|
|
thisList.forEach(friendDTO -> {
|
|
|
|
|
String inviteSellerName = opSellerCustomerRelationDOMapper.selectStaffName(friendDTO.getInviteSellerId());
|
|
|
|
|
if (StringUtils.isNotBlank(inviteSellerName)) {
|
|
|
|
|
friendDTO.setInviteSellerName(inviteSellerName);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, lastDate, lastDate, type);
|
|
|
|
|
lastList.forEach(friendDTO -> {
|
|
|
|
|
String inviteSellerName = opSellerCustomerRelationDOMapper.selectStaffName(friendDTO.getInviteSellerId());
|
|
|
|
|
if (StringUtils.isNotBlank(inviteSellerName)) {
|
|
|
|
|
friendDTO.setInviteSellerName(inviteSellerName);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, null, earlyDate, type);
|
|
|
|
|
earlyList.forEach(friendDTO -> {
|
|
|
|
|
String inviteSellerName = opSellerCustomerRelationDOMapper.selectStaffName(friendDTO.getInviteSellerId());
|
|
|
|
|
if (StringUtils.isNotBlank(inviteSellerName)) {
|
|
|
|
|
friendDTO.setInviteSellerName(inviteSellerName);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
results.put("this", thisList);
|
|
|
|
|
results.put("last", lastList);
|
|
|
|
|
results.put("early", earlyList);
|
|
|
|
|
} else {
|
|
|
|
|
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, startDate, endDate, type);
|
|
|
|
|
results.put("this", thisList);
|
|
|
|
|
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, lastDate, lastDate, type);
|
|
|
|
|
results.put("last", lastList);
|
|
|
|
|
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, null, earlyDate, type);
|
|
|
|
|
results.put("early", earlyList);
|
|
|
|
|
}
|
|
|
|
|
results.put("this", new PageInfo<>(thisList.getRecords()));
|
|
|
|
|
return results;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|