|
|
@@ -7,7 +7,6 @@ import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
@@ -125,6 +124,7 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
|
|
|
private RemoteWorkTimeService workTimeService;
|
|
|
@Autowired
|
|
|
private ICoreDrillTaskService drillTaskService;
|
|
|
+
|
|
|
@Override
|
|
|
public TableDataInfo<CoreEduTrainingTaskPageVo> selectPage(CoreEduTrainingTaskPageDto request) {
|
|
|
dealTaskPageParam(request);
|
|
|
@@ -1510,41 +1510,47 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void doneTask(JSONObject req) {
|
|
|
- if (ObjectUtil.isEmpty(req) || req.isEmpty()) {
|
|
|
- throw new RuntimeException("参数不能为空");
|
|
|
- }
|
|
|
- String type = (String) req.get("taskType");
|
|
|
- String id = (String) req.get("taskId");
|
|
|
- switch (type) {
|
|
|
- case "1":
|
|
|
- doneTask(id);
|
|
|
+ public void dealTask(EduDrillTaskDealDto req) {
|
|
|
+ Integer taskType = req.getTaskType();
|
|
|
+ switch (taskType) {
|
|
|
+ case 1:
|
|
|
+ doneTask(req);
|
|
|
break;
|
|
|
- case "2":
|
|
|
- drillTaskService.doneTask(id);
|
|
|
+ case 2:
|
|
|
+ drillTaskService.doneTask(req);
|
|
|
break;
|
|
|
default:
|
|
|
- throw new RuntimeException("参数错误");
|
|
|
+ throw new RuntimeException("任务类型参数错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void doneTask(String taskId) {
|
|
|
- CoreEduTrainingTask task = baseMapper.selectById(taskId);
|
|
|
+ private void doneTask(EduDrillTaskDealDto req) {
|
|
|
+
|
|
|
+ CoreEduTrainingTask task = baseMapper.selectById(req.getTaskId());
|
|
|
if (task == null) {
|
|
|
throw new RuntimeException("培训任务不存在!");
|
|
|
}
|
|
|
|
|
|
+ List<Long> userIdList = req.getUserIdList();
|
|
|
+
|
|
|
LambdaQueryWrapper<CoreEduTrainingTaskToUser> taskToUser = new LambdaQueryWrapper<>();
|
|
|
- taskToUser.eq(CoreEduTrainingTaskToUser::getEduTrainingTaskId, taskId);
|
|
|
+ taskToUser.eq(CoreEduTrainingTaskToUser::getEduTrainingTaskId, task.getId());
|
|
|
//参与用户
|
|
|
taskToUser.eq(CoreEduTrainingTaskToUser::getType, 1);
|
|
|
//未签名的
|
|
|
taskToUser.eq(CoreEduTrainingTaskToUser::getSign, 0);
|
|
|
+ //签名图片为空
|
|
|
+ taskToUser.isNull(CoreEduTrainingTaskToUser::getSignImage);
|
|
|
+ taskToUser.in(ObjectUtil.isNotEmpty(userIdList),CoreEduTrainingTaskToUser::getUserId, userIdList);
|
|
|
coreEduTrainingTaskToUserMapper.delete(taskToUser);
|
|
|
- task.setStatus(EduTrainingDoStatus.DONE.getCode());
|
|
|
- baseMapper.updateById(task);
|
|
|
|
|
|
- buildEduPdf(task.getId());
|
|
|
+ if (req.isChangeTaskStatus()) {
|
|
|
+ task.setStatus(EduTrainingDoStatus.DONE.getCode());
|
|
|
+ baseMapper.updateById(task);
|
|
|
+ }
|
|
|
+ if (req.isBuildPdf()) {
|
|
|
+ buildEduPdf(task.getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|