|
@@ -1109,6 +1109,87 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
|
|
log.info("机构需求标签====统计结束");
|
|
log.info("机构需求标签====统计结束");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 机构日常数据,咨询记录清洗
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void clubBehaviorInfo() {
|
|
|
|
+ log.info("机构行为记录数据清洗");
|
|
|
|
+ // 获取昨日日期
|
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.setTime(new Date());
|
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
|
+ Date time = calendar.getTime();
|
|
|
|
+ String format = dateFormat.format(time);
|
|
|
|
+ // 机构数据
|
|
|
|
+ List<CmClubPo> clubData = recordMapper.getClubData();
|
|
|
|
+ // 机构访问标签及类型
|
|
|
|
+ List<CmBehaviorRecordPo> clubBehaviorPage = recordMapper.getClubBehaviorPage(format);
|
|
|
|
+ // 机构咨询记录
|
|
|
|
+ List<ClubRemarksPo> clubRemarks = recordMapper.getClubRemarks(format);
|
|
|
|
+ if (null != clubData && clubData.size() > 0) {
|
|
|
|
+ for (CmClubPo club : clubData) {
|
|
|
|
+ // 日常访问
|
|
|
|
+ if (null != clubBehaviorPage && clubBehaviorPage.size() > 0) {
|
|
|
|
+ // 机构昨日浏览数据
|
|
|
|
+ List<CmBehaviorRecordPo> clubBehavior = clubBehaviorPage.stream().filter(re -> re.getUserId().equals(club.getUserId().toString())).collect(Collectors.toList());
|
|
|
|
+ // 访问日常
|
|
|
|
+ if (null != clubBehavior && clubBehavior.size() > 0) {
|
|
|
|
+ CmBehaviorInfo cmBehaviorInfo = new CmBehaviorInfo();
|
|
|
|
+ cmBehaviorInfo.setClubId(club.getClubId());
|
|
|
|
+ cmBehaviorInfo.setSpId(club.getSpId());
|
|
|
|
+ cmBehaviorInfo.setOperateObject(1);
|
|
|
|
+ cmBehaviorInfo.setType(1);
|
|
|
|
+ // 设置机构访问页面类型和标签
|
|
|
|
+ List<CmBehaviorRecordPo> collect = clubBehavior.stream().filter(be -> StringUtils.isNotBlank(be.getPageLabels())).collect(Collectors.toList());
|
|
|
|
+ List<String> pageLabelList = collect.stream().map(CmBehaviorRecordPo::getPageLabels).collect(Collectors.toList());
|
|
|
|
+ String strip = StringUtils.strip(pageLabelList.toString(), "[]");
|
|
|
|
+ if (StringUtils.isNotBlank(strip)) {
|
|
|
|
+ cmBehaviorInfo.setLabel(strip.endsWith(".") ? strip.substring(strip.length() - 1) : strip);
|
|
|
|
+ } else {
|
|
|
|
+ cmBehaviorInfo.setLabel("");
|
|
|
|
+ }
|
|
|
|
+ List<CmBehaviorRecordPo> collect1 = clubBehavior.stream().filter(be -> StringUtils.isNotBlank(be.getPageTypes())).collect(Collectors.toList());
|
|
|
|
+ List<String> pageTypesList = collect1.stream().map(CmBehaviorRecordPo::getPageTypes).collect(Collectors.toList());
|
|
|
|
+ String strip1 = StringUtils.strip(pageTypesList.toString(), "[]");
|
|
|
|
+ if (StringUtils.isNotBlank(strip1)) {
|
|
|
|
+ cmBehaviorInfo.setPageType(strip1);
|
|
|
|
+ } else {
|
|
|
|
+ cmBehaviorInfo.setPageType("");
|
|
|
|
+ }
|
|
|
|
+ recordMapper.insertBehaviorInfo(cmBehaviorInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 咨询记录
|
|
|
|
+ if (null != clubRemarks && clubRemarks.size() > 0) {
|
|
|
|
+ // 机构咨询记录
|
|
|
|
+ List<ClubRemarksPo> clubRemarkList = clubRemarks.stream().filter(re -> re.getClubId().equals(club.getClubId())).collect(Collectors.toList());
|
|
|
|
+ if (null != clubRemarkList && clubRemarkList.size() > 0) {
|
|
|
|
+ CmBehaviorInfo cmBehaviorInfo = new CmBehaviorInfo();
|
|
|
|
+ cmBehaviorInfo.setClubId(club.getClubId());
|
|
|
|
+ cmBehaviorInfo.setSpId(club.getSpId());
|
|
|
|
+ cmBehaviorInfo.setOperateObject(2);
|
|
|
|
+ cmBehaviorInfo.setType(9);
|
|
|
|
+ List<String> labels = new ArrayList<>();
|
|
|
|
+ for (ClubRemarksPo clubRemarksPo : clubRemarkList) {
|
|
|
|
+ if (StringUtils.isNotBlank(clubRemarksPo.getTrendsKeyword())){
|
|
|
|
+ labels.add(clubRemarksPo.getTrendsKeyword());
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(clubRemarksPo.getStateKeyword())) {
|
|
|
|
+ labels.add(clubRemarksPo.getStateKeyword());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String strip = StringUtils.strip(labels.toString(), "[]");
|
|
|
|
+ cmBehaviorInfo.setLabel(StringUtils.isNotBlank(strip)? strip : "");
|
|
|
|
+ recordMapper.insertBehaviorInfo(cmBehaviorInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ log.info("机构行为记录数据清洗结束");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
// 获取IP对应地址 ---- 太平洋
|
|
// 获取IP对应地址 ---- 太平洋
|
|
public static String recordIp(String ip) throws IOException {
|
|
public static String recordIp(String ip) throws IOException {
|