好友列表接口优化,增加分页。

master
kevin jiang 6 years ago
parent db8c524f14
commit 15d434a2c6

@ -3,6 +3,7 @@ package com.kiisoo.ic.customer;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.gson.Gson;
import com.kiisoo.ic.constants.Constants;
import com.kiisoo.ic.customer.bean.CustomerDTO;
@ -518,68 +519,33 @@ public class CustomerService {
* @author dexiang.jiang
* @date 2020/05/10 21:50
*/
public Map<String, Object> listCustomerNew(Long userId, Long sellerId, String search, String roleCode, Integer type, Date startDate, Date endDate, int flag) throws Exception {
public Map<String, Object> listCustomerNew(Long userId, Long sellerId, String search, String roleCode, Integer type, Date startDate, Date endDate, int flag, int pageNum, int pageSize) 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();
List<FriendDTO> thisList;
PageHelper.startPage(pageNum, pageSize);
if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
List<FriendDTO> thisList;
// 0、新增好友 1、累计好友
if(flag == 0){
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, startDate, endDate, type);
}else{
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopIdAndDate(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;
// 0、新增好友 1、累计好友
if(flag == 0){
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, startDate, endDate, type);
}else{
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySellerAndDate(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));
return results;
}

@ -88,11 +88,11 @@ public class CustomerController extends BaseController {
@RequestParam("type") Integer type,
Date startDate,
Date endDate,
String version, @RequestParam("flag") int flag){
String version, @RequestParam("flag") int flag,int pageNum, int pageSize){
try {
Map<String, Object> stringObjectMap;
if(StringUtils.isNotBlank(version)){
stringObjectMap = customerService.listCustomerNew(userId, sellerId, search, roleCode, type, startDate, endDate, flag);
stringObjectMap = customerService.listCustomerNew(userId, sellerId, search, roleCode, type, startDate, endDate, flag, pageNum, pageSize);
}else{
stringObjectMap = customerService.listCustomer(userId, sellerId, search, roleCode, type, startDate, endDate);
}

Loading…
Cancel
Save