0402-2
This commit is contained in:
parent
06c861bf0f
commit
8d6a160434
@ -150,5 +150,5 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
|
||||
* @param userId 学员id
|
||||
* @param tenantId 租户id
|
||||
*/
|
||||
Boolean updateStudentPassAndGradTime(Date passTime, Long userId, String tenantId);
|
||||
Boolean updateStudentPassAndGradTime(Date passTime, Long userId, Long tenantId);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
*/
|
||||
@TenantIgnore
|
||||
@Override
|
||||
public Boolean updateStudentPassAndGradTime(Date passTime, Long userId, String tenantId) {
|
||||
public Boolean updateStudentPassAndGradTime(Date passTime, Long userId, Long tenantId) {
|
||||
if (ObjectUtils.isEmpty(passTime) || ObjectUtils.isEmpty(userId) || ObjectUtils.isEmpty(tenantId)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@ -59,4 +60,28 @@ public class ProcessSmallProgramController {
|
||||
processService.updateProcess(process);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过学员id和课程id查询学员课程进度
|
||||
*
|
||||
* @param userId 学员id
|
||||
* @param courseId 课程id
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.util.List < cn.iocoder.yudao.module.course.vo.ProcessVO>>
|
||||
*/
|
||||
@GetMapping("/getAllByUserIdAndCourseId")
|
||||
@TenantIgnore
|
||||
@PermitAll
|
||||
public CommonResult<?> getAllByUserIdAndCourseId(Long userId, String courseId) {
|
||||
return success(processService.getAllByUserIdAndCourseId(userId, courseId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据userId查询考试列表
|
||||
*/
|
||||
@GetMapping("/getExamListByUserId")
|
||||
@TenantIgnore
|
||||
@PermitAll
|
||||
public CommonResult<?> getExamListByUserId(Long userId) {
|
||||
return success(processService.getExamListByUserId(userId));
|
||||
}
|
||||
}
|
||||
|
@ -119,4 +119,10 @@ public interface ProcessService extends IService<Process> {
|
||||
* @return java.util.List<cn.iocoder.yudao.module.course.vo.ProcessVO>
|
||||
*/
|
||||
List<ProcessVO> getAllByUserIdAndCourseId(Long userId, String courseId);
|
||||
|
||||
/**
|
||||
* 根据userId查询考试列表
|
||||
* @param userId 用户id
|
||||
*/
|
||||
List<ProcessVO> getExamListByUserId(Long userId);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.entity.SchoolCommission;
|
||||
import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
|
||||
@ -30,6 +31,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -56,6 +58,9 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
|
||||
@Resource
|
||||
private SchoolCourseOrderService schoolCourseOrderService;
|
||||
@Lazy
|
||||
@Resource
|
||||
private DlDriveSchoolStudentService dlDriveSchoolStudentService;
|
||||
|
||||
|
||||
/**
|
||||
@ -323,14 +328,28 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
.eq(Process::getUserId, process.getUserId())
|
||||
.eq(Process::getSubject, process.getSubject())
|
||||
.eq(Process::getCourseId, process.getCourseId())
|
||||
.eq(Process::getDeleted, false)
|
||||
.eq(Process::getTenantId, process.getTenantId())
|
||||
.eq(Process::getDeleted, SchoolBaseConstants.COMMON_NO)
|
||||
.set(process.getUserName() != null, Process::getUserName, process.getUserName())
|
||||
.set(process.getExamStatus() != null, Process::getExamStatus, process.getExamStatus())
|
||||
.set(process.getExamScore() != null, Process::getExamScore, process.getExamScore())
|
||||
|
||||
.set(process.getRemark() != null, Process::getRemark, process.getRemark())
|
||||
.set(process.getExamTime() != null, Process::getExamTime, process.getExamTime())
|
||||
.set(process.getImages() != null, Process::getImages, process.getImages()));
|
||||
.set(process.getImages() != null, Process::getImages, process.getImages())
|
||||
.setSql("exam_num = IFNULL(exam_num, 0) + 1"));
|
||||
|
||||
if(process.getSubject() == 1){
|
||||
update(Wrappers.lambdaUpdate(Process.class)
|
||||
.eq(Process::getUserId, process.getUserId())
|
||||
.eq(Process::getSubject, 2)
|
||||
.eq(Process::getCourseId, process.getCourseId())
|
||||
.eq(Process::getDeleted, SchoolBaseConstants.COMMON_NO)
|
||||
.set(Process::getStatus, SchoolBaseConstants.PROCESS_STATUS_IN_PROGRESS));
|
||||
}
|
||||
if(process.getSubject() == 4){
|
||||
dlDriveSchoolStudentService.updateStudentPassAndGradTime(process.getExamTime(),process.getUserId(),process.getTenantId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -352,6 +371,24 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据userId查询考试列表
|
||||
* @param userId 用户id
|
||||
*/
|
||||
@Override
|
||||
public List<ProcessVO> getExamListByUserId(Long userId) {
|
||||
if (userId == null) {
|
||||
return null;
|
||||
}
|
||||
List<Process> processList = processMapper.selectList(
|
||||
Wrappers.lambdaQuery(Process.class)
|
||||
.eq(Process::getUserId, userId)
|
||||
.in(Process::getStatus, Arrays.asList("1", "2"))
|
||||
.isNotNull(Process::getExamScore)
|
||||
);
|
||||
return BeanUtil.copyToList(processList, ProcessVO.class);
|
||||
}
|
||||
|
||||
private static void verify(List<Process> processes) {
|
||||
for (Process process : processes) {
|
||||
// 校验状态
|
||||
|
@ -28,15 +28,6 @@
|
||||
<if test="entity.userId != null and entity.userId != ''"> and main.user_id = #{entity.userId}</if>
|
||||
<if test="entity.paymentStatus != null and entity.paymentStatus != ''"> and main.payment_status = #{entity.paymentStatus}</if>
|
||||
<if test="entity.ifEnd != null and entity.ifEnd != ''"> and main.if_end = #{entity.ifEnd}</if>
|
||||
main.deleted = 0
|
||||
<if test="entity.orderNo!= null and entity.orderNo != ''">and main.order_no = #{entity.orderNo}</if>
|
||||
<if test="entity.userName != null and entity.userName != ''">and main.user_name like concat('%',
|
||||
#{entity.userName}, '%')
|
||||
</if>
|
||||
<if test="entity.userId != null and entity.userId != ''">and main.user_id = #{entity.userId}</if>
|
||||
<if test="entity.paymentStatus != null and entity.paymentStatus != ''">and main.payment_status =
|
||||
#{entity.paymentStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by main.create_time desc
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user