From 00579203ada6383196c2413dcb23c9cfb9b33f6a Mon Sep 17 00:00:00 2001 From: jiangyunjie Date: Fri, 24 Apr 2020 11:06:09 +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?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kiisoo/ic/customer/CustomerService.java | 23 ++++++---- .../kiisoo/ic/customer/bean/FriendDTO.java | 5 +++ .../controller/CustomerController.java | 20 ++++++--- .../OpSellerCustomerRelationDOMapper.java | 11 ++++- .../OpSellerCustomerRelationDOMapper.xml | 44 ++++++++++++++----- 5 files changed, 74 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/kiisoo/ic/customer/CustomerService.java b/src/main/java/com/kiisoo/ic/customer/CustomerService.java index eadc21e..6a77098 100644 --- a/src/main/java/com/kiisoo/ic/customer/CustomerService.java +++ b/src/main/java/com/kiisoo/ic/customer/CustomerService.java @@ -32,6 +32,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.time.LocalDate; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; @@ -399,25 +401,30 @@ public class CustomerService { * @param search * @param roleCode */ - public Map listCustomer(Long userId,Long sellerId,String search,String roleCode){ + public Map listCustomer(Long userId,Long sellerId,String search,String roleCode, Integer type) throws Exception{ Map results = new HashMap<>(); Date thisDate = new Date(); - Date lastDate = 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())); if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())){ List stafferInfoVOS = poiStoreStaffDOMapper.selectInfoById(userId); Long shopId = stafferInfoVOS.get(0).getStoreId(); - List thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,thisDate,thisDate); + List thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,thisDate,thisDate, type); results.put("this",thisList); - List lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,lastDate,lastDate); + List lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,lastDate,lastDate, type); results.put("last",lastList); - List earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,null,lastDate); + List earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,null,earlyDate, type); results.put("early",earlyList); }else{ - List thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,thisDate,thisDate); + List thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,thisDate,thisDate, type); results.put("this",thisList); - List lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,lastDate,lastDate); + List lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,lastDate,lastDate, type); results.put("last",lastList); - List earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,null,lastDate); + List earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,null,earlyDate, type); results.put("early",earlyList); } return results; diff --git a/src/main/java/com/kiisoo/ic/customer/bean/FriendDTO.java b/src/main/java/com/kiisoo/ic/customer/bean/FriendDTO.java index 4ddf280..fb834c4 100644 --- a/src/main/java/com/kiisoo/ic/customer/bean/FriendDTO.java +++ b/src/main/java/com/kiisoo/ic/customer/bean/FriendDTO.java @@ -48,4 +48,9 @@ public class FriendDTO { * 会员类型 */ private String vipType; + + /** + * 会员头像 + */ + private String avatar; } 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 884581e..e262af1 100644 --- a/src/main/java/com/kiisoo/ic/customer/controller/CustomerController.java +++ b/src/main/java/com/kiisoo/ic/customer/controller/CustomerController.java @@ -70,18 +70,24 @@ public class CustomerController extends BaseController { } /** - * 修改客户信息 - * @param customerId 客户id - * @param name 客户名称 + * 查询好友列表 + * @param userId + * @param sellerId + * @param search + * @param roleCode + * @param type 1.会员好友 2.普通好友 (默认全部) * @return */ @ResponseBody @PostMapping("/list/friends") - public Map listCustomer(@RequestParam("userId") Long userId,@RequestParam(value = "sellerId",required = false)Long sellerId, - @RequestParam(value = "search",required = false)String search,@RequestParam("roleCode")String roleCode){ + public Map listCustomer(@RequestParam("userId") Long userId, + @RequestParam(value = "sellerId",required = false)Long sellerId, + @RequestParam(value = "search",required = false)String search, + @RequestParam("roleCode")String roleCode, + @RequestParam("type") Integer type){ try { - Map stringObjectMap = customerService.listCustomer(userId, sellerId, search, roleCode); - return success(); + Map stringObjectMap = customerService.listCustomer(userId, sellerId, search, roleCode, type); + return data(stringObjectMap); } catch (Exception e) { log.error("修改客户信息异常:",e); return fail(); 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 5ba8264..9b002ee 100644 --- a/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java +++ b/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java @@ -18,12 +18,19 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper selectShopListByDate(@Param("shopId") Long shopId, @Param("userId")Long userId, @Param("sellerId")Long sellerId, - @Param("search")String search, @Param("startDate")Date startDate, @Param("endDate")Date endDate); + List selectShopListByDate(@Param("shopId") Long shopId, + @Param("userId") Long userId, + @Param("sellerId") Long sellerId, + @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 29c58c0..e12231f 100644 --- a/src/main/resources/mapper/OpSellerCustomerRelationDOMapper.xml +++ b/src/main/resources/mapper/OpSellerCustomerRelationDOMapper.xml @@ -2,20 +2,40 @@