禅道bug修复
This commit is contained in:
parent
02707d6a6b
commit
735eb37858
|
|
@ -87,6 +87,12 @@ public class AddTrainingTaskVo {
|
||||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
private String createUserName = SecurityUtils.getCurrentNickName();
|
private String createUserName = SecurityUtils.getCurrentNickName();
|
||||||
|
|
||||||
|
/**课件ID*/
|
||||||
|
private List<Integer> coursewareIdList;
|
||||||
|
|
||||||
|
/**课件List*/
|
||||||
|
List<CoursewareVo> coursewareVos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询条件限制
|
* 查询条件限制
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,17 @@
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- ZXing 二维码生成库 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>javase</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Minio -->
|
<!-- Minio -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.bonus.common.exam.vo.TrainingTasksVo;
|
||||||
import com.bonus.common.log.annotation.SysLog;
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.exam.service.TrainingTasksService;
|
import com.bonus.exam.service.TrainingTasksService;
|
||||||
|
import com.google.zxing.WriterException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -20,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -47,7 +49,14 @@ public class TrainingTasksController extends BaseController {
|
||||||
@SysLog(title = "培训任务", businessType = OperaType.QUERY,logType = 0,module = "培训任务->培训任务列表")
|
@SysLog(title = "培训任务", businessType = OperaType.QUERY,logType = 0,module = "培训任务->培训任务列表")
|
||||||
public TableDataInfo list(ExamParamDto dto) {
|
public TableDataInfo list(ExamParamDto dto) {
|
||||||
startPage();
|
startPage();
|
||||||
List<TrainingTasksVo> list = service.getTrainingTasksList(dto);
|
List<TrainingTasksVo> list = null;
|
||||||
|
try {
|
||||||
|
list = service.getTrainingTasksList(dto);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (WriterException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.entity.SysFileInfo;
|
import com.bonus.common.entity.SysFileInfo;
|
||||||
import com.bonus.common.exam.dto.ExamParamDto;
|
import com.bonus.common.exam.dto.ExamParamDto;
|
||||||
import com.bonus.common.exam.vo.AddTrainingTaskVo;
|
import com.bonus.common.exam.vo.AddTrainingTaskVo;
|
||||||
|
import com.bonus.common.exam.vo.CoursewareVo;
|
||||||
import com.bonus.common.exam.vo.PersonVo;
|
import com.bonus.common.exam.vo.PersonVo;
|
||||||
import com.bonus.common.exam.vo.TrainingTasksVo;
|
import com.bonus.common.exam.vo.TrainingTasksVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
@ -120,4 +121,24 @@ public interface TrainingTasksMapper {
|
||||||
* @return 数据集合
|
* @return 数据集合
|
||||||
*/
|
*/
|
||||||
double getScore(PersonVo vo);
|
double getScore(PersonVo vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存课件信息
|
||||||
|
* @param coursewareIdList
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void addTrainingTaskCourseware(@Param("list") List<Integer> coursewareIdList, @Param("trainTaskId")String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除课件
|
||||||
|
* @param trainId
|
||||||
|
*/
|
||||||
|
void delTrainingTaskCourseware(String trainId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取课件列表
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<CoursewareVo> getTrainTaskCourseware(ExamParamDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,11 @@ import com.bonus.common.exam.dto.ExamParamDto;
|
||||||
import com.bonus.common.exam.vo.AddTrainingTaskVo;
|
import com.bonus.common.exam.vo.AddTrainingTaskVo;
|
||||||
import com.bonus.common.exam.vo.PersonVo;
|
import com.bonus.common.exam.vo.PersonVo;
|
||||||
import com.bonus.common.exam.vo.TrainingTasksVo;
|
import com.bonus.common.exam.vo.TrainingTasksVo;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.google.zxing.WriterException;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -24,7 +27,7 @@ public interface TrainingTasksService {
|
||||||
* @param dto 实体类
|
* @param dto 实体类
|
||||||
* @return 数据集合
|
* @return 数据集合
|
||||||
*/
|
*/
|
||||||
List<TrainingTasksVo> getTrainingTasksList(ExamParamDto dto);
|
List<TrainingTasksVo> getTrainingTasksList(ExamParamDto dto) throws IOException, WriterException;
|
||||||
/**
|
/**
|
||||||
* 开启签到
|
* 开启签到
|
||||||
* @param id id
|
* @param id id
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,13 @@ import com.bonus.exam.mapper.TrainingTasksMapper;
|
||||||
import com.bonus.exam.service.TrainingTasksService;
|
import com.bonus.exam.service.TrainingTasksService;
|
||||||
import com.bonus.system.api.RemoteFileService;
|
import com.bonus.system.api.RemoteFileService;
|
||||||
import com.bonus.system.api.domain.SysFile;
|
import com.bonus.system.api.domain.SysFile;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.google.zxing.BarcodeFormat;
|
||||||
|
import com.google.zxing.WriterException;
|
||||||
|
import com.google.zxing.client.j2se.MatrixToImageWriter;
|
||||||
|
import com.google.zxing.common.BitMatrix;
|
||||||
|
import com.google.zxing.qrcode.QRCodeWriter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
@ -24,6 +31,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -56,8 +65,33 @@ public class TrainingTasksServiceImpl implements TrainingTasksService {
|
||||||
* @return 数据集合
|
* @return 数据集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TrainingTasksVo> getTrainingTasksList(ExamParamDto dto) {
|
public List<TrainingTasksVo> getTrainingTasksList(ExamParamDto dto) throws IOException, WriterException {
|
||||||
return mapper.getTrainingTasksList(dto);
|
List<TrainingTasksVo> trainingTasksVoList = mapper.getTrainingTasksList(dto);
|
||||||
|
Map<String,Object> res = new HashMap<>();
|
||||||
|
//每条数据生成一个二维码
|
||||||
|
for (TrainingTasksVo trainingTasks:trainingTasksVoList) {
|
||||||
|
res.put("trainingName",trainingTasks.getTrainingName());
|
||||||
|
res.put("trainId",trainingTasks.getId());
|
||||||
|
// 将对象转换为JSON字符串
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
String jsonData = objectMapper.writeValueAsString(res);
|
||||||
|
|
||||||
|
// 生成二维码
|
||||||
|
QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
||||||
|
BitMatrix bitMatrix = qrCodeWriter.encode(
|
||||||
|
jsonData,
|
||||||
|
BarcodeFormat.QR_CODE,
|
||||||
|
300,
|
||||||
|
300
|
||||||
|
);
|
||||||
|
|
||||||
|
// 转换为Base64字符串
|
||||||
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
MatrixToImageWriter.writeToStream(bitMatrix, "PNG", outputStream);
|
||||||
|
byte[] imageBytes = outputStream.toByteArray();
|
||||||
|
trainingTasks.setQrCodeUuid(java.util.Base64.getEncoder().encodeToString(imageBytes));
|
||||||
|
}
|
||||||
|
return trainingTasksVoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -114,8 +148,10 @@ public class TrainingTasksServiceImpl implements TrainingTasksService {
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
return AjaxResult.error("新增培训任务失败");
|
return AjaxResult.error("新增培训任务失败");
|
||||||
}
|
}
|
||||||
|
//保存培训课件
|
||||||
|
if (CollectionUtils.isNotEmpty(vo.getCoursewareIdList())) {
|
||||||
|
mapper.addTrainingTaskCourseware(vo.getCoursewareIdList(), vo.getId());
|
||||||
|
}
|
||||||
// 添加学习任务-相关人员
|
// 添加学习任务-相关人员
|
||||||
List<EkTaskUserVo> taskUserVos = new ArrayList<>();
|
List<EkTaskUserVo> taskUserVos = new ArrayList<>();
|
||||||
taskUserVos = getTaskUsers(vo.getUserIdList(), Integer.valueOf(vo.getId()));
|
taskUserVos = getTaskUsers(vo.getUserIdList(), Integer.valueOf(vo.getId()));
|
||||||
|
|
@ -239,6 +275,9 @@ public class TrainingTasksServiceImpl implements TrainingTasksService {
|
||||||
examPaperVo.setQuestionNum(num);
|
examPaperVo.setQuestionNum(num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 获取学习任务课件
|
||||||
|
List<CoursewareVo> coursewareVos = mapper.getTrainTaskCourseware(dto);
|
||||||
|
vo.setCoursewareVos(coursewareVos);
|
||||||
vo.setExamPaperList(examPaperList);
|
vo.setExamPaperList(examPaperList);
|
||||||
vo.setUserIdList(newUserIdList);
|
vo.setUserIdList(newUserIdList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -281,7 +320,11 @@ public class TrainingTasksServiceImpl implements TrainingTasksService {
|
||||||
learningTaskMapper.delEkTaskUserData(Integer.valueOf(vo.getId()), "2");
|
learningTaskMapper.delEkTaskUserData(Integer.valueOf(vo.getId()), "2");
|
||||||
taskUserVos = getTaskUsers(vo.getUserIdList(), Integer.valueOf(vo.getId()));
|
taskUserVos = getTaskUsers(vo.getUserIdList(), Integer.valueOf(vo.getId()));
|
||||||
learningTaskMapper.addEkTaskUserData(taskUserVos);
|
learningTaskMapper.addEkTaskUserData(taskUserVos);
|
||||||
|
// 存在课件则先删除旧课件并重新添加
|
||||||
|
mapper.delTrainingTaskCourseware(vo.getTrainId());
|
||||||
|
if (CollectionUtils.isNotEmpty(vo.getCoursewareIdList())) {
|
||||||
|
mapper.addTrainingTaskCourseware(vo.getCoursewareIdList(), vo.getId());
|
||||||
|
}
|
||||||
if (CollectionUtils.isNotEmpty(vo.getDelExamPaperIds())) {
|
if (CollectionUtils.isNotEmpty(vo.getDelExamPaperIds())) {
|
||||||
// 删除考试/练习的试卷数据
|
// 删除考试/练习的试卷数据
|
||||||
learningTaskMapper.delExamPapers(vo.getDelExamPaperIds(), "2");
|
learningTaskMapper.delExamPapers(vo.getDelExamPaperIds(), "2");
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,17 @@
|
||||||
VALUES
|
VALUES
|
||||||
(#{id}, #{filePath}, #{fileSize},#{fileName})
|
(#{id}, #{filePath}, #{fileSize},#{fileName})
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="addTrainingTaskCourseware">
|
||||||
|
INSERT INTO edu_train_task_courseware(train_task_id, courseware_id,is_active)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{trainTaskId},
|
||||||
|
#{item},
|
||||||
|
'1'
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
<update id="changeSignStatus">
|
<update id="changeSignStatus">
|
||||||
UPDATE edu_train_task
|
UPDATE edu_train_task
|
||||||
SET sign_status = #{status}
|
SET sign_status = #{status}
|
||||||
|
|
@ -88,6 +99,9 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
||||||
</delete>
|
</delete>
|
||||||
|
<delete id="delTrainingTaskCourseware">
|
||||||
|
DELETE FROM edu_train_task_courseware WHERE train_task_id = #{trainId} AND is_active = '1'
|
||||||
|
</delete>
|
||||||
<select id="getTrainingTasksList" resultType="com.bonus.common.exam.vo.TrainingTasksVo">
|
<select id="getTrainingTasksList" resultType="com.bonus.common.exam.vo.TrainingTasksVo">
|
||||||
SELECT
|
SELECT
|
||||||
ett.train_task_id as id,
|
ett.train_task_id as id,
|
||||||
|
|
@ -165,19 +179,19 @@
|
||||||
from(
|
from(
|
||||||
SELECT
|
SELECT
|
||||||
count(1) AS totalNum,
|
count(1) AS totalNum,
|
||||||
'' AS notSign
|
0 AS notSign
|
||||||
FROM
|
FROM
|
||||||
ek_task_user
|
ek_task_user
|
||||||
WHERE
|
WHERE
|
||||||
task_id =#{id}
|
task_id =#{id}
|
||||||
AND task_type = '2' UNION ALL
|
AND task_type = '2' UNION ALL
|
||||||
SELECT
|
SELECT
|
||||||
'' AS totalNum,
|
0 AS totalNum,
|
||||||
count( 1) AS notSign
|
count( 1) AS notSign
|
||||||
FROM
|
FROM
|
||||||
ek_task_user
|
ek_task_user
|
||||||
WHERE
|
WHERE
|
||||||
task_id = #{id} and (sign_time is not null and sign_time != '' or sign_time != 'null')
|
task_id = #{id} and (sign_time is not null and sign_time != null)
|
||||||
AND task_type = '2')r
|
AND task_type = '2')r
|
||||||
</select>
|
</select>
|
||||||
<select id="isExistTrainTaskName" resultType="java.lang.Integer">
|
<select id="isExistTrainTaskName" resultType="java.lang.Integer">
|
||||||
|
|
@ -244,4 +258,13 @@
|
||||||
epr.uuid = #{userId}
|
epr.uuid = #{userId}
|
||||||
AND estp.study_task_id = #{id}
|
AND estp.study_task_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getTrainTaskCourseware" resultType="com.bonus.common.exam.vo.CoursewareVo">
|
||||||
|
SELECT ec.courseware_id AS coursewareId,
|
||||||
|
ec.courseware_name AS coursewareName,
|
||||||
|
ec.courseware_size AS coursewareSize,
|
||||||
|
ec.study_time AS studyTime
|
||||||
|
FROM edu_train_task_courseware ettc
|
||||||
|
LEFT JOIN edu_courseware ec ON ec.courseware_id = ettc.courseware_id
|
||||||
|
WHERE ettc.train_task_id = #{studyTaskId} AND ettc.is_active = '1'
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue