|
@@ -8,9 +8,11 @@ import com.fs.company.cache.ICompanyCacheService;
|
|
|
import com.fs.company.cache.ICompanyUserCacheService;
|
|
|
import com.fs.company.domain.Company;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
+import com.fs.course.domain.FsCourseWatchLog;
|
|
|
import com.fs.course.mapper.FsCourseWatchLogMapper;
|
|
|
import com.fs.course.vo.FsCourseWatchLogTaskVO;
|
|
|
import com.fs.course.vo.FsQwCourseWatchLogVO;
|
|
|
+import com.fs.qw.domain.HyWorkTask;
|
|
|
import com.fs.qw.domain.QwExternalContact;
|
|
|
import com.fs.qw.domain.QwWorkTask;
|
|
|
import com.fs.qw.mapper.HyWorkTaskMapper;
|
|
@@ -42,7 +44,7 @@ import java.util.stream.Collectors;
|
|
|
* @date 2025-03-18
|
|
|
*/
|
|
|
@Service
|
|
|
-public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkTask> implements IHyWorkTaskService {
|
|
|
+public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, HyWorkTask> implements IHyWorkTaskService {
|
|
|
@Autowired
|
|
|
private FsCourseWatchLogMapper fsCourseWatchLogMapper;
|
|
|
@Autowired
|
|
@@ -65,7 +67,7 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
* @return 企微任务看板
|
|
|
*/
|
|
|
@Override
|
|
|
- public QwWorkTask selectHyWorkTaskById(Long id)
|
|
|
+ public HyWorkTask selectHyWorkTaskById(Long id)
|
|
|
{
|
|
|
return baseMapper.selectHyWorkTaskById(id);
|
|
|
}
|
|
@@ -77,7 +79,7 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
* @return 企微任务看板
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<QwWorkTask> selectHyWorkTaskList(QwWorkTask qwWorkTask)
|
|
|
+ public List<HyWorkTask> selectHyWorkTaskList(HyWorkTask qwWorkTask)
|
|
|
{
|
|
|
return baseMapper.selectHyWorkTaskList(qwWorkTask);
|
|
|
}
|
|
@@ -89,7 +91,7 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int insertHyWorkTask(QwWorkTask qwWorkTask)
|
|
|
+ public int insertHyWorkTask(HyWorkTask qwWorkTask)
|
|
|
{
|
|
|
qwWorkTask.setCreateTime(DateUtils.getNowDate());
|
|
|
return baseMapper.insertHyWorkTask(qwWorkTask);
|
|
@@ -102,7 +104,7 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int updateHyWorkTask(QwWorkTask qwWorkTask)
|
|
|
+ public int updateHyWorkTask(HyWorkTask qwWorkTask)
|
|
|
{
|
|
|
qwWorkTask.setUpdateTime(DateUtils.getNowDate());
|
|
|
return baseMapper.updateHyWorkTask(qwWorkTask);
|
|
@@ -135,9 +137,9 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
@Override
|
|
|
public void addHyWorkByFirstCourse() {
|
|
|
List<FsQwCourseWatchLogVO> fsQwCourseWatchLogVOS = fsCourseWatchLogMapper.selectFsCourseWatchLogByVideoId();
|
|
|
- ArrayList<QwWorkTask> qwWorkTasks = new ArrayList<>();
|
|
|
+ ArrayList<HyWorkTask> qwWorkTasks = new ArrayList<>();
|
|
|
for (FsQwCourseWatchLogVO vo : fsQwCourseWatchLogVOS) {
|
|
|
- QwWorkTask qwWorkTask = new QwWorkTask();
|
|
|
+ HyWorkTask qwWorkTask = new HyWorkTask();
|
|
|
qwWorkTask.setCreateTime(DateUtils.getNowDate());
|
|
|
qwWorkTask.setExtId(vo.getQwExternalContactId());
|
|
|
qwWorkTask.setCompanyId(vo.getCompanyId());
|
|
@@ -181,6 +183,7 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
LocalDate today = LocalDate.now();
|
|
|
List<Long> extIds = hyWorkTaskMapper.selectHyWorkTaskByType();
|
|
|
Set<Long> extIdSet = new HashSet<>(extIds);
|
|
|
+ // 获取出执行sop的记录数
|
|
|
for (QwSop qwSop : qwSops) {
|
|
|
if (qwSop.getCourseDay()==null){
|
|
|
continue;
|
|
@@ -190,12 +193,12 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
if (qwSopLogs==null || qwSopLogs.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+ // 每次sop的观看记录
|
|
|
List<FsCourseWatchLogTaskVO> fsCourseWatchLogs = fsCourseWatchLogMapper.selectFsCourseWatchLogByDaySopId3(qwSop.getId());
|
|
|
if (fsCourseWatchLogs==null || fsCourseWatchLogs.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
- List<QwWorkTask> qwWorkTasks = new ArrayList<>();
|
|
|
+ List<HyWorkTask> qwWorkTasks = new ArrayList<>();
|
|
|
for (SopUserLogsInfo qwSopLog : qwSopLogs) {
|
|
|
Map<Long, FsCourseWatchLogTaskVO> map = fsCourseWatchLogs.stream()
|
|
|
.collect(Collectors.toMap(FsCourseWatchLogTaskVO::getQwExternalContactId, data -> data,(oldValue, newValue) -> newValue ));
|
|
@@ -214,7 +217,7 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
if (score==0){
|
|
|
continue;
|
|
|
}
|
|
|
- QwWorkTask qwWorkTask = new QwWorkTask();
|
|
|
+ HyWorkTask qwWorkTask = new HyWorkTask();
|
|
|
qwWorkTask.setCreateTime(DateUtils.getNowDate());
|
|
|
qwWorkTask.setExtId(fsCourseWatchLog.getQwExternalContactId());
|
|
|
qwWorkTask.setCompanyId(fsCourseWatchLog.getCompanyId());
|
|
@@ -240,10 +243,12 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
public void addHyWorkByConversionDay() {
|
|
|
List<QwSop> qwSops = qwSopMapper.selectQwSopByIsRatingNotNull();
|
|
|
Map<Integer, Integer> minMap = new HashMap<>();
|
|
|
+ // level->分值映射
|
|
|
minMap.put(1, 10);
|
|
|
minMap.put(2, 6);
|
|
|
minMap.put(3, 2);
|
|
|
Map<Integer, Integer> MaxMap = new HashMap<>();
|
|
|
+ // level->分值映射
|
|
|
MaxMap.put(1, 25);
|
|
|
MaxMap.put(2, 15);
|
|
|
MaxMap.put(3, 5);
|
|
@@ -295,7 +300,9 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
|
|
|
@Override
|
|
|
public void addHyWorkByCourse4() {
|
|
|
+ // 获取sop模板
|
|
|
List<QwSop> qwSops = qwSopMapper.selectQwSopByIsRating();
|
|
|
+ // 课程
|
|
|
List<Long> extIds = hyWorkTaskMapper.selectHyWorkTaskByType();
|
|
|
Set<Long> extIdSet = new HashSet<>(extIds);
|
|
|
LocalDate today = LocalDate.now();
|
|
@@ -304,19 +311,19 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
continue;
|
|
|
}
|
|
|
Integer courseDay=qwSop.getCourseDay()-1;
|
|
|
- List<SopUserLogsInfo> qwSopLogs = sopUserLogsInfoMapper.selectSopUserLogsInfoBySopId(qwSop.getId());
|
|
|
+ List<SopUserLogsInfo> qwSopLogs = sopUserLogsInfoMapper.selectFsUserIdSopUserLogsInfoBySopId(qwSop.getId());
|
|
|
if (qwSopLogs==null || qwSopLogs.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
- List<FsCourseWatchLogTaskVO> fsCourseWatchLogs = fsCourseWatchLogMapper.selectFsCourseWatchLogByDaySopId4(qwSop.getId());
|
|
|
+ List<FsCourseWatchLogTaskVO> fsCourseWatchLogs = fsCourseWatchLogMapper.selectFsCourseWatchLogByDaySopIdFsUser4(qwSop.getId());
|
|
|
if (fsCourseWatchLogs==null || fsCourseWatchLogs.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
- List<QwWorkTask> qwWorkTasks = new ArrayList<>();
|
|
|
+ List<HyWorkTask> qwWorkTasks = new ArrayList<>();
|
|
|
for (SopUserLogsInfo qwSopLog : qwSopLogs) {
|
|
|
Map<Long, FsCourseWatchLogTaskVO> map = fsCourseWatchLogs.stream()
|
|
|
- .collect(Collectors.toMap(FsCourseWatchLogTaskVO::getQwExternalContactId, data -> data,(oldValue, newValue) -> newValue ));
|
|
|
- FsCourseWatchLogTaskVO fsCourseWatchLog = map.get(qwSopLog.getExternalId());
|
|
|
+ .collect(Collectors.toMap(FsCourseWatchLogTaskVO::getUserId, data -> data,(oldValue, newValue) -> newValue ));
|
|
|
+ FsCourseWatchLogTaskVO fsCourseWatchLog = map.get(qwSopLog.getFsUserId());
|
|
|
if (fsCourseWatchLog == null) {
|
|
|
continue;
|
|
|
}
|
|
@@ -333,7 +340,7 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
if (score==0){
|
|
|
continue;
|
|
|
}
|
|
|
- QwWorkTask qwWorkTask = new QwWorkTask();
|
|
|
+ HyWorkTask qwWorkTask = new HyWorkTask();
|
|
|
qwWorkTask.setCreateTime(DateUtils.getNowDate());
|
|
|
qwWorkTask.setExtId(fsCourseWatchLog.getQwExternalContactId());
|
|
|
qwWorkTask.setCompanyId(fsCourseWatchLog.getCompanyId());
|
|
@@ -395,7 +402,7 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
if (fsCourseWatchLogs==null || fsCourseWatchLogs.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
- List<QwWorkTask> qwWorkTasks = new ArrayList<>();
|
|
|
+ List<HyWorkTask> qwWorkTasks = new ArrayList<>();
|
|
|
for (SopUserLogsInfo qwSopLog : qwSopLogs) {
|
|
|
Map<Long, FsCourseWatchLogTaskVO> map = fsCourseWatchLogs.stream()
|
|
|
.collect(Collectors.toMap(FsCourseWatchLogTaskVO::getQwExternalContactId, data -> data,(oldValue, newValue) -> newValue ));
|
|
@@ -418,7 +425,7 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
if (score==0){
|
|
|
continue;
|
|
|
}
|
|
|
- QwWorkTask qwWorkTask = new QwWorkTask();
|
|
|
+ HyWorkTask qwWorkTask = new HyWorkTask();
|
|
|
qwWorkTask.setCreateTime(DateUtils.getNowDate());
|
|
|
qwWorkTask.setExtId(fsCourseWatchLog.getQwExternalContactId());
|
|
|
qwWorkTask.setCompanyId(fsCourseWatchLog.getCompanyId());
|
|
@@ -446,10 +453,43 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
* @return list
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<QwWorkTask> selectHyWorkTaskListByMap(Map<String, Object> params) {
|
|
|
+ public List<HyWorkTask> selectHyWorkTaskListByMap(Map<String, Object> params) {
|
|
|
return hyWorkTaskMapper.selectHyWorkTaskListByMap(params);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void hyWorkTask() {
|
|
|
+ // 获取看课中断和待看的先导课
|
|
|
+ List<FsCourseWatchLog> fsCourseWatchLogs = hyWorkTaskMapper.hyWorkTaskGetInterruptedAndFirst();
|
|
|
+ List<HyWorkTask> list = new ArrayList<>();
|
|
|
+ for (FsCourseWatchLog fsCourseWatchLog : fsCourseWatchLogs) {
|
|
|
+ HyWorkTask hyWorkTask = new HyWorkTask();
|
|
|
+ hyWorkTask.setCreateTime(DateUtils.getNowDate());
|
|
|
+ hyWorkTask.setExtId(fsCourseWatchLog.getQwExternalContactId());
|
|
|
+ hyWorkTask.setCompanyId(fsCourseWatchLog.getCompanyId());
|
|
|
+ hyWorkTask.setCompanyUserId(fsCourseWatchLog.getCompanyUserId());
|
|
|
+
|
|
|
+ // 看课中断
|
|
|
+ if(fsCourseWatchLog.getLogType()==4){
|
|
|
+ hyWorkTask.setUserId(fsCourseWatchLog.getUserId());
|
|
|
+ hyWorkTask.setStatus(0);
|
|
|
+ hyWorkTask.setType(2);
|
|
|
+ Date createTime = fsCourseWatchLog.getCreateTime();
|
|
|
+ long day = DateUtils.getDaysDifferenceFromNow(createTime);
|
|
|
+ hyWorkTask.setScore(0);
|
|
|
+ hyWorkTask.setTitle("第"+day+"天"+"看课中断");
|
|
|
+ } else {
|
|
|
+ hyWorkTask.setTitle(fsCourseWatchLog.getLogType()==3?"先导课待看课":"先导课完课");
|
|
|
+ }
|
|
|
+ hyWorkTask.setScore(fsCourseWatchLog.getLogType()==3?4:3);
|
|
|
+
|
|
|
+ list.add(hyWorkTask);
|
|
|
+ }
|
|
|
+
|
|
|
+ hyWorkTaskMapper.insertQwWorkTaskBatch(list);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据SOP执行日志和特定条件,为符合要求的外部联系人添加企业微信工作任务。
|
|
|
* <p>
|
|
@@ -493,7 +533,7 @@ public class HyWorkTaskServiceImpl extends ServiceImpl<HyWorkTaskMapper, QwWorkT
|
|
|
|
|
|
|
|
|
private void insertHyWorkTask(String sopId,QwExternalContact qwExternalContact, Integer type, String title, Integer score) {
|
|
|
- QwWorkTask qwWorkTask = new QwWorkTask();
|
|
|
+ HyWorkTask qwWorkTask = new HyWorkTask();
|
|
|
qwWorkTask.setCreateTime(DateUtils.getNowDate());
|
|
|
qwWorkTask.setExtId(qwExternalContact.getId());
|
|
|
qwWorkTask.setCompanyId(qwExternalContact.getCompanyId());
|