Merge remote-tracking branch 'remotes/origin/feature/20200531' into dev

dev
root 5 years ago
commit c3b5b70392

@ -7,7 +7,7 @@
<groupId>com.kiisoo</groupId>
<artifactId>ic</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<packaging>war</packaging>
<name>youke</name>
<parent>
@ -25,17 +25,18 @@
</properties>
<dependencies>
<!-- <dependency>-->
<!-- <groupId>com.kiisoo.aegis</groupId>-->
<!-- <artifactId>aegis-common</artifactId>-->
<!-- <version>0.5.0-SNAPSHOT</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <artifactId>slf4j-log4j12</artifactId>-->
<!-- <groupId>org.slf4j</groupId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.kiisoo.aegis</groupId>-->
<!-- <artifactId>aegis-common</artifactId>-->
<!-- <version>0.5.0-SNAPSHOT</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <artifactId>slf4j-log4j12</artifactId>-->
<!-- <groupId>org.slf4j</groupId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<dependency>
<groupId>org.projectlombok</groupId>
@ -45,6 +46,13 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -110,6 +118,12 @@
<artifactId>fastjson</artifactId>
<version>1.2.31</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -156,6 +170,18 @@
<!--<artifactId>freemarker</artifactId>-->
<!--<version>2.3.28</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<!--<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>-->
</dependency>
<dependency>
<groupId>net.jodah</groupId>
<artifactId>expiringmap</artifactId>
@ -172,7 +198,11 @@
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
@ -282,6 +312,13 @@
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
<finalName>youke</finalName>

@ -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<PmnActivityPromotionParam> params;
@ApiModelProperty(value = "选择的企业列表", required = true)
// @NotNull(message = "请选择企业列表")
// @Size(min = 1, message = "请选择企业列表")
private List<PrivilageOrganizational> 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<PoiStore> stores; // 店铺列表
@ApiModelProperty(value = "状态", hidden = true)
private int status;
/*
*分页总条数
*/
@ApiModelProperty(value = "分页总条数", hidden = true)
private long totalSize;
/**序号*/
@ApiModelProperty(value = "序号", hidden = true)
private int number;
}

@ -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<PmnActivityPromotionParam> params;
}

@ -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;
}

@ -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<PmnActivityPromotionParam> activityPromotionParams;
@ApiModelProperty("活动类型列表")
List<PmnActivityPromotionCase> activityPromotionCases;
}

@ -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<FriendDTO> thisList;
PageHelper.startPage(pageNum, pageSize);
IPage<FriendDTO> thisList;
// PageHelper.startPage(pageNum, pageSize);
com.baomidou.mybatisplus.extension.plugins.pagination.Page<FriendDTO> 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<String, Object> 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<String, Object> listCustomer(Long userId, Long sellerId, String search, String roleCode, Integer type, Date startDate, Date endDate) throws Exception {
Map<String, Object> 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<StafferInfoVO> 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<FriendDTO> 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<FriendDTO> 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<FriendDTO> 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<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, startDate, endDate, type);
results.put("this", thisList);
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, lastDate, lastDate, type);
results.put("last", lastList);
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, null, earlyDate, type);
results.put("early", earlyList);
}
results.put("this", new PageInfo<>(thisList.getRecords()));
return results;
}

