|
|
@ -1,6 +1,8 @@
|
|
|
|
package com.ruoyi.zhiyuanzhe.service.impl;
|
|
|
|
package com.ruoyi.zhiyuanzhe.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
|
import com.ruoyi.zhiyuanzhe.domain.BActivity;
|
|
|
|
import com.ruoyi.zhiyuanzhe.domain.BActivity;
|
|
|
@ -16,6 +18,7 @@ import com.ruoyi.zhiyuanzhe.service.IBPersonTagsService;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -79,15 +82,61 @@ public class BActivityServiceImpl implements IBActivityService {
|
|
|
|
public void insertBActivity(BActivity bActivity) {
|
|
|
|
public void insertBActivity(BActivity bActivity) {
|
|
|
|
bActivity.setCreateTime(DateUtils.getNowDate());
|
|
|
|
bActivity.setCreateTime(DateUtils.getNowDate());
|
|
|
|
bActivityMapper.insertBActivity(bActivity);
|
|
|
|
bActivityMapper.insertBActivity(bActivity);
|
|
|
|
|
|
|
|
int score = getScore(bActivity);
|
|
|
|
// 获取匹配到的人员
|
|
|
|
// 获取匹配到的人员
|
|
|
|
List<BActivityUser> list = personTagsService.findByTags(bActivity);
|
|
|
|
List<BActivityUser> list = personTagsService.findByTags(bActivity);
|
|
|
|
list.forEach(x -> {
|
|
|
|
list.forEach(x -> {
|
|
|
|
x.setStatus(0);
|
|
|
|
x.setStatus(0);
|
|
|
|
|
|
|
|
if (score != 0) {
|
|
|
|
|
|
|
|
BigDecimal mul = NumberUtil.mul(NumberUtil.div(x.getDegreeOfMatch(), score, 0), 100);
|
|
|
|
|
|
|
|
x.setDegreeOfMatch(mul);
|
|
|
|
|
|
|
|
}
|
|
|
|
x.setActivityId(bActivity.getId());
|
|
|
|
x.setActivityId(bActivity.getId());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
activityUserService.addList(list);
|
|
|
|
activityUserService.addList(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取活动的所有匹配标签项
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param bActivity 活动信息
|
|
|
|
|
|
|
|
* @return 匹配的标签项个数
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private int getScore(BActivity bActivity) {
|
|
|
|
|
|
|
|
int score = 0;
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bActivity.getAgeRange())) {
|
|
|
|
|
|
|
|
score++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bActivity.getHousingRange())) {
|
|
|
|
|
|
|
|
score++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bActivity.getEducationRange())) {
|
|
|
|
|
|
|
|
score++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bActivity.getInterestRange())) {
|
|
|
|
|
|
|
|
score++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bActivity.getPoliticalRange())) {
|
|
|
|
|
|
|
|
score++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bActivity.getSexRange())) {
|
|
|
|
|
|
|
|
score++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bActivity.getNationalityRange())) {
|
|
|
|
|
|
|
|
score++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bActivity.getProfessionalRange())) {
|
|
|
|
|
|
|
|
score++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bActivity.getIndustryRange())) {
|
|
|
|
|
|
|
|
score++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bActivity.getSchoolRange())) {
|
|
|
|
|
|
|
|
score++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return score;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 修改活动管理
|
|
|
|
* 修改活动管理
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -99,10 +148,15 @@ public class BActivityServiceImpl implements IBActivityService {
|
|
|
|
bActivity.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
bActivity.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
// 删除所有人员
|
|
|
|
// 删除所有人员
|
|
|
|
activityUserService.delByActivityId(bActivity.getId());
|
|
|
|
activityUserService.delByActivityId(bActivity.getId());
|
|
|
|
|
|
|
|
int score = getScore(bActivity);
|
|
|
|
// 获取匹配到的人员
|
|
|
|
// 获取匹配到的人员
|
|
|
|
List<BActivityUser> list = personTagsService.findByTags(bActivity);
|
|
|
|
List<BActivityUser> list = personTagsService.findByTags(bActivity);
|
|
|
|
list.forEach(x -> {
|
|
|
|
list.forEach(x -> {
|
|
|
|
x.setStatus(0);
|
|
|
|
x.setStatus(0);
|
|
|
|
|
|
|
|
if (score != 0) {
|
|
|
|
|
|
|
|
BigDecimal mul = NumberUtil.mul(NumberUtil.div(x.getDegreeOfMatch(), score, 0), 100);
|
|
|
|
|
|
|
|
x.setDegreeOfMatch(mul);
|
|
|
|
|
|
|
|
}
|
|
|
|
x.setActivityId(bActivity.getId());
|
|
|
|
x.setActivityId(bActivity.getId());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
activityUserService.addList(list);
|
|
|
|
activityUserService.addList(list);
|
|
|
|