From 15d434a2c68bce90e627d6cb7c56afd4ea658864 Mon Sep 17 00:00:00 2001 From: kevin jiang Date: Thu, 14 May 2020 20:39:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E5=88=97=E8=A1=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BC=98=E5=8C=96=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kiisoo/ic/customer/CustomerService.java | 46 +++---------------- .../controller/CustomerController.java | 4 +- 2 files changed, 8 insertions(+), 42 deletions(-) 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); }