diff --git a/pom.xml b/pom.xml
index 9dfad5d..ffbddd5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
com.kiisoo
ic
1.0-SNAPSHOT
- jar
+ war
youke
@@ -25,17 +25,18 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
org.projectlombok
@@ -45,6 +46,13 @@
org.springframework.boot
spring-boot-starter
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
org.springframework.boot
@@ -110,6 +118,12 @@
fastjson
1.2.31
+
+
+ com.google.code.gson
+ gson
+ 2.8.5
+
org.springframework.boot
@@ -156,6 +170,18 @@
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
net.jodah
expiringmap
@@ -172,7 +198,11 @@
commons-codec
1.9
-
+
+ com.squareup.okhttp3
+ okhttp
+ 3.4.1
+
com.google.code.gson
gson
@@ -282,6 +312,13 @@
false
+
+
+ maven-surefire-plugin
+
+ true
+
+
youke
diff --git a/src/main/java/com/kiisoo/ic/activity/bean/ActivityInstanceVO.java~HEAD b/src/main/java/com/kiisoo/ic/activity/bean/ActivityInstanceVO.java~HEAD
new file mode 100644
index 0000000..bee67e8
--- /dev/null
+++ b/src/main/java/com/kiisoo/ic/activity/bean/ActivityInstanceVO.java~HEAD
@@ -0,0 +1,97 @@
+package com.kiisoo.ic.activity.bean;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.kiisoo.ic.activity.entity.PmnActivityPromotionParam;
+import com.kiisoo.ic.generalize.entity.PrivilageOrganizational;
+import com.kiisoo.ic.store.entity.PoiStore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Data
+@ApiModel("活动实例")
+public class ActivityInstanceVO implements Serializable {
+
+ @ApiModelProperty(value = "活动实例ID,有就编辑无则新增")
+ private Long id;
+
+ @ApiModelProperty(value = "活动池ID", required = true)
+ @NotNull(message = "请输入活动池ID")
+ private Long scheduleId;
+
+ @ApiModelProperty(value = "活动池信息", hidden = true)
+ private ActivityScheduleVO scheduleVO;
+
+ @ApiModelProperty(value = "类型CODE", hidden = true)
+ private String categoryCode;
+
+
+ @ApiModelProperty(value = "活动名称", required = true)
+ @NotBlank(message = "请输入活动名称")
+ private String name;
+
+ @ApiModelProperty(value = "活动开始日期", required = true)
+ @NotNull(message = "请输入活动开始日期")
+ @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+ private Date beginTime;
+
+ @ApiModelProperty(value = "活动结束日期", required = true)
+ @NotNull(message = "请输入活动结束日期")
+ @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
+ private Date endTime;
+
+ private String content;
+
+ @ApiModelProperty(value = "活动类型,多选项", required = true)
+ @NotNull(message = "请选择活动类型")
+ @Size(min = 1, message = "请选择活动类型")
+ private List params;
+
+ @ApiModelProperty(value = "选择的企业列表", required = true)
+// @NotNull(message = "请选择企业列表")
+// @Size(min = 1, message = "请选择企业列表")
+ private List organizations;
+
+ @ApiModelProperty(value = "第一个店铺名", hidden = true)
+ private String storeName;
+ @ApiModelProperty(value = "所有店铺数", hidden = true)
+ private String storeCount;
+
+ @ApiModelProperty(value = "创建时间", hidden = true)
+ @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date createTime;
+
+ @ApiModelProperty(value = "更新时间", hidden = true)
+ @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date updateTime;
+
+ @ApiModelProperty(value = "第一个公司名", hidden = true)
+ private String companyName;
+ @ApiModelProperty(value = "所有公司数", hidden = true)
+ private String companyCount;
+
+
+ @ApiModelProperty(value = "选择的店铺列表", required = true)
+ @NotNull(message = "请选择店铺列表")
+ @Size(min = 1, message = "请选择店铺列表")
+ private List stores; // 店铺列表
+
+ @ApiModelProperty(value = "状态", hidden = true)
+ private int status;
+ /*
+ *分页总条数
+ */
+ @ApiModelProperty(value = "分页总条数", hidden = true)
+ private long totalSize;
+
+ /**序号*/
+ @ApiModelProperty(value = "序号", hidden = true)
+ private int number;
+}
diff --git a/src/main/java/com/kiisoo/ic/activity/bean/ActivityScheduleVO.java~HEAD b/src/main/java/com/kiisoo/ic/activity/bean/ActivityScheduleVO.java~HEAD
new file mode 100644
index 0000000..1df0931
--- /dev/null
+++ b/src/main/java/com/kiisoo/ic/activity/bean/ActivityScheduleVO.java~HEAD
@@ -0,0 +1,46 @@
+package com.kiisoo.ic.activity.bean;
+
+import com.kiisoo.ic.activity.entity.PmnActivityPromotionParam;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.util.List;
+
+@Data
+public class ActivityScheduleVO {
+
+ @ApiModelProperty(value = "活动池ID,有就编辑无则新增")
+ private Long id;
+
+ @ApiModelProperty(value = "活动池名称", required = true)
+ @NotBlank(message = "请输入活动池名称")
+ private String name;
+
+ @ApiModelProperty(value = "分类ID", required = true)
+ private Integer categoryId;
+
+ @ApiModelProperty(value = "分类CODE", required = true)
+ private String categoryCode;
+
+ @ApiModelProperty(value = "活动池图片", required = true)
+ private String logo;
+
+ @ApiModelProperty(value = "活动池描述")
+ private String description;
+
+ @ApiModelProperty(value = "APPID", required = true)
+ @NotBlank(message = "请输入APPID")
+ private String appId;
+
+ @ApiModelProperty(value = "URI", required = true)
+ @NotBlank(message = "请输入uri")
+ private String uri;
+
+ @ApiModelProperty(value = "活动类型", required = true)
+ @NotNull(message = "至少新增一个活动类型")
+ @Size(min = 1, message = "至少新增一个活动类型")
+ private List params;
+}
diff --git a/src/main/java/com/kiisoo/ic/activity/vo/ActivityInstanceVO.java b/src/main/java/com/kiisoo/ic/activity/vo/ActivityInstanceVO.java
new file mode 100644
index 0000000..19ec9ef
--- /dev/null
+++ b/src/main/java/com/kiisoo/ic/activity/vo/ActivityInstanceVO.java
@@ -0,0 +1,13 @@
+package com.kiisoo.ic.activity.vo;
+
+import com.kiisoo.ic.activity.entity.PmnActivityInstance;
+import com.kiisoo.ic.activity.entity.PmnActivityPromotionCase;
+import com.kiisoo.ic.store.entity.PoiStore;
+import lombok.Data;
+
+@Data
+public class ActivityInstanceVO extends PmnActivityInstance {
+ private PoiStore store;
+
+ private PmnActivityPromotionCase activityPromotionCase;
+}
diff --git a/src/main/java/com/kiisoo/ic/activity/vo/ActivityScheduleVO.java b/src/main/java/com/kiisoo/ic/activity/vo/ActivityScheduleVO.java
new file mode 100644
index 0000000..e714643
--- /dev/null
+++ b/src/main/java/com/kiisoo/ic/activity/vo/ActivityScheduleVO.java
@@ -0,0 +1,21 @@
+package com.kiisoo.ic.activity.vo;
+
+import com.kiisoo.ic.activity.entity.PmnActivityCategory;
+import com.kiisoo.ic.activity.entity.PmnActivityPromotionCase;
+import com.kiisoo.ic.activity.entity.PmnActivityPromotionParam;
+import com.kiisoo.ic.activity.entity.PmnActivitySchedule;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@ApiModel(value = "活动规划", parent = PmnActivitySchedule.class)
+public class ActivityScheduleVO extends PmnActivitySchedule {
+ @ApiModelProperty("活动参数列表")
+ List activityPromotionParams;
+
+ @ApiModelProperty("活动类型列表")
+ List activityPromotionCases;
+}
diff --git a/src/main/java/com/kiisoo/ic/customer/CustomerService.java b/src/main/java/com/kiisoo/ic/customer/CustomerService.java
index 6504f8c..a46019c 100644
--- a/src/main/java/com/kiisoo/ic/customer/CustomerService.java
+++ b/src/main/java/com/kiisoo/ic/customer/CustomerService.java
@@ -2,6 +2,9 @@ package com.kiisoo.ic.customer;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -9,6 +12,10 @@ import com.google.gson.Gson;
import com.kiisoo.ic.activity.bean.ActivityInstanceVO;
import com.kiisoo.ic.activity.entity.*;
import com.kiisoo.ic.activity.service.*;
+import com.kiisoo.ic.common.utils.RedisUtil;
+import com.kiisoo.ic.activity.bean.ActivityInstanceVO;
+import com.kiisoo.ic.activity.entity.*;
+import com.kiisoo.ic.activity.service.*;
import com.kiisoo.ic.constants.Constants;
import com.kiisoo.ic.customer.bean.CustomerDTO;
import com.kiisoo.ic.customer.bean.CustomerModifyDTO;
@@ -107,8 +114,6 @@ public class CustomerService {
private IPmnPromotionSrcService pmnPromotionSrcService;
@Autowired
private IPmnActivityInstanceService pmnActivityInstanceService;
- @Autowired
- private IPmnActivityInstanceConfigService pmnActivityInstanceConfigService;
@Autowired
private StoreEmployeeService storeEmployeeService;
@@ -116,6 +121,9 @@ public class CustomerService {
private IPmnActivityStoreRelationService pmnActivityStoreRelationService;
@Autowired
private IPmnPromotionFriendsSrcService pmnPromotionFriendsSrcService;
+ @Autowired
+ private RedisUtil redisUtil;
+
/**
* token
*/
@@ -294,6 +302,10 @@ public class CustomerService {
insertCustomer.setExternalUserid(turnBackDTOS.getWxData().getUserId());
insertCustomer.setCpUserId(turnBackDTOS.getUserId());
insertCustomer.setPhone(turnBackDTOS.getPhone());
+ if (turnBackDTOS.getVipData() != null && !turnBackDTOS.getVipData().getPhone().equals("")) {
+ //有vip数据就不需要重新请求bsd的vip接口
+ insertCustomer.setPhone(turnBackDTOS.getVipData().getPhone());
+ }
if (shop != null && StringUtils.isNotBlank(shop.getName())) {
insertCustomer.setShopName(shop.getName());
}
@@ -426,8 +438,12 @@ public class CustomerService {
insertRelation.setCreateTime(joinTime);
insertRelation.setUpdateTime(new Date());
insertRelation.setCustomerId(opCustomer.getId());
+ PoiStore poiStore = poiStoreDOMapper.selectById(shopId);
insertRelation.setStoreId(shopId);
+ insertRelation.setStoreCode(poiStore.getCode());
+ PoiStoreStaff staff = poiStoreStaffDOMapper.selectById(sellerId);
insertRelation.setUserId(sellerId);
+ insertRelation.setStaffCode(staff.getStaffCode());
insertRelation.setCreateBy(Constants.SYS_OPERATION);
insertRelation.setUpdateBy(Constants.SYS_OPERATION);
@@ -445,14 +461,14 @@ public class CustomerService {
opSellerCustomerRelationDOMapper.insert(insertRelation);
} else {
//可能是同步过来的数据,此时已经存在的话,用有导购的代替
- opSellerCustomerRelation.setCreateTime(joinTime);
- opSellerCustomerRelation.setUpdateTime(new Date());
- opSellerCustomerRelation.setCustomerId(opCustomer.getId());
- opSellerCustomerRelation.setStoreId(shopId);
- opSellerCustomerRelation.setUserId(sellerId);
- opSellerCustomerRelation.setCreateBy(Constants.SYS_OPERATION);
- opSellerCustomerRelation.setUpdateBy(Constants.SYS_OPERATION);
- opSellerCustomerRelationDOMapper.updateById(opSellerCustomerRelation);
+// opSellerCustomerRelation.setCreateTime(joinTime);
+// opSellerCustomerRelation.setUpdateTime(new Date());
+// opSellerCustomerRelation.setCustomerId(opCustomer.getId());
+// opSellerCustomerRelation.setStoreId(shopId);
+// opSellerCustomerRelation.setUserId(sellerId);
+// opSellerCustomerRelation.setCreateBy(Constants.SYS_OPERATION);
+// opSellerCustomerRelation.setUpdateBy(Constants.SYS_OPERATION);
+// opSellerCustomerRelationDOMapper.updateById(opSellerCustomerRelation);
}
}
@@ -498,6 +514,9 @@ public class CustomerService {
}
insertRelation.setType(3);
+ }else{
+ PoiStore poiStore = poiStoreDOMapper.selectById(shopId);
+ insertRelation.setStoreCode(poiStore.getCode());
}
opSellerCustomerRelationDOMapper.insert(insertRelation);
}
@@ -619,102 +638,50 @@ 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(startDate.getTime() == endDate.getTime()){
+ endDate = null;
+ }
+
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/controller/CustomerViewController.java b/src/main/java/com/kiisoo/ic/customer/controller/CustomerViewController.java
index b6eb310..98ee407 100644
--- a/src/main/java/com/kiisoo/ic/customer/controller/CustomerViewController.java
+++ b/src/main/java/com/kiisoo/ic/customer/controller/CustomerViewController.java
@@ -55,6 +55,23 @@ public class CustomerViewController extends BaseController {
}
}
+ /**
+ * 客户概览main——vip
+ * @param userId 用户id
+ * @return 客户概览VO
+ */
+ @ResponseBody
+ @RequestMapping(value = "/main/vip", method = RequestMethod.GET)
+ public Map getMainVipCount(@RequestParam("userId")Long userId){
+ try{
+ CustomerViewVO result = customerViewService.getMainVipCount(userId);
+ return data(result);
+ }catch (Exception e){
+ log.error("查询vip数据出错", e);
+ return fail();
+ }
+ }
+
/**
* 客户概览——Top榜
* @param userId 用户id
diff --git a/src/main/java/com/kiisoo/ic/customer/entity/OpSellerCustomerRelation.java b/src/main/java/com/kiisoo/ic/customer/entity/OpSellerCustomerRelation.java
index 9867cfb..0044bdc 100644
--- a/src/main/java/com/kiisoo/ic/customer/entity/OpSellerCustomerRelation.java
+++ b/src/main/java/com/kiisoo/ic/customer/entity/OpSellerCustomerRelation.java
@@ -26,16 +26,26 @@ public class OpSellerCustomerRelation {
*/
private Long userId;
+ /**
+ * 导购code
+ */
+ private String staffCode;
+
/**
* 客户ID
*/
private Long customerId;
/**
- * 店铺ID
+ * 店铺code
*/
private Long storeId;
+ /**
+ * 店铺ID
+ */
+ private String storeCode;
+
/**
* 是否有效
*/
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/customer/service/CustomerViewService.java b/src/main/java/com/kiisoo/ic/customer/service/CustomerViewService.java
index d5bf7b2..c5e6554 100644
--- a/src/main/java/com/kiisoo/ic/customer/service/CustomerViewService.java
+++ b/src/main/java/com/kiisoo/ic/customer/service/CustomerViewService.java
@@ -174,8 +174,6 @@ public class CustomerViewService {
*/
public CustomerViewVO selectCustomerViewMain(Long userId, String selectStartTime, String selectEndTime, String startTime, String endTime){
CustomerViewVO customerViewVO = new CustomerViewVO();
- //会员总数
- Long vipCount = 0L;
//shopIds
List shopIdList = new ArrayList<>();
PrivilageRoleDO privilageRoleDO = privilageRoleDOMapper.selectRoleByUserId(userId);
@@ -185,7 +183,6 @@ public class CustomerViewService {
//店长
if(privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
shopIdList = poiStoreStaffDOMapper.selectByUserId(userId);
- vipCount = opVipDOMapper.selectVipCountByStoreIds(shopIdList);
}
//运营人员
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_YYRY.getRoleCode())) {
@@ -195,12 +192,10 @@ public class CustomerViewService {
//查询零售公司的门店
List list1 = retailCompanyService.selectShopByCompany(pm.get(0).getOrgId());
shopIdList = list1.stream().map(PoiStore::getId).collect(Collectors.toList());
- vipCount = opVipDOMapper.selectVipCountByStoreIds(shopIdList);
}
//管理员/总运营人员
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_GLY.getRoleCode()) || privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_ALL_YYRY.getRoleCode())) {
shopIdList = poiStoreStaffDOMapper.selectAllShopId(null,null);
- vipCount = opVipDOMapper.selectVipCountNew();
}
if(CollectionUtils.isEmpty(shopIdList)){
@@ -209,17 +204,10 @@ public class CustomerViewService {
//柱状图好友趋势图
List customerList = opCustomerDOMapper.selectCustomerList(shopIdList, null, null, startTime, endTime);
-
- customerViewVO.setAllVipCount(vipCount);
-
//设置趋势柱状图list
List validCustomerList = customerList.stream().filter(customerDO -> VALID.equals(customerDO.getValidType())).collect(Collectors.toList());
handleChartData(customerList, validCustomerList, customerViewVO);
- //设置新增好友,新增好友(去重),vip人数
-// setCustomerViewData(customerViewVO, customerList, validCustomerList, selectStartTime, selectEndTime);
- //新增好友
-// Long newCustomerCount = customerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).count();
Integer newCustomerCount = opCustomerDOMapper.countCustomerByDate(shopIdList,selectStartTime, selectEndTime);
customerViewVO.setNewCustomer(new Long(newCustomerCount));
@@ -229,6 +217,52 @@ public class CustomerViewService {
return customerViewVO;
}
+
+ /**
+ * 客户概览main——vip
+ * @param userId 用户id
+ * @return 客户概览VO
+ */
+ public CustomerViewVO getMainVipCount(Long userId){
+ CustomerViewVO customerViewVO = new CustomerViewVO();
+ //会员总数
+ Long vipCount = 0L;
+ //shopIds
+ List shopIdList = new ArrayList<>();
+ PrivilageRoleDO privilageRoleDO = privilageRoleDOMapper.selectRoleByUserId(userId);
+ if(privilageRoleDO == null){
+ return customerViewVO;
+ }
+ //店长
+ if(privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
+ shopIdList = poiStoreStaffDOMapper.selectByUserId(userId);
+ vipCount = opVipDOMapper.selectVipCountByStoreIds(shopIdList);
+ }
+ //运营人员
+ else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_YYRY.getRoleCode())) {
+ QueryWrapper wrapper1 = new QueryWrapper<>();
+ wrapper1.eq("user_id", userId);
+ List pm = organizationalMemberMapper.selectList(wrapper1);
+ //查询零售公司的门店
+ List list1 = retailCompanyService.selectShopByCompany(pm.get(0).getOrgId());
+ shopIdList = list1.stream().map(PoiStore::getId).collect(Collectors.toList());
+ vipCount = opVipDOMapper.selectVipCountByStoreIds(shopIdList);
+ }
+ //管理员/总运营人员
+ else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_GLY.getRoleCode()) || privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_ALL_YYRY.getRoleCode())) {
+ shopIdList = poiStoreStaffDOMapper.selectAllShopId(null,null);
+ vipCount = opVipDOMapper.selectVipCountNew();
+ }
+
+ if(CollectionUtils.isEmpty(shopIdList)){
+ return customerViewVO;
+ }
+
+ customerViewVO.setAllVipCount(vipCount);
+
+ return customerViewVO;
+ }
+
/**
* 客户概览——Top榜
* @param userId 用户id
@@ -665,18 +699,23 @@ public class CustomerViewService {
shopIdList = list1.stream().map(PoiStore::getId).collect(Collectors.toList());
List cpUserIds = privilageCpUserStoreDOMapper.selectCpUserIdsByStoreIds(shopIdList);
Long all = privilageCpUserDOMapper.selectStoresCount(cpUserIds);
- Long dis = privilageCpUserDOMapper.selectDistinctStoresCount(cpUserIds);
+ List