Просмотр исходного кода

[系统][新增]:扫描会员表,打标签

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
f7e4021777
3 измененных файлов: 88 добавлений и 4 удалений
  1. +41
    -0
      mallinkSchedule/src/main/java/com/iformall/schedule/WxCUserTagsSchedule.java
  2. +1
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumAssignTagsTrigger.java
  3. +46
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java

+ 41
- 0
mallinkSchedule/src/main/java/com/iformall/schedule/WxCUserTagsSchedule.java Просмотреть файл

@@ -0,0 +1,41 @@
package com.iformall.schedule;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.enums.EnumAssignTagsTrigger;
import com.iformall.service.WxCUserBasicInfoService;
import com.iformall.service.WxCUserTagsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


@Component
public class WxCUserTagsSchedule {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
WxCUserTagsService wxCUserTagsService;

@Autowired
WxCUserBasicInfoService wxCUserBasicInfoService;

@Scheduled(cron = "0 0 3 * * ?") // 每天凌晨03:00对会员列表扫描补录标签
//@Scheduled(cron = "0 */5 * * * ?") // 测试1分钟一次
public void wxCUserTagsSchedule() {
WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo();

int pageIndex = 1;
final int pageSize = 1000;

PageInfo page;
do{
page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageIndex++, pageSize);
page.getList().parallelStream().forEach(cubi -> {
wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_SCAN, cubi);
});
} while ((page.isHasNextPage()));
}
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/enums/EnumAssignTagsTrigger.java Просмотреть файл

@@ -13,6 +13,7 @@ public enum EnumAssignTagsTrigger {
ASSIGN_TAGS_TRIGGER_CAR(4, "停车"),
ASSIGN_TAGS_TRIGGER_BUY(5, "购买"),
ASSIGN_TAGS_TRIGGER_USE(6, "核销"),
ASSIGN_TAGS_TRIGGER_SCAN(7, "扫描会员列表"),
;

public static EnumAssignTagsTrigger getEnum(Integer code) {


+ 46
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java Просмотреть файл

@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.domain.po.WxCUserTags;
import com.iformall.domain.po.WxTags;
import com.iformall.domain.po.*;
import com.iformall.enums.EnumAssignTagsTrigger;
import com.iformall.enums.EnumCUserBaseInfoSex;
import com.iformall.enums.EnumTag;
@@ -44,9 +41,14 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
@Autowired
WxTagsMapper wxTagsMapper;

@Autowired
WxCUserCarMapper wxCUserCarMapper;

@Autowired
WxTagsService wxTagsService;



@Override
public PageInfo<WxCUserTags> listAsPage(WxCUserTags record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserTagsMapper.findList(record));
@@ -596,6 +598,46 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
}
}
break;
case ASSIGN_TAGS_TRIGGER_SCAN: {
WxCUserBasicInfo user = (WxCUserBasicInfo) obj;
WxCUser param = wxCUserMapper.selectByPrimaryKey(user.getId());
if (user != null && param != null) {
if (user.getSex() != null) {
//性别
resList = assignTypeId1(user, user.getSex());
}
if (user.getBirthdate() != null) {
//X0后
resList = assignTypeId2(user, user.getBirthdate());
//生肖
resList = assignTypeId3(user, user.getBirthdate());
//星座
resList = assignTypeId4(user, user.getBirthdate());
}
if (user.getPhone() != null) {
//运营商
resList = assignTypeId7(user, user.getPhone());
}
if (user.getEducation() != null) {
//学历
resList = assignTypeId6(user, user.getEducation());
}

//消费时段
resList = assignTypeId18(user, param);
//消费频度
resList = assignTypeId22(user, param);
//活跃
resList = assignTypeId21(user, param);

//车
WxCUserCar wxCUserCar = new WxCUserCar();
wxCUserCar.setCUserId(param.getId());
if (wxCUserCarMapper.countList(wxCUserCar) > 0) {
resList = assignTypeId11(user);
}
}
}
default:
return null;



Загрузка…
Отмена
Сохранить