|
@@ -9,12 +9,14 @@ import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.param.LoginMaWxParam;
|
|
import com.fs.common.param.LoginMaWxParam;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.course.domain.FsCourseQuestionBank;
|
|
import com.fs.course.domain.FsCourseQuestionBank;
|
|
|
import com.fs.course.mapper.FsUserCourseVideoMapper;
|
|
import com.fs.course.mapper.FsUserCourseVideoMapper;
|
|
|
import com.fs.course.param.FsCourseQuestionAnswerUParam;
|
|
import com.fs.course.param.FsCourseQuestionAnswerUParam;
|
|
|
import com.fs.course.param.FsCourseSendRewardUParam;
|
|
import com.fs.course.param.FsCourseSendRewardUParam;
|
|
|
import com.fs.course.param.newfs.FsUserCourseVideoLinkParam;
|
|
import com.fs.course.param.newfs.FsUserCourseVideoLinkParam;
|
|
|
import com.fs.course.vo.FsUserCourseVO;
|
|
import com.fs.course.vo.FsUserCourseVO;
|
|
|
|
|
+import com.fs.course.vo.FsUserCourseVideoH5DVO;
|
|
|
import com.fs.course.vo.newfs.FsUserCourseVideoPageListVO;
|
|
import com.fs.course.vo.newfs.FsUserCourseVideoPageListVO;
|
|
|
import com.fs.his.domain.FsUser;
|
|
import com.fs.his.domain.FsUser;
|
|
|
import com.fs.his.domain.FsUserOperationLog;
|
|
import com.fs.his.domain.FsUserOperationLog;
|
|
@@ -83,7 +85,14 @@ public class UserOperationLogAspect {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
if (operationLog.getUserId() != null) {
|
|
if (operationLog.getUserId() != null) {
|
|
|
|
|
+ if ("学习课程".equals(operationLog.getOperationType())){
|
|
|
|
|
+ if (StringUtils.isBlank(operationLog.getDetails())){
|
|
|
|
|
+ operationLog = extractCourseFromResult(result);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
logMapper.insertFsUserOperationLog(operationLog);
|
|
logMapper.insertFsUserOperationLog(operationLog);
|
|
|
}
|
|
}
|
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
@@ -141,22 +150,26 @@ public class UserOperationLogAspect {
|
|
|
|
|
|
|
|
private StringBuilder getDetail(UserOperationLog annotation, FsUserOperationEnum opType, FsUser fsUser,Object[] args) {
|
|
private StringBuilder getDetail(UserOperationLog annotation, FsUserOperationEnum opType, FsUser fsUser,Object[] args) {
|
|
|
StringBuilder details = new StringBuilder();
|
|
StringBuilder details = new StringBuilder();
|
|
|
|
|
+ String nickName = fsUser.getNickName();
|
|
|
|
|
+ if (StringUtils.isBlank(nickName)){
|
|
|
|
|
+ nickName = fsUser.getNickname();
|
|
|
|
|
+ }
|
|
|
if (annotation.detail() == null || annotation.detail().isEmpty()) {
|
|
if (annotation.detail() == null || annotation.detail().isEmpty()) {
|
|
|
switch (opType.getValue()) {
|
|
switch (opType.getValue()) {
|
|
|
case 1: // 小程序登录
|
|
case 1: // 小程序登录
|
|
|
- details.append(fsUser.getNickName())
|
|
|
|
|
|
|
+ details.append(nickName)
|
|
|
.append("在")
|
|
.append("在")
|
|
|
.append(DateUtils.getTime())
|
|
.append(DateUtils.getTime())
|
|
|
.append("登录了小程序");
|
|
.append("登录了小程序");
|
|
|
break;
|
|
break;
|
|
|
case 2: // h5登录
|
|
case 2: // h5登录
|
|
|
- details.append(fsUser.getNickName())
|
|
|
|
|
|
|
+ details.append(nickName)
|
|
|
.append("在")
|
|
.append("在")
|
|
|
.append(DateUtils.getTime())
|
|
.append(DateUtils.getTime())
|
|
|
.append("登录了h5");
|
|
.append("登录了h5");
|
|
|
break;
|
|
break;
|
|
|
case 3: // 成为会员
|
|
case 3: // 成为会员
|
|
|
- details.append(fsUser.getNickName())
|
|
|
|
|
|
|
+ details.append(nickName)
|
|
|
.append("在")
|
|
.append("在")
|
|
|
.append(DateUtils.getTime())
|
|
.append(DateUtils.getTime())
|
|
|
.append("注册成为会员");
|
|
.append("注册成为会员");
|
|
@@ -165,14 +178,16 @@ public class UserOperationLogAspect {
|
|
|
break;
|
|
break;
|
|
|
case 5: // 学习课程
|
|
case 5: // 学习课程
|
|
|
String courseInfo = extractCourseInfo(args);
|
|
String courseInfo = extractCourseInfo(args);
|
|
|
- details.append(fsUser.getNickName())
|
|
|
|
|
- .append("在")
|
|
|
|
|
- .append(DateUtils.getTime())
|
|
|
|
|
- .append("观看 ").append(courseInfo);
|
|
|
|
|
|
|
+ if (courseInfo != null) {
|
|
|
|
|
+ details.append(nickName)
|
|
|
|
|
+ .append("在")
|
|
|
|
|
+ .append(DateUtils.getTime())
|
|
|
|
|
+ .append("观看 ").append(courseInfo);
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
case 6: // 答题
|
|
case 6: // 答题
|
|
|
String answerCourse = answerCourse(args);
|
|
String answerCourse = answerCourse(args);
|
|
|
- details.append(fsUser.getNickName())
|
|
|
|
|
|
|
+ details.append(nickName)
|
|
|
.append("在 ")
|
|
.append("在 ")
|
|
|
.append(DateUtils.getTime())
|
|
.append(DateUtils.getTime())
|
|
|
.append("\n")
|
|
.append("\n")
|
|
@@ -181,10 +196,10 @@ public class UserOperationLogAspect {
|
|
|
case 7: // 发送奖励
|
|
case 7: // 发送奖励
|
|
|
String sendReward = sendReward(args);
|
|
String sendReward = sendReward(args);
|
|
|
|
|
|
|
|
- details.append(fsUser.getNickName())
|
|
|
|
|
|
|
+ details.append(nickName)
|
|
|
.append("在 ")
|
|
.append("在 ")
|
|
|
.append(DateUtils.getTime())
|
|
.append(DateUtils.getTime())
|
|
|
- .append("领取红包")
|
|
|
|
|
|
|
+ .append("领取 红包/积分 奖励")
|
|
|
.append("\n")
|
|
.append("\n")
|
|
|
.append(sendReward);
|
|
.append(sendReward);
|
|
|
break;
|
|
break;
|
|
@@ -215,6 +230,30 @@ public class UserOperationLogAspect {
|
|
|
}
|
|
}
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
+ private FsUserOperationLog extractCourseFromResult(Object result) {
|
|
|
|
|
+ if (result instanceof R) {
|
|
|
|
|
+ R r = (R) result;
|
|
|
|
|
+ Object course = r.get("course");
|
|
|
|
|
+ if (course instanceof FsUserCourseVideoH5DVO) {
|
|
|
|
|
+ FsUserOperationLog operationLog = LOG_HOLDER.get();
|
|
|
|
|
+ FsUser fsUser = userMapper.selectFsUserByUserId(operationLog.getUserId());
|
|
|
|
|
+ FsUserCourseVideoH5DVO vo = (FsUserCourseVideoH5DVO) course;
|
|
|
|
|
+ operationLog.setParam(JSON.toJSONString(vo));
|
|
|
|
|
+ StringBuilder details = new StringBuilder();
|
|
|
|
|
+ String nickName = fsUser.getNickName();
|
|
|
|
|
+ if (StringUtils.isBlank(nickName)){
|
|
|
|
|
+ nickName = fsUser.getNickname();
|
|
|
|
|
+ }
|
|
|
|
|
+ details.append(nickName)
|
|
|
|
|
+ .append("在")
|
|
|
|
|
+ .append(DateUtils.getTime())
|
|
|
|
|
+ .append("观看 课程:").append(vo.getCourseName()).append(" 的 ").append(vo.getTitle()).append(" 小节");
|
|
|
|
|
+ operationLog.setDetails(details.toString());
|
|
|
|
|
+ return operationLog;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
private String extractCourseInfo(Object[] args) {
|
|
private String extractCourseInfo(Object[] args) {
|
|
|
if (args == null) return "未知课程";
|
|
if (args == null) return "未知课程";
|
|
|
|
|
|
|
@@ -230,6 +269,8 @@ public class UserOperationLogAspect {
|
|
|
return "课程:"+ vo.getCourseName() + " 的 " + vo.getTitle() + " 小节";
|
|
return "课程:"+ vo.getCourseName() + " 的 " + vo.getTitle() + " 小节";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return null; //自动发课 接口执行完生成
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return "未知课程";
|
|
return "未知课程";
|
|
@@ -240,22 +281,28 @@ public class UserOperationLogAspect {
|
|
|
for (Object arg : args) {
|
|
for (Object arg : args) {
|
|
|
if (arg instanceof FsCourseQuestionAnswerUParam) {
|
|
if (arg instanceof FsCourseQuestionAnswerUParam) {
|
|
|
FsCourseQuestionAnswerUParam param = (FsCourseQuestionAnswerUParam) arg;
|
|
FsCourseQuestionAnswerUParam param = (FsCourseQuestionAnswerUParam) arg;
|
|
|
- if (param.getVideoId() != null && param.getPeriodId() != null) {
|
|
|
|
|
- FsUserCourseVO vo = userCourseVideoMapper.selectFsUserCourseVideoVoByVideoId(param.getVideoId(), param.getPeriodId());
|
|
|
|
|
- if (vo != null){
|
|
|
|
|
- FsUserOperationLog operationLog = LOG_HOLDER.get();
|
|
|
|
|
- operationLog.setParam(JSON.toJSONString(vo));
|
|
|
|
|
- LOG_HOLDER.set(operationLog);
|
|
|
|
|
- StringBuilder details =new StringBuilder("课程:"+ vo.getCourseName() + " 的 " + vo.getTitle() + " 小节 问题为:");
|
|
|
|
|
- List<FsCourseQuestionBank> questions = param.getQuestions();
|
|
|
|
|
- if (questions != null && !questions.isEmpty()) {
|
|
|
|
|
- for (int i = 0; i < questions.size(); i++) {
|
|
|
|
|
- details.append("\n").append(i+1).append(".").append(questions.get(i).getTitle());
|
|
|
|
|
- details.append(" 提交答案为:").append(questions.get(i).getAnswer());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Long videoId = param.getVideoId();
|
|
|
|
|
+ Long periodId = param.getPeriodId();
|
|
|
|
|
+ Long courseId = param.getCourseId();
|
|
|
|
|
+ FsUserCourseVO vo = null;
|
|
|
|
|
+ if (param.getQwExternalId() != null){ //自动看课
|
|
|
|
|
+ vo = userCourseVideoMapper.selectFsUserCourseVideoVoByVideoIdAndCourdeId(videoId,courseId);
|
|
|
|
|
+ } else if (videoId != null && param.getPeriodId() != null) { //手动看课
|
|
|
|
|
+ vo = userCourseVideoMapper.selectFsUserCourseVideoVoByVideoId(videoId, periodId);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (vo != null){
|
|
|
|
|
+ FsUserOperationLog operationLog = LOG_HOLDER.get();
|
|
|
|
|
+ operationLog.setParam(JSON.toJSONString(vo));
|
|
|
|
|
+ LOG_HOLDER.set(operationLog);
|
|
|
|
|
+ StringBuilder details =new StringBuilder("课程:"+ vo.getCourseName() + " 的 " + vo.getTitle() + " 小节 问题为:");
|
|
|
|
|
+ List<FsCourseQuestionBank> questions = param.getQuestions();
|
|
|
|
|
+ if (questions != null && !questions.isEmpty()) {
|
|
|
|
|
+ for (int i = 0; i < questions.size(); i++) {
|
|
|
|
|
+ details.append("\n").append(i+1).append(".").append(questions.get(i).getTitle());
|
|
|
|
|
+ details.append(" 提交答案为:").append(questions.get(i).getAnswer());
|
|
|
}
|
|
}
|
|
|
- return details.toString();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ return details.toString();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -267,16 +314,22 @@ public class UserOperationLogAspect {
|
|
|
for (Object arg : args) {
|
|
for (Object arg : args) {
|
|
|
if (arg instanceof FsCourseSendRewardUParam) {
|
|
if (arg instanceof FsCourseSendRewardUParam) {
|
|
|
FsCourseSendRewardUParam param = (FsCourseSendRewardUParam) arg;
|
|
FsCourseSendRewardUParam param = (FsCourseSendRewardUParam) arg;
|
|
|
- if (param.getVideoId() != null && param.getPeriodId() != null) {
|
|
|
|
|
- FsUserCourseVO vo = userCourseVideoMapper.selectFsUserCourseVideoVoByVideoId(param.getVideoId(), param.getPeriodId());
|
|
|
|
|
- if (vo != null){
|
|
|
|
|
- FsUserOperationLog operationLog = LOG_HOLDER.get();
|
|
|
|
|
- operationLog.setParam(JSON.toJSONString(vo));
|
|
|
|
|
- LOG_HOLDER.set(operationLog);
|
|
|
|
|
- StringBuilder details =new StringBuilder();
|
|
|
|
|
- details.append("课程:"+ vo.getCourseName() + " 的 " + vo.getTitle() + " 小节");
|
|
|
|
|
- return details.toString();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Long videoId = param.getVideoId();
|
|
|
|
|
+ Long periodId = param.getPeriodId();
|
|
|
|
|
+ Long courseId = param.getCourseId();
|
|
|
|
|
+ FsUserCourseVO vo = null;
|
|
|
|
|
+ if (param.getQwExternalId() != null){ //自动看课
|
|
|
|
|
+ vo = userCourseVideoMapper.selectFsUserCourseVideoVoByVideoIdAndCourdeId(videoId,courseId);
|
|
|
|
|
+ } else if (videoId != null && param.getPeriodId() != null) { //手动看课
|
|
|
|
|
+ vo = userCourseVideoMapper.selectFsUserCourseVideoVoByVideoId(videoId, periodId);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (vo != null){
|
|
|
|
|
+ FsUserOperationLog operationLog = LOG_HOLDER.get();
|
|
|
|
|
+ operationLog.setParam(JSON.toJSONString(vo));
|
|
|
|
|
+ LOG_HOLDER.set(operationLog);
|
|
|
|
|
+ StringBuilder details =new StringBuilder();
|
|
|
|
|
+ details.append("课程:"+ vo.getCourseName() + " 的 " + vo.getTitle() + " 小节");
|
|
|
|
|
+ return details.toString();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|