diff --git a/src/main/java/com/kiisoo/ic/customer/CustomerService.java b/src/main/java/com/kiisoo/ic/customer/CustomerService.java index 6b62abc..de1703d 100644 --- a/src/main/java/com/kiisoo/ic/customer/CustomerService.java +++ b/src/main/java/com/kiisoo/ic/customer/CustomerService.java @@ -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 thisList; - PageHelper.startPage(pageNum, pageSize); + IPage thisList; +// PageHelper.startPage(pageNum, pageSize); + com.baomidou.mybatisplus.extension.plugins.pagination.Page 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 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 listCustomer(Long userId, Long sellerId, String search, String roleCode, Integer type, Date startDate, Date endDate) 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(); - if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) { - List 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 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 = opSellerCustomerRelationDOMapper.selectFriendListBySeller(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.getRecords())); 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 4a9d3d7..0cb1ea6 100644 --- a/src/main/java/com/kiisoo/ic/customer/controller/CustomerController.java +++ b/src/main/java/com/kiisoo/ic/customer/controller/CustomerController.java @@ -90,12 +90,7 @@ public class CustomerController extends BaseController { Date endDate, 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, pageNum, pageSize); - }else{ - stringObjectMap = customerService.listCustomer(userId, sellerId, search, roleCode, type, startDate, endDate); - } + Map stringObjectMap = customerService.listCustomerNew(userId, sellerId, search, roleCode, type, startDate, endDate, flag, pageNum, pageSize); return data(stringObjectMap); } catch (Exception e) { log.error("查询好友列表:",e); diff --git a/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java b/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java index b29b8ad..9e951f1 100644 --- a/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java +++ b/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java @@ -1,6 +1,8 @@ package com.kiisoo.ic.customer.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.kiisoo.ic.customer.bean.FriendDTO; import com.kiisoo.ic.customer.entity.OpSellerCustomerRelation; import org.apache.ibatis.annotations.Param; @@ -25,7 +27,7 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper selectFriendListBySeller(@Param("userId") Long userId, + IPage selectFriendListBySeller(Page page,@Param("userId") Long userId, @Param("search") String search, @Param("startDate") Date startDate, @Param("endDate") Date endDate, @@ -41,12 +43,12 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper selectFriendListByShopId(@Param("shopId") Long shopId, - @Param("sellerId") Long sellerId, - @Param("search") String search, - @Param("startDate") Date startDate, - @Param("endDate") Date endDate, - @Param("type") Integer type); + IPage selectFriendListByShopId(Page page, @Param("shopId") Long shopId, + @Param("sellerId") Long sellerId, + @Param("search") String search, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate, + @Param("type") Integer type); /** * 根据导购id查询导购名 @@ -73,7 +75,7 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper selectFriendListByShopIdAndDate(@Param("shopId") Long shopId, + IPage selectFriendListByShopIdAndDate(Page page, @Param("shopId") Long shopId, @Param("sellerId") Long sellerId, @Param("search") String search, @Param("startDate") Date startDate, @@ -91,7 +93,7 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper selectFriendListBySellerAndDate(@Param("userId") Long userId, + IPage selectFriendListBySellerAndDate(Page page,@Param("userId") Long userId, @Param("search") String search, @Param("startDate") Date startDate, @Param("endDate") Date endDate, @@ -99,7 +101,6 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper> selectCustomersByCpUserId(); diff --git a/src/main/java/com/kiisoo/ic/store/bean/PoiStoreStaffDTO.java b/src/main/java/com/kiisoo/ic/store/bean/PoiStoreStaffDTO.java index 543b9f3..cbfb707 100644 --- a/src/main/java/com/kiisoo/ic/store/bean/PoiStoreStaffDTO.java +++ b/src/main/java/com/kiisoo/ic/store/bean/PoiStoreStaffDTO.java @@ -2,10 +2,12 @@ package com.kiisoo.ic.store.bean; import com.kiisoo.ic.store.entity.PoiStoreStaff; import lombok.Data; +import lombok.EqualsAndHashCode; /** * 店铺人员具体信息 */ +@EqualsAndHashCode(callSuper = true) @Data public class PoiStoreStaffDTO extends PoiStoreStaff { /**名称*/