From 91d1783481f6514ec367fd5baaa86de108cc48df Mon Sep 17 00:00:00 2001 From: kevin jiang Date: Sun, 10 May 2020 22:30:16 +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=BF=AE=E6=94=B9=E5=92=8C=E4=BC=98=E5=8C=96=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E9=80=9F=E5=BA=A6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kiisoo/ic/customer/CustomerService.java | 47 +++++-- .../controller/CustomerController.java | 4 +- .../OpSellerCustomerRelationDOMapper.java | 36 ++++++ .../OpSellerCustomerRelationDOMapper.xml | 116 +++++++++++++++--- 4 files changed, 172 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/kiisoo/ic/customer/CustomerService.java b/src/main/java/com/kiisoo/ic/customer/CustomerService.java index 05ded6d..9d59d11 100644 --- a/src/main/java/com/kiisoo/ic/customer/CustomerService.java +++ b/src/main/java/com/kiisoo/ic/customer/CustomerService.java @@ -436,12 +436,21 @@ public class CustomerService { } /** - * @param userId - * @param sellerId - * @param search - * @param roleCode + * 查询好友列表,可根据导购、日期、搜索 + * @param userId 用户ID + * @param sellerId 导购ID + * @param search 搜索内容 + * @param roleCode 角色编码 + * @param type 会员与非会员类型 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param flag 0、新增好友 1、累计好友 + * @return 返回数据集合 + * @throws Exception 异常 + * @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) throws Exception { + public Map listCustomerNew(Long userId, Long sellerId, String search, String roleCode, Integer type, Date startDate, Date endDate, int flag) throws Exception { Map results = new HashMap<>(); // Date thisDate = new Date(); // DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); @@ -459,13 +468,19 @@ public class CustomerService { } 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 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()); @@ -484,7 +499,13 @@ public class CustomerService { // results.put("last", lastList); // results.put("early", earlyList); } else { - List thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, startDate, endDate, type); + 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); 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 dfee193..5721d27 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){ + String version, @RequestParam("flag") int flag){ try { Map stringObjectMap; if(StringUtils.isNotBlank(version)){ - stringObjectMap = customerService.listCustomerNew(userId, sellerId, search, roleCode, type, startDate, endDate); + stringObjectMap = customerService.listCustomerNew(userId, sellerId, search, roleCode, type, startDate, endDate, flag); }else{ stringObjectMap = customerService.listCustomer(userId, sellerId, search, roleCode, type, startDate, endDate); } 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 13382e8..86eee04 100644 --- a/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java +++ b/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java @@ -60,4 +60,40 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper> selectAllCustomerShop(@Param("ids") List ids); List> selectAllCustomerShop1(@Param("ids") List ids); + + /** + * 查询好友列表,可根据导购、日期、搜索 + * @param shopId 店铺ID + * @param sellerId 导购ID + * @param search 搜索内容 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param type 类型 + * @return 返回集合 + * @author dexiang.jiang + * @date 2020/05/10 21:50 + */ + List selectFriendListByShopIdAndDate(@Param("shopId") Long shopId, + @Param("sellerId") Long sellerId, + @Param("search") String search, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate, + @Param("type") Integer type); + + /** + * 查询用户 + * @param userId + * @param search + * @param startDate + * @param endDate + * @param type + * @return + * @author dexiang.jiang + * @date 2020/05/10 22:01 + */ + List selectFriendListBySellerAndDate(@Param("userId") Long userId, + @Param("search") String search, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate, + @Param("type") Integer type); } diff --git a/src/main/resources/mapper/OpSellerCustomerRelationDOMapper.xml b/src/main/resources/mapper/OpSellerCustomerRelationDOMapper.xml index e4e5523..1e2f69d 100644 --- a/src/main/resources/mapper/OpSellerCustomerRelationDOMapper.xml +++ b/src/main/resources/mapper/OpSellerCustomerRelationDOMapper.xml @@ -33,8 +33,8 @@ and - CONCAT(IFNULL(t2.name,''),IFNULL(t2.phone,'')) - LIKE CONCAT('%',#{search},'%') + (t2.name LIKE CONCAT('%',#{search},'%') OR t3.phone LIKE + CONCAT('%',#{search},'%')) and DATE_FORMAT(t2.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d') @@ -45,20 +45,25 @@ GROUP BY t4.id order by t2.create_time desc @@ -126,4 +132,82 @@ group by user_id + + + +