|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fs.common.BeanCopyUtils;
|
|
import com.fs.common.BeanCopyUtils;
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.domain.ResponseResult;
|
|
import com.fs.common.core.domain.ResponseResult;
|
|
@@ -20,6 +21,7 @@ import com.fs.company.constant.CompanyTrafficConstants;
|
|
|
import com.fs.company.domain.Company;
|
|
import com.fs.company.domain.Company;
|
|
|
import com.fs.company.domain.CompanyCompanyFsuser;
|
|
import com.fs.company.domain.CompanyCompanyFsuser;
|
|
|
import com.fs.company.domain.CompanyRedPacketBalanceDeductionRecord;
|
|
import com.fs.company.domain.CompanyRedPacketBalanceDeductionRecord;
|
|
|
|
|
+import com.fs.company.domain.CompanyTag;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.mapper.*;
|
|
import com.fs.company.mapper.*;
|
|
|
import com.fs.company.service.ICompanyService;
|
|
import com.fs.company.service.ICompanyService;
|
|
@@ -41,9 +43,11 @@ import com.fs.course.vo.newfs.*;
|
|
|
import com.fs.his.config.AppConfig;
|
|
import com.fs.his.config.AppConfig;
|
|
|
import com.fs.his.domain.FsUser;
|
|
import com.fs.his.domain.FsUser;
|
|
|
import com.fs.his.domain.FsUserIntegralLogs;
|
|
import com.fs.his.domain.FsUserIntegralLogs;
|
|
|
|
|
+import com.fs.his.domain.FsUserProjectTag;
|
|
|
import com.fs.his.domain.FsUserWx;
|
|
import com.fs.his.domain.FsUserWx;
|
|
|
import com.fs.his.mapper.FsUserIntegralLogsMapper;
|
|
import com.fs.his.mapper.FsUserIntegralLogsMapper;
|
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
|
|
|
+import com.fs.his.mapper.FsUserProjectTagMapper;
|
|
|
import com.fs.his.param.WxSendRedPacketParam;
|
|
import com.fs.his.param.WxSendRedPacketParam;
|
|
|
import com.fs.his.service.IFsStorePaymentService;
|
|
import com.fs.his.service.IFsStorePaymentService;
|
|
|
import com.fs.his.service.IFsUserIntegralLogsService;
|
|
import com.fs.his.service.IFsUserIntegralLogsService;
|
|
@@ -243,6 +247,12 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FsSalesUserPeriodRelationMapper periodRelationMapper;
|
|
private FsSalesUserPeriodRelationMapper periodRelationMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CompanyTagMapper companyTagMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FsUserProjectTagMapper fsUserProjectTagMapper;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询课堂视频
|
|
* 查询课堂视频
|
|
@@ -2251,6 +2261,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
// fsUserCourseBeMemberParam.setCompanyUserId(param.getCompanyUserId());
|
|
// fsUserCourseBeMemberParam.setCompanyUserId(param.getCompanyUserId());
|
|
|
// fsUserService.setRepeatFansTag(fsUserCourseBeMemberParam);
|
|
// fsUserService.setRepeatFansTag(fsUserCourseBeMemberParam);
|
|
|
// }
|
|
// }
|
|
|
|
|
+
|
|
|
|
|
+ // 异步添加营期名称标签
|
|
|
|
|
+ addPeriodTagAsync(param.getUserId(), period, userCompanyUser);
|
|
|
|
|
+
|
|
|
return ResponseResult.ok(fsUser);
|
|
return ResponseResult.ok(fsUser);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4148,5 +4162,97 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService {
|
|
|
fsCourseTrafficLogMapper.insertOrUpdateTrafficLog(trafficLog);
|
|
fsCourseTrafficLogMapper.insertOrUpdateTrafficLog(trafficLog);
|
|
|
asyncDeductTraffic(company, trafficLog);
|
|
asyncDeductTraffic(company, trafficLog);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 异步添加营期名称标签
|
|
|
|
|
+ */
|
|
|
|
|
+ private void addPeriodTagAsync(Long userId, FsUserCoursePeriod period, FsUserCompanyUser userCompanyUser) {
|
|
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String periodName = period.getPeriodName();
|
|
|
|
|
+ if (StringUtils.isBlank(periodName) || userCompanyUser == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Long companyId = Long.parseLong(period.getCompanyId());
|
|
|
|
|
+
|
|
|
|
|
+ // 获取或创建营期标签
|
|
|
|
|
+ CompanyTag tag = getOrCreatePeriodTag(companyId, periodName);
|
|
|
|
|
+ if (tag == null) {
|
|
|
|
|
+ log.error("获取或创建营期标签失败:companyId={}, periodName={}", companyId, periodName);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 检查并添加用户标签关联
|
|
|
|
|
+ addUserTagAssociation(userCompanyUser.getId(), tag.getTagId(), periodName);
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("异步添加营期标签失败:userId={}, periodId={}, error={}", userId, period.getPeriodId(), e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, uploadExecutor);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取或创建营期标签
|
|
|
|
|
+ */
|
|
|
|
|
+ private CompanyTag getOrCreatePeriodTag(Long companyId, String periodName) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 查询该公司的同名标签
|
|
|
|
|
+ CompanyTag queryTag = new CompanyTag();
|
|
|
|
|
+ queryTag.setCompanyId(companyId);
|
|
|
|
|
+ queryTag.setTag(periodName);
|
|
|
|
|
+ List<CompanyTag> existingTags = companyTagMapper.selectCompanyTagList(queryTag);
|
|
|
|
|
+
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(existingTags)) {
|
|
|
|
|
+ return existingTags.get(0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 创建新标签
|
|
|
|
|
+ CompanyTag newTag = new CompanyTag();
|
|
|
|
|
+ newTag.setCompanyId(companyId);
|
|
|
|
|
+ newTag.setTag(periodName);
|
|
|
|
|
+ newTag.setCreateTime(new Date());
|
|
|
|
|
+ companyTagMapper.insertCompanyTag(newTag);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("创建营期标签成功:companyId={}, tag={}, tagId={}", companyId, periodName, newTag.getTagId());
|
|
|
|
|
+ return newTag;
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("获取或创建营期标签异常:companyId={}, periodName={}, error={}", companyId, periodName, e.getMessage(), e);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 添加用户标签关联
|
|
|
|
|
+ */
|
|
|
|
|
+ private void addUserTagAssociation(Long userCompanyUserId, Long tagId, String periodName) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 检查用户是否已绑定该标签
|
|
|
|
|
+ FsUserProjectTag existingUserTag = fsUserProjectTagMapper.selectOne(
|
|
|
|
|
+ Wrappers.<FsUserProjectTag>lambdaQuery()
|
|
|
|
|
+ .eq(FsUserProjectTag::getUserCompanyUserId, userCompanyUserId)
|
|
|
|
|
+ .eq(FsUserProjectTag::getTagId, tagId)
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ if (existingUserTag != null) {
|
|
|
|
|
+ return; // 已存在关联,无需重复添加
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 添加用户标签关联
|
|
|
|
|
+ FsUserProjectTag userProjectTag = new FsUserProjectTag();
|
|
|
|
|
+ userProjectTag.setUserCompanyUserId(userCompanyUserId);
|
|
|
|
|
+ userProjectTag.setTagId(tagId);
|
|
|
|
|
+ userProjectTag.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ fsUserProjectTagMapper.insert(userProjectTag);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("添加用户营期标签成功:userCompanyUserId={}, tagId={}, periodName={}",
|
|
|
|
|
+ userCompanyUserId, tagId, periodName);
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("添加用户标签关联异常:userCompanyUserId={}, tagId={}, periodName={}, error={}",
|
|
|
|
|
+ userCompanyUserId, tagId, periodName, e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|