diff --git a/src/main/java/com/kiisoo/ic/customer/CustomerService.java b/src/main/java/com/kiisoo/ic/customer/CustomerService.java index 31b6541..59a0746 100644 --- a/src/main/java/com/kiisoo/ic/customer/CustomerService.java +++ b/src/main/java/com/kiisoo/ic/customer/CustomerService.java @@ -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 listCustomerNew(Long userId, Long sellerId, String search, String roleCode, Integer type, Date startDate, Date endDate, int flag) throws Exception { + public Map listCustomerNew(Long userId, Long sellerId, String search, String roleCode, Integer type, Date startDate, Date endDate, int flag, int pageNum, int pageSize) throws Exception { Map 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 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 thisList; + PageHelper.startPage(pageNum, pageSize); if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) { - List 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 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 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 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 lastList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, lastDate, lastDate, type); -// results.put("last", lastList); -// List earlyList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, null, earlyDate, type); -// results.put("early", earlyList); } + results.put("this", new PageInfo<>(thisList)); + return results; } diff --git a/src/main/java/com/kiisoo/ic/customer/controller/CustomerController.java b/src/main/java/com/kiisoo/ic/customer/controller/CustomerController.java index 5721d27..afe7577 100644 --- a/src/main/java/com/kiisoo/ic/customer/controller/CustomerController.java +++ b/src/main/java/com/kiisoo/ic/customer/controller/CustomerController.java @@ -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 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); }