@ -90,12 +90,7 @@ public class CustomerController extends BaseController {
Date endDate,
String version, @RequestParam("flag") int flag,int pageNum, int pageSize){
try {
Map<String, Object> 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<String, Object> stringObjectMap = customerService.listCustomerNew(userId, sellerId, search, roleCode, type, startDate, endDate, flag, pageNum, pageSize);
return data(stringObjectMap);
} catch (Exception e) {
log.error("查询好友列表:",e);

@ -55,6 +55,23 @@ public class CustomerViewController extends BaseController {
}
}
/**
* mainvip
* @param userId id
* @return VO
*/
@ResponseBody
@RequestMapping(value = "/main/vip", method = RequestMethod.GET)
public Map<String,Object> 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

@ -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;
/**
*
*/

@ -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<OpSellerCus
* @param type
* @return
*/
List<FriendDTO> selectFriendListBySeller(@Param("userId") Long userId,
IPage<FriendDTO> selectFriendListBySeller(Page<FriendDTO> 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<OpSellerCus
* @param type
* @return
*/
List<FriendDTO> 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<FriendDTO> selectFriendListByShopId(Page<FriendDTO> 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<OpSellerCus
* @author dexiang.jiang
* @date 2020/05/10 21:50
*/
List<FriendDTO> selectFriendListByShopIdAndDate(@Param("shopId") Long shopId,
IPage<FriendDTO> selectFriendListByShopIdAndDate(Page<FriendDTO> 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<OpSellerCus
* @author dexiang.jiang
* @date 2020/05/10 22:01
*/
List<FriendDTO> selectFriendListBySellerAndDate(@Param("userId") Long userId,
IPage<FriendDTO> selectFriendListBySellerAndDate(Page<FriendDTO> 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<OpSellerCus
Long selectSellerCustomerRelation(@Param("customerId") Long customerId, @Param("userId") Long userId, @Param("storeId") Long storeId);
Integer countStoreCustomers(@Param("customerId") Long customerId, @Param("userId") Long userId, @Param("storeId") Long storeId);
List<Map<String, Object>> selectCustomersByCpUserId();

@ -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<Long> 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<PoiStore> 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<OpCustomer> customerList = opCustomerDOMapper.selectCustomerList(shopIdList, null, null, startTime, endTime);
customerViewVO.setAllVipCount(vipCount);
//设置趋势柱状图list
List<OpCustomer> 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;
}
/**
* mainvip
* @param userId id
* @return VO
*/
public CustomerViewVO getMainVipCount(Long userId){
CustomerViewVO customerViewVO = new CustomerViewVO();
//会员总数
Long vipCount = 0L;
//shopIds
List<Long> 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<PrivilageOrganizationalMember> wrapper1 = new QueryWrapper<>();
wrapper1.eq("user_id", userId);
List<PrivilageOrganizationalMember> pm = organizationalMemberMapper.selectList(wrapper1);
//查询零售公司的门店
List<PoiStore> 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<String> cpUserIds = privilageCpUserStoreDOMapper.selectCpUserIdsByStoreIds(shopIdList);
Long all = privilageCpUserDOMapper.selectStoresCount(cpUserIds);
Long dis = privilageCpUserDOMapper.selectDistinctStoresCount(cpUserIds);
List<Map<String, Object>> dis = privilageCpUserDOMapper.selectDistinctStoresCount(cpUserIds);
result.setAllCustomer(all);
result.setAllValidCustomer(dis);
if(null != dis){
result.setAllValidCustomer(Long.parseLong(dis.get(0).get("rows").toString()));
}
}
//管理员/总运营人员
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_GLY.getRoleCode()) || privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_ALL_YYRY.getRoleCode())) {
Long all = privilageCpUserDOMapper.selectAllCount();
Long dis = privilageCpUserDOMapper.selectDistinctAllCount();
List<Map<String, Object>> dis = privilageCpUserDOMapper.selectDistinctAllCount();
result.setAllCustomer(all);
result.setAllValidCustomer(dis);
if(null != dis){
result.setAllValidCustomer(Long.parseLong(dis.get(0).get("rows").toString()));
}
}
return result;

@ -197,9 +197,11 @@ public class EmployeeController extends BaseController {
*/
@RequestMapping(value = "update",method = RequestMethod.POST)
@ResponseBody
public Map<String,Object> updateUser(@RequestBody EmployeeDO employee){
public Map<String,Object> updateUser(@RequestParam("id")Long id,@RequestParam("mobile")String mobile,
@RequestParam("cpUserName")String cpUserName,@RequestParam("cpUserId")String cpUserId,
@RequestParam("alias")String alias){
try {
Boolean hasAdd = employeeService.updateUser(employee);
Boolean hasAdd = employeeService.updateUser(id,cpUserId,mobile,cpUserName,alias);
return data(hasAdd);
}catch (Exception e){
log.error("修改用户失败",e);

@ -28,6 +28,10 @@ public class EmployeeDO {
*
*/
private String name;
/**
*
*/
private String cpUserName;
/**
* id,20(idid)
*/

@ -19,7 +19,7 @@ public interface PrivilageCpUserDOMapper extends BaseMapper<PrivilageCpUserDO> {
Long selectAllCount();
Long selectDistinctAllCount();
List<Map<String, Object>> selectDistinctAllCount();
List<String> selectCustomerIdsByCpUserId(@Param("cpUserId")String cpUserId);
@ -29,7 +29,7 @@ public interface PrivilageCpUserDOMapper extends BaseMapper<PrivilageCpUserDO> {
Long selectStoresCount(@Param("cpUserIds")List<String> cpUserIds);
Long selectDistinctStoresCount(@Param("cpUserIds")List<String> cpUserIds);
List<Map<String, Object>> selectDistinctStoresCount(@Param("cpUserIds")List<String> cpUserIds);
Long selectStoresCountById(@Param("shopIds")List<Long> shopIds);

@ -33,6 +33,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
@ -257,36 +258,34 @@ public class EmployeeService {
/**
*
*
* @param employee
* @param id
* @param cpUserId
* @param mobile
* @param cpUserName
* @param alias
* @return
* @throws WxErrorException
*/
@Transactional(rollbackFor = Exception.class)
public Boolean updateUser(EmployeeDO employee) throws Exception {
public Boolean updateUser(Long id, String cpUserId,String mobile,String cpUserName,String alias) throws Exception {
PrivilageCpUserDO privilageCpUserDO = new PrivilageCpUserDO();
BeanUtils.copyProperties(employee, privilageCpUserDO);
privilageCpUserDO.setCpUserId(employee.getUserId());
privilageCpUserDO.setId(id);
privilageCpUserDO.setMobile(mobile);
privilageCpUserDO.setName(cpUserName);
privilageCpUserDO.setAlias(alias);
int update = privilageCpUserDOMapper.updateById(privilageCpUserDO);
if (update == 0) {
throw new Exception("修改成员失败");
}
//维护部门关系——删除原有部门关系
QueryWrapper<PrivilageCpUserDepartmentDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(DATABASE_CP_USER_ID_KEY, privilageCpUserDO.getId());
privilageCpUserDepartmentDOMapper.delete(queryWrapper);
Long[] departIds = employee.getDepartIds();
Integer[] orders = employee.getOrders();
Integer[] isLeaderInDept = employee.getIsLeaderInDept();
for (int i = 0; i < departIds.length; i++) {
PrivilageCpUserDepartmentDO relation = new PrivilageCpUserDepartmentDO(privilageCpUserDO.getId(), departIds[i], orders[i], isLeaderInDept[i]);
privilageCpUserDepartmentDOMapper.insert(relation);
}
//成功则添加用户到企业微信
EmployeeDO employee = new EmployeeDO();
employee.setName(cpUserName);
employee.setId(id);
employee.setAlias(alias);
employee.setUserId(cpUserId);
employee.setMobile(mobile);
qwMailListManageService.updateUser(employee);
return true;
}

@ -1,6 +1,7 @@
package com.kiisoo.ic.job.detail;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kiisoo.ic.common.utils.RedisUtil;
import com.kiisoo.ic.customer.CustomerService;
import com.kiisoo.ic.customer.entity.OpSellerCustomerRelation;
import com.kiisoo.ic.customer.mapper.OpSellerCustomerRelationDOMapper;
@ -13,14 +14,13 @@ import com.lmax.disruptor.*;
import com.lmax.disruptor.dsl.Disruptor;
import com.lmax.disruptor.dsl.ProducerType;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.bean.WxCpUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.*;
/**
@ -55,8 +55,11 @@ public class CustomerDataJob {
@Autowired
private CustomerService customerService;
@Autowired
private RedisUtil redisUtil;
public void handle(String cpUserIds) {
public void handle(String cpUserIds) throws WxErrorException {
//创建线程池
ExecutorService executors = Executors.newFixedThreadPool(THREAD_NUMBERS);
@ -105,14 +108,25 @@ public class CustomerDataJob {
index++;
}
} else {
String[] split = cpUserIds.split(",");
List<String> cpUserIdList = Arrays.asList(split);
// String[] split = cpUserIds.split(",");
// List<String> cpUserIdList = Arrays.asList(split);
List<String> cpUserIdList = new ArrayList<>();
List<WxCpUser> wxCpUsers = qwMailListManageService.syncUser();
for (int i = 0; i < wxCpUsers.size(); i++) {
WxCpUser item = wxCpUsers.get(i);
cpUserIdList.add(item.getUserId());
}
// 获取账号的总客户数
List<Map<String, Object>> customerList = opSellerCustomerRelationDOMapper.selectCustomersByCpUserIdByList(cpUserIdList);
Map<String, Object> customerMap = new HashMap<>();
for (int i = 0; i < customerList.size(); i++) {
Map<String, Object> item = customerList.get(i);
customerMap.put(item.get("cpUserId").toString(), item.get("sumCustomer"));
if(null != item.get("cpUserId")){
customerMap.put(item.get("cpUserId").toString(), item.get("sumCustomer"));
}
}
for (String cpUserId : cpUserIdList) {
@ -128,6 +142,7 @@ public class CustomerDataJob {
opSellerCustomerRelationDOMapper.delete(relationQueryWrapper);
Long storeId = privilageCpUserStoreDOMapper.selectOneByCpUserId(cpUserId);
ProduceDTO produceDTO = new ProduceDTO();
produceDTO.setIndex(index);
produceDTO.setStoreId(storeId);

@ -3,12 +3,14 @@ package com.kiisoo.ic.store.bean;
import com.kiisoo.ic.activity.entity.PmnActivityInstance;
import com.kiisoo.ic.store.entity.PoiStoreStaff;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
*
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class PoiStoreStaffDTO extends PoiStoreStaff {
/**名称*/

@ -18,6 +18,18 @@ public class StoreUserDTO extends PoiStore{
*
*/
private String cpUserId;
/**
*
*/
private String cpUserName;
/**
*
*/
private String alias;
/**
*
*/
private String mobile;
/**
* privilage_cp_user id
*/

@ -6,6 +6,7 @@ import com.kiisoo.ic.activity.entity.PmnActivityInstance;
import com.kiisoo.ic.activity.entity.PmnActivityStoreRelation;
import com.kiisoo.ic.activity.service.IPmnActivityInstanceService;
import com.kiisoo.ic.activity.service.IPmnActivityStoreRelationService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kiisoo.ic.customer.service.CustomerViewService;
import com.kiisoo.ic.domain.entity.PrivilageDomainEntityDO;
import com.kiisoo.ic.domain.mapper.PrivilageDomainEntityDOMapper;

@ -28,6 +28,7 @@ import com.kiisoo.ic.store.entity.*;
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
import com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper;
import com.kiisoo.ic.store.mapper.StorePromotionDataDOMapper;
import com.kiisoo.ic.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.WxCpService;
@ -526,6 +527,7 @@ public class StorePromotionDataService {
if (storeId == null) {
return storePromotionDataDO;
}
endDate = DateUtils.addDay(endDate,1);
switch (roleCode) {
// 店长
case Constants.WX_USER_ROLE_SHOP_MANAGER:

@ -96,6 +96,21 @@ public class SynchronousController {
return DataImportUtil.fail(e);
}
}
@RequestMapping(value = "/ics/activity/event/cb", method = RequestMethod.POST, consumes = "application/json")
@ResponseBody
public String activityEventCb(@RequestBody List<TurnBackDTO> turnBackDTOS) {
try {
for (TurnBackDTO turnBackDTO : turnBackDTOS) {
customerService.turnBack(turnBackDTO);
}
return DataImportUtil.succ(1);
}catch (Exception e){
log.error("扫码回调报错",e);
String str = JSON.toJSONString(turnBackDTOS);
System.out.println(str);
return DataImportUtil.fail(e);
}
}
/**
*
* @param friendExistReqDO
@ -115,21 +130,6 @@ public class SynchronousController {
return bsdFriendsExistResponse;
}
}
@RequestMapping(value = "/ics/activity/event/cb", method = RequestMethod.POST, consumes = "application/json")
@ResponseBody
public String activityEventCb(@RequestBody List<TurnBackDTO> turnBackDTOS) {
try {
for (TurnBackDTO turnBackDTO : turnBackDTOS) {
customerService.turnBack(turnBackDTO);
}
return DataImportUtil.succ(1);
}catch (Exception e){
log.error("扫码回调报错",e);
String str = JSON.toJSONString(turnBackDTOS);
System.out.println(str);
return DataImportUtil.fail(e);
}
}
/**
*

@ -24,6 +24,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.*;
import me.chanjar.weixin.cp.bean.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -430,6 +431,8 @@ public class QWMailListManageService {
return customers;
}
private File file = new File("file/601.txt");
public void getCustomerNew(String cpUserId, Integer sumCustomer, CustomerService customerService, List<Map<String, Object>> tagList) throws WxErrorException {
//查询店铺id——店铺ID存在说明该账号的客户都绑在店上不存在则说明绑在账号上
// Long storeId = privilageCpUserStoreDOMapper.selectOneByCpUserId(cpUserId);
@ -514,12 +517,16 @@ public class QWMailListManageService {
wxDataDTO.setUnionId(externalContact.getUnionId());
turnBackDTO.setWxData(wxDataDTO);
// SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Date jtime = sdf.parse(turnBackDTO.getJoinTime());
// Date etime = sdf.parse("2020-05-28 00:00:00");
// if (jtime.before(etime)) {
// Date jtime = sdf.parse(turnBackDTO.getJoinTime());
// Date stime = sdf.parse("2020-05-25 00:00:00");
// Date etime = sdf.parse("2020-05-26 00:00:00");
//
//
// if (jtime.after(stime) && jtime.before(etime)) {
//// System.out.println("aa" + turnBackDTO.toString());
// continue;
// }
// FileUtils.write(file, turnBackDTO.toString() + "\n","utf-8", true);
// continue;
// }
// System.out.println(turnBackDTO.toString());
customerService.turnBack(turnBackDTO);

@ -1,6 +1,6 @@
logging:
level:
root: warn
root: info
mybatis:
mapperLocations: classpath:mapper/*.xml

@ -12,7 +12,8 @@
left join poi_store_staff t5 ON t5.store_id = t0.id and t1.user_id = t5.id
LEFT JOIN op_customer t2 ON t2.id = t1.customer_id
LEFT JOIN op_vip t3 ON t3.id = t2.member_id
LEFT JOIN privilage_user t4 ON t4.id = t5.user_id where 1 =1
LEFT JOIN privilage_user t4 ON t4.id = t5.user_id
where t1.id > 0
<choose>
<when test="shopId != null and shopId.size > 0 ">
and t1.store_id in
@ -25,13 +26,37 @@
</otherwise>
</choose>
<if test="startDate != null">
and t2.create_time >= #{startDate}
and t1.create_time >= #{startDate}
</if>
<if test="endDate != null">
and t2.create_time <![CDATA[ < ]]> #{endDate}
and t1.create_time <![CDATA[ < ]]> #{endDate}
</if>
order by t2.create_time desc,t2.id desc,t1.user_id desc
order by t1.create_time desc,t1.customer_id desc,t1.user_id desc
</select>
<select id="selectCustomerInfoByShopIds_COUNT" resultType="Long">
SELECT count(t1.id)
from op_seller_customer_relation t1
where t1.id > 0
<choose>
<when test="shopId != null and shopId.size > 0 ">
and t1.store_id in
<foreach collection="shopId" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</when>
<otherwise>
and 1 = 0
</otherwise>
</choose>
<if test="startDate != null">
and t1.create_time >= #{startDate}
</if>
<if test="endDate != null">
and t1.create_time <![CDATA[ < ]]> #{endDate}
</if>
</select>
<select id="selectCustomerInfoBySellerId" resultType="com.kiisoo.ic.customer.bean.OpCustomerDTO">
SELECT t2.id,t2.`name`,
t2.member_id as idCard,t0.name as shopName,t0.code as shopCode,
@ -40,18 +65,33 @@
from op_seller_customer_relation t1
left join poi_store t0 on t0.id = t1.store_id
left join poi_store_staff t5 ON t5.store_id = t0.id and t1.user_id = t5.id
LEFT JOIN op_customer t2 ON t2.id = t1.customer_id
JOIN op_customer t2 ON t2.id = t1.customer_id
LEFT JOIN op_vip t3 ON t3.id = t2.member_id
LEFT JOIN privilage_user t4 ON t4.id = t5.user_id where 1 =1
LEFT JOIN privilage_user t4 ON t4.id = t5.user_id
where t1.id > 0
and t1.user_id = #{sellerId}
<if test="startDate != null">
and t1.create_time >= #{startDate}
</if>
<if test="endDate != null">
and t1.create_time <![CDATA[ < ]]> #{endDate}
</if>
GROUP BY t1.customer_id
order by t1.create_time desc,t2.id desc
</select>
<!-- 获取总数 -->
<select id="selectCustomerInfoBySellerId_COUNT" resultType="Long">
SELECT count(DISTINCT t1.customer_id)
from op_seller_customer_relation t1
where t1.id > 0
and t1.user_id = #{sellerId}
<if test="startDate != null">
and t2.create_time >= #{startDate}
and t1.create_time >= #{startDate}
</if>
<if test="endDate != null">
and t2.create_time <![CDATA[ < ]]> #{endDate}
and t1.create_time <![CDATA[ < ]]> #{endDate}
</if>
GROUP BY t2.id
order by t2.create_time desc,t2.id desc
</select>
<!--客户list-->

@ -37,10 +37,10 @@
CONCAT('%',#{search},'%'))
</if>
<if test="startDate != null">
and date(t1.create_time) &gt;= #{startDate}
and t1.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t1.create_time) &lt;= #{endDate}
and t1.create_time &lt;= #{endDate}
</if>
order by t1.create_time desc
</select>
@ -79,10 +79,10 @@
CONCAT('%',#{search},'%'))
</if>
<if test="startDate != null">
and date(t1.create_time) &gt;= #{startDate}
and t1.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t1.create_time) &lt;= #{endDate}
and t1.create_time &lt;= #{endDate}
</if>
order by t1.create_time desc
</select>

@ -22,8 +22,8 @@
select count(id) from op_cp_user_customer_relation
</select>
<select id="selectDistinctAllCount" resultType="java.lang.Long">
select count(distinct customer_user_id) from op_cp_user_customer_relation
<select id="selectDistinctAllCount" resultType="java.util.Map">
EXPLAIN select count(distinct customer_user_id) from op_cp_user_customer_relation
</select>
<select id="selectStoreCount" resultType="java.lang.Long">
@ -38,8 +38,8 @@
</foreach>
</select>
<select id="selectDistinctStoresCount" resultType="java.lang.Long">
select count(distinct customer_user_id) from op_cp_user_customer_relation where cp_user_id in
<select id="selectDistinctStoresCount" resultType="java.util.Map">
EXPLAIN select count(distinct customer_user_id) from op_cp_user_customer_relation where cp_user_id in
<foreach collection="cpUserIds" separator="," item="item" close=")" index="index" open="(">
#{item}
</foreach>

@ -3,8 +3,16 @@
<mapper namespace="com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper">
<select id="selectCpUserByShops" resultType="com.kiisoo.ic.store.entity.StoreUserDTO">
select distinct pcu.cp_user_id as cpUserId,pcu.qr_code as qrCodeAction,pcus.store_id as id,pcu.id as userId ,t.name,t.code
select distinct
pcu.cp_user_id as cpUserId,
pcu.qr_code as qrCodeAction,
pcus.store_id as id,
pcu.id as userId ,
pcu.name as cpUserName ,
pcu.mobile as mobile ,
pcu.alias as alias ,
t.name,
t.code
from poi_store t join privilage_domain_entity t2 on t.id = t2.entity_id and t2.type = 3
left join privilage_cp_user_store pcus on t.id = pcus.store_id
left join privilage_cp_user pcu on pcus.cp_user_id = pcu.id and pcu.status in (1,4)
@ -17,8 +25,7 @@
</foreach>
</if>
</where>
order by pcu.id desc
order by pcu.id desc
</select>
<select id="selectOneByCpUserId" resultType="java.lang.Long">

@ -293,10 +293,10 @@
SELECT count(t.customer_id) from op_seller_customer_relation t
WHERE t.store_id = #{storeId}
<if test="startDate != null">
and date(t.create_time) &gt;= #{startDate}
and t.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t.create_time) &lt;= #{endDate}
and t.create_time &lt; #{endDate}
</if>
group by t.store_id
</select>
@ -308,10 +308,10 @@
AND t2.user_id = #{userId}
</if>
<if test="startDate != null">
and date(t1.create_time) &gt;= #{startDate}
and t1.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t1.create_time) &lt;= #{endDate}
and t1.create_time &lt; #{endDate}
</if>
group by t1.user_id
</select>
@ -329,10 +329,10 @@
WHERE
t. store_id = #{storeId}
<if test="startDate != null">
and date(t.create_time) &gt;= #{startDate}
and t.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t.create_time) &lt;= #{endDate}
and t.create_time &lt; #{endDate}
</if>
GROUP BY
t.user_id
@ -368,10 +368,10 @@
`op_seller_customer_relation` t2
where 1=1
<if test="startDate != null">
and date(t2.create_time) &gt;= #{startDate}
and t2.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t2.create_time) &lt;= #{endDate}
and t2.create_time &lt; #{endDate}
</if>
GROUP BY
t2.store_id
@ -390,10 +390,10 @@
poi_store_staff t1, `op_seller_customer_relation` t2
where t1.id = t2.user_id
<if test="startDate != null">
and date(t2.create_time) &gt;= #{startDate}
and t2.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t2.create_time) &lt;= #{endDate}
and t2.create_time &lt; #{endDate}
</if>
and t1.store_id = #{storeId}
and t1.type = 4

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.kiisoo.ic.activity.mapper.PmnActivityInstanceMapper">
</mapper>

@ -57,7 +57,10 @@ public class JobTest {
// 13278869965
// 19906239800
String cpUserIds = "17386133351";
customerDataJob.handle(null);
customerDataJob.handle(cpUserIds);
// List<String> cpUserIds = dataAccountDOMapper.selectByAccount();
// customerDataJob.handleList(cpUserIds);
log.info("<--获取联系客户统计数据定时任务结束-->");

@ -1,10 +1,17 @@
package test;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kiisoo.ic.activity.entity.*;
import com.kiisoo.ic.activity.service.*;
import com.kiisoo.ic.activity.entity.PmnActivityStoreRelation;
import com.kiisoo.ic.activity.service.IPmnActivityStoreRelationService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kiisoo.ic.activity.entity.*;
import com.kiisoo.ic.activity.service.*;
import com.kiisoo.ic.app.IcApplication;
import com.kiisoo.ic.generalize.entity.PrivilageOrganizational;
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
import com.kiisoo.ic.common.utils.RedisUtil;
import com.kiisoo.ic.employee.mapper.PrivilageCpUserDOMapper;
import com.kiisoo.ic.employee.service.EmployeeService;
@ -17,6 +24,7 @@ import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper;
import com.kiisoo.ic.store.service.StoreEmployeeService;
import com.kiisoo.ic.wx.service.AddWXService;
import lombok.extern.slf4j.Slf4j;
import com.kiisoo.ic.wx.service.QWMailListManageService;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
@ -34,6 +42,11 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;

Loading…
Cancel
Save