安全菜单修改
This commit is contained in:
@ -6,15 +6,23 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.other.domain.dto.devicepreset.OthDevicePresetCreateReq;
|
||||
import org.dromara.other.domain.dto.devicepreset.OthDevicePresetQueryReq;
|
||||
import org.dromara.other.domain.dto.devicepreset.OthDevicePresetUpdateReq;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCaptureReq;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgQueryReq;
|
||||
import org.dromara.other.domain.vo.devicepreset.OthDevicePresetVo;
|
||||
import org.dromara.other.domain.vo.ys7deviceimg.OthYs7DeviceImgVo;
|
||||
import org.dromara.other.service.IOthDevicePresetService;
|
||||
import org.dromara.other.service.IOthYs7DeviceImgService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -35,6 +43,9 @@ public class OthYs7DeviceImgController extends BaseController {
|
||||
@Resource
|
||||
private IOthYs7DeviceImgService othYs7DeviceImgService;
|
||||
|
||||
@Resource
|
||||
private IOthDevicePresetService othDevicePresetService;
|
||||
|
||||
/**
|
||||
* 查询萤石摄像头图片列表
|
||||
*/
|
||||
@ -70,7 +81,7 @@ public class OthYs7DeviceImgController extends BaseController {
|
||||
/**
|
||||
* 萤石摄像头图片抓图
|
||||
*/
|
||||
@SaCheckPermission("other:ys7DeviceImg:capture")
|
||||
@SaCheckPermission("other:ys7DeviceImg:add")
|
||||
@Log(title = "萤石摄像头图片", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/capture")
|
||||
public R<Void> capture(@RequestBody OthYs7DeviceImgCaptureReq req) {
|
||||
@ -90,4 +101,73 @@ public class OthYs7DeviceImgController extends BaseController {
|
||||
return toAjax(othYs7DeviceImgService.deleteWithValidByIds(List.of(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询摄像头预置位列表
|
||||
*/
|
||||
@SaCheckPermission("other:ys7DeviceImg:list")
|
||||
@GetMapping("/preset/list")
|
||||
public TableDataInfo<OthDevicePresetVo> listPreset(OthDevicePresetQueryReq req, PageQuery pageQuery) {
|
||||
return othDevicePresetService.queryPageList(req, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取摄像头预置位详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("other:ys7DeviceImg:query")
|
||||
@GetMapping("/preset/{id}")
|
||||
public R<OthDevicePresetVo> getInfoPreset(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(othDevicePresetService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增摄像头预置位
|
||||
*/
|
||||
@SaCheckPermission("other:ys7DeviceImg:add")
|
||||
@Log(title = "摄像头预置位", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/preset")
|
||||
public R<Long> addPreset(@Validated(AddGroup.class) @RequestBody OthDevicePresetCreateReq req) {
|
||||
return R.ok(othDevicePresetService.insertByBo(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改摄像头预置位
|
||||
*/
|
||||
@SaCheckPermission("other:ys7DeviceImg:edit")
|
||||
@Log(title = "摄像头预置位", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/preset")
|
||||
public R<Void> editPreset(@Validated(EditGroup.class) @RequestBody OthDevicePresetUpdateReq req) {
|
||||
return toAjax(othDevicePresetService.updateByBo(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用摄像头预置位
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("other:ys7DeviceImg:move")
|
||||
@Log(title = "摄像头预置位", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/preset/move/{id}")
|
||||
public R<Void> movePreset(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return toAjax(othDevicePresetService.moveById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除摄像头预置位
|
||||
*
|
||||
* @param id 主键串
|
||||
*/
|
||||
@SaCheckPermission("other:ys7DeviceImg:remove")
|
||||
@Log(title = "摄像头预置位", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/preset/{id}")
|
||||
public R<Void> removePreset(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return toAjax(othDevicePresetService.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,132 +0,0 @@
|
||||
package org.dromara.safety.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.safety.domain.dto.documentsafetymeeting.HseDocumentSafetyMeetingCreateFileReq;
|
||||
import org.dromara.safety.domain.dto.documentsafetymeeting.HseDocumentSafetyMeetingCreateFolderReq;
|
||||
import org.dromara.safety.domain.dto.documentsafetymeeting.HseDocumentSafetyMeetingQueryReq;
|
||||
import org.dromara.safety.domain.vo.documentsafetymeeting.HseDocumentSafetyMeetingRecycleBinVo;
|
||||
import org.dromara.safety.domain.vo.documentsafetymeeting.HseDocumentSafetyMeetingVo;
|
||||
import org.dromara.safety.service.IHseDocumentSafetyMeetingService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全会议纪要
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/safety/documentSafetyMeeting")
|
||||
public class HseDocumentSafetyMeetingController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private IHseDocumentSafetyMeetingService documentSafetyMeetingService;
|
||||
|
||||
/**
|
||||
* 查询安全会议纪要列表
|
||||
*/
|
||||
@SaCheckPermission("safety:documentSafetyMeeting:list")
|
||||
@GetMapping("/list")
|
||||
public R<List<HseDocumentSafetyMeetingVo>> list(HseDocumentSafetyMeetingQueryReq req) {
|
||||
return R.ok(documentSafetyMeetingService.queryList(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询安全会议纪要回收站列表
|
||||
*/
|
||||
@SaCheckPermission("safety:documentSafetyMeeting:recycleBinList")
|
||||
@GetMapping("/recycleBin/list")
|
||||
public TableDataInfo<HseDocumentSafetyMeetingRecycleBinVo> list(HseDocumentSafetyMeetingQueryReq req, PageQuery pageQuery) {
|
||||
return documentSafetyMeetingService.queryRecycleBinPageList(req, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取安全会议纪要详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("safety:documentSafetyMeeting:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<HseDocumentSafetyMeetingVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(documentSafetyMeetingService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增安全会议纪要文件夹
|
||||
*/
|
||||
@SaCheckPermission("safety:documentSafetyMeeting:folder")
|
||||
@Log(title = "安全会议纪要", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/folder")
|
||||
public R<Long> addFolder(@RequestBody HseDocumentSafetyMeetingCreateFolderReq req) {
|
||||
return R.ok(documentSafetyMeetingService.insertByFolder(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增安全会议纪要文件
|
||||
*/
|
||||
@SaCheckPermission("safety:documentSafetyMeeting:file")
|
||||
@Log(title = "安全会议纪要", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/file")
|
||||
public R<Long> addFile(@RequestPart("file") MultipartFile file, HseDocumentSafetyMeetingCreateFileReq req) {
|
||||
return R.ok(documentSafetyMeetingService.insertByFile(file, req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量恢复安全会议纪要文件
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:documentSafetyMeeting:recovery")
|
||||
@Log(title = "安全会议纪要", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/recovery/{ids}")
|
||||
public R<Void> recovery(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(documentSafetyMeetingService.recoveryBatchById(List.of(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除安全会议纪要
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:documentSafetyMeeting:remove")
|
||||
@Log(title = "安全会议纪要", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(documentSafetyMeetingService.deleteWithRecycleBin(List.of(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 彻底删除安全会议纪要
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:documentSafetyMeeting:completelyDelete")
|
||||
@Log(title = "安全会议纪要", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/completelyDelete/{ids}")
|
||||
public R<Void> completelyDelete(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(documentSafetyMeetingService.completelyDelete(List.of(ids)));
|
||||
}
|
||||
|
||||
}
|
||||
@ -151,7 +151,7 @@ public class HseFileFolderController extends BaseController {
|
||||
return R.ok(hseFileFolderService.unzip(id, parentId));
|
||||
}
|
||||
|
||||
@SaCheckPermission("safety:fileFolder:reName")
|
||||
@SaCheckPermission("safety:fileFolder:edit")
|
||||
@PutMapping("/reName")
|
||||
public R<Boolean> reName(@RequestParam("id") Long id,
|
||||
@RequestParam("name") String name) {
|
||||
|
||||
@ -42,7 +42,7 @@ public class HseKnowledgeDocumentController extends BaseController {
|
||||
/**
|
||||
* 分页查询安全知识库文件列表
|
||||
*/
|
||||
@SaCheckPermission("safety:knowledgeDocument:filePage")
|
||||
@SaCheckPermission("safety:knowledgeDocument:list")
|
||||
@GetMapping("/file/page")
|
||||
public TableDataInfo<HseKnowledgeDocumentVo> queryFilePageList(HseKnowledgeDocumentFileQueryReq req, PageQuery pageQuery) {
|
||||
return hseKnowledgeDocumentService.queryFilePageByFolderId(req, pageQuery);
|
||||
@ -51,7 +51,7 @@ public class HseKnowledgeDocumentController extends BaseController {
|
||||
/**
|
||||
* 查询安全知识库文件列表
|
||||
*/
|
||||
@SaCheckPermission("safety:knowledgeDocument:fileList")
|
||||
@SaCheckPermission("safety:knowledgeDocument:list")
|
||||
@GetMapping("/file/list/{folderId}")
|
||||
public R<List<HseKnowledgeDocumentVo>> queryFileListByFolderId(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long folderId) {
|
||||
@ -61,7 +61,7 @@ public class HseKnowledgeDocumentController extends BaseController {
|
||||
/**
|
||||
* 查询安全知识库文件树列表
|
||||
*/
|
||||
@SaCheckPermission("safety:knowledgeDocument:folderTreeList")
|
||||
@SaCheckPermission("safety:knowledgeDocument:list")
|
||||
@GetMapping("/folder/tree/list")
|
||||
public R<List<Tree<Long>>> queryFolderTreeList(HseKnowledgeDocumentQueryReq req) {
|
||||
List<Tree<Long>> list = hseKnowledgeDocumentService.queryFolderTreeList(req);
|
||||
@ -71,7 +71,7 @@ public class HseKnowledgeDocumentController extends BaseController {
|
||||
/**
|
||||
* 查询安全知识库回收站文件列表
|
||||
*/
|
||||
@SaCheckPermission("safety:knowledgeDocument:recycleBinList")
|
||||
@SaCheckPermission("safety:knowledgeDocument:list")
|
||||
@GetMapping("/recycleBin/list")
|
||||
public TableDataInfo<HseKnowledgeDocumentVo> queryRecycleBinPageList(HseKnowledgeDocumentQueryReq req, PageQuery pageQuery) {
|
||||
return hseKnowledgeDocumentService.queryRecycleBinPageList(req, pageQuery);
|
||||
@ -92,7 +92,7 @@ public class HseKnowledgeDocumentController extends BaseController {
|
||||
/**
|
||||
* 新增安全知识库文件
|
||||
*/
|
||||
@SaCheckPermission("safety:knowledgeDocument:file")
|
||||
@SaCheckPermission("safety:knowledgeDocument:add")
|
||||
@Log(title = "安全知识库", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/file")
|
||||
@ -103,7 +103,7 @@ public class HseKnowledgeDocumentController extends BaseController {
|
||||
/**
|
||||
* 修改安全知识库
|
||||
*/
|
||||
@SaCheckPermission("safety:knowledgeDocument:file")
|
||||
@SaCheckPermission("safety:knowledgeDocument:edit")
|
||||
@Log(title = "安全知识库", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/file")
|
||||
@ -116,7 +116,7 @@ public class HseKnowledgeDocumentController extends BaseController {
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("safety:knowledgeDocument:file")
|
||||
@SaCheckPermission("safety:knowledgeDocument:remove")
|
||||
@Log(title = "安全知识库", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/file/{id}")
|
||||
public R<Void> remove(@NotNull(message = "主键不能为空")
|
||||
@ -129,7 +129,7 @@ public class HseKnowledgeDocumentController extends BaseController {
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:knowledgeDocument:fileRecycleBin")
|
||||
@SaCheckPermission("safety:knowledgeDocument:remove")
|
||||
@Log(title = "安全知识库", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/file/recycleBin/{ids}")
|
||||
public R<Void> removeRecycleBin(@NotNull(message = "主键不能为空")
|
||||
@ -140,7 +140,7 @@ public class HseKnowledgeDocumentController extends BaseController {
|
||||
/**
|
||||
* 根据主键id批量恢复
|
||||
*/
|
||||
@SaCheckPermission("safety:knowledgeDocument:recovery")
|
||||
@SaCheckPermission("safety:knowledgeDocument:edit")
|
||||
@Log(title = "安全知识库", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/recovery/{ids}")
|
||||
public R<Void> recoveryBatchById(@NotNull(message = "主键不能为空")
|
||||
|
||||
@ -1,110 +0,0 @@
|
||||
package org.dromara.safety.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.safety.domain.dto.questionbank.HseQuestionBankCreateReq;
|
||||
import org.dromara.safety.domain.dto.questionbank.HseQuestionBankQueryReq;
|
||||
import org.dromara.safety.domain.dto.questionbank.HseQuestionBankUpdateReq;
|
||||
import org.dromara.safety.domain.vo.questionbank.HseQuestionBankVo;
|
||||
import org.dromara.safety.service.IHseQuestionBankService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题库
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/safety/questionBank")
|
||||
public class HseQuestionBankController extends BaseController {
|
||||
|
||||
private final IHseQuestionBankService questionBankService;
|
||||
|
||||
/**
|
||||
* 查询题库列表
|
||||
*/
|
||||
@SaCheckPermission("safety:questionBank:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HseQuestionBankVo> list(HseQuestionBankQueryReq req, PageQuery pageQuery) {
|
||||
return questionBankService.queryPageList(req, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出题库列表
|
||||
*/
|
||||
@SaCheckPermission("safety:questionBank:export")
|
||||
@Log(title = "题库", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HseQuestionBankQueryReq req, HttpServletResponse response) {
|
||||
List<HseQuestionBankVo> list = questionBankService.queryList(req);
|
||||
ExcelUtil.exportExcel(list, "题库", HseQuestionBankVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("safety:questionBank:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<HseQuestionBankVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(questionBankService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增题库
|
||||
*/
|
||||
@SaCheckPermission("safety:questionBank:add")
|
||||
@Log(title = "题库", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Long> add(@Validated(AddGroup.class) @RequestBody HseQuestionBankCreateReq req,
|
||||
HttpServletRequest request) {
|
||||
return R.ok(questionBankService.insertByBo(req, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改题库
|
||||
*/
|
||||
@SaCheckPermission("safety:questionBank:edit")
|
||||
@Log(title = "题库", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody HseQuestionBankUpdateReq req) {
|
||||
return toAjax(questionBankService.updateByBo(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除题库
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:questionBank:remove")
|
||||
@Log(title = "题库", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(questionBankService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@ -1,108 +0,0 @@
|
||||
package org.dromara.safety.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.safety.domain.dto.questionscategory.HseQuestionsCategoryCreateReq;
|
||||
import org.dromara.safety.domain.dto.questionscategory.HseQuestionsCategoryQueryReq;
|
||||
import org.dromara.safety.domain.dto.questionscategory.HseQuestionsCategoryUpdateReq;
|
||||
import org.dromara.safety.domain.vo.questionscategory.HseQuestionsCategoryVo;
|
||||
import org.dromara.safety.service.IHseQuestionsCategoryService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题库类别
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/safety/questionsCategory")
|
||||
public class HseQuestionsCategoryController extends BaseController {
|
||||
|
||||
private final IHseQuestionsCategoryService questionsCategoryService;
|
||||
|
||||
/**
|
||||
* 查询题库类别列表
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsCategory:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HseQuestionsCategoryVo> list(HseQuestionsCategoryQueryReq req, PageQuery pageQuery) {
|
||||
return questionsCategoryService.queryPageList(req, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出题库类别列表
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsCategory:export")
|
||||
@Log(title = "题库类别", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HseQuestionsCategoryQueryReq req, HttpServletResponse response) {
|
||||
List<HseQuestionsCategoryVo> list = questionsCategoryService.queryList(req);
|
||||
ExcelUtil.exportExcel(list, "题库类别", HseQuestionsCategoryVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库类别详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsCategory:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<HseQuestionsCategoryVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(questionsCategoryService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增题库类别
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsCategory:add")
|
||||
@Log(title = "题库类别", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Long> add(@Validated(AddGroup.class) @RequestBody HseQuestionsCategoryCreateReq req) {
|
||||
return R.ok(questionsCategoryService.insertByBo(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改题库类别
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsCategory:edit")
|
||||
@Log(title = "题库类别", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody HseQuestionsCategoryUpdateReq req) {
|
||||
return toAjax(questionsCategoryService.updateByBo(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除题库类别
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsCategory:remove")
|
||||
@Log(title = "题库类别", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(questionsCategoryService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@ -1,108 +0,0 @@
|
||||
package org.dromara.safety.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.safety.domain.dto.questionsconfig.HseQuestionsConfigCreateReq;
|
||||
import org.dromara.safety.domain.dto.questionsconfig.HseQuestionsConfigQueryReq;
|
||||
import org.dromara.safety.domain.dto.questionsconfig.HseQuestionsConfigUpdateReq;
|
||||
import org.dromara.safety.domain.vo.questionsconfig.HseQuestionsConfigVo;
|
||||
import org.dromara.safety.service.IHseQuestionsConfigService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题库配置
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/safety/questionsConfig")
|
||||
public class HseQuestionsConfigController extends BaseController {
|
||||
|
||||
private final IHseQuestionsConfigService questionsConfigService;
|
||||
|
||||
/**
|
||||
* 查询题库配置列表
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsConfig:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HseQuestionsConfigVo> list(HseQuestionsConfigQueryReq req, PageQuery pageQuery) {
|
||||
return questionsConfigService.queryPageList(req, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出题库配置列表
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsConfig:export")
|
||||
@Log(title = "题库配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HseQuestionsConfigQueryReq req, HttpServletResponse response) {
|
||||
List<HseQuestionsConfigVo> list = questionsConfigService.queryList(req);
|
||||
ExcelUtil.exportExcel(list, "题库配置", HseQuestionsConfigVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库配置详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsConfig:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<HseQuestionsConfigVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(questionsConfigService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增题库配置
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsConfig:add")
|
||||
@Log(title = "题库配置", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Long> add(@Validated(AddGroup.class) @RequestBody HseQuestionsConfigCreateReq req) {
|
||||
return R.ok(questionsConfigService.insertByBo(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改题库配置
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsConfig:edit")
|
||||
@Log(title = "题库配置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody HseQuestionsConfigUpdateReq req) {
|
||||
return toAjax(questionsConfigService.updateByBo(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除题库配置
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:questionsConfig:remove")
|
||||
@Log(title = "题库配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(questionsConfigService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package org.dromara.safety.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@ -79,7 +80,7 @@ public class HseViolationRecordController extends BaseController {
|
||||
/**
|
||||
* 新增违规记录处理人
|
||||
*/
|
||||
@SaCheckPermission("safety:violationRecord:handler")
|
||||
@SaCheckPermission("safety:violationRecord:edit")
|
||||
@Log(title = "违规记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/handler")
|
||||
@ -90,7 +91,7 @@ public class HseViolationRecordController extends BaseController {
|
||||
/**
|
||||
* 新增违规记录整改
|
||||
*/
|
||||
@SaCheckPermission("safety:violationRecord:rectification")
|
||||
@SaCheckPermission("safety:violationRecord:edit")
|
||||
@Log(title = "违规记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/rectification")
|
||||
@ -101,7 +102,7 @@ public class HseViolationRecordController extends BaseController {
|
||||
/**
|
||||
* 新增违规记录复查
|
||||
*/
|
||||
@SaCheckPermission("safety:violationRecord:review")
|
||||
@SaCheckPermission("safety:violationRecord:edit")
|
||||
@Log(title = "违规记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/review")
|
||||
@ -111,6 +112,7 @@ public class HseViolationRecordController extends BaseController {
|
||||
|
||||
/**
|
||||
* 删除违规记录
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:violationRecord:remove")
|
||||
@ -123,8 +125,10 @@ public class HseViolationRecordController extends BaseController {
|
||||
|
||||
/**
|
||||
* 分包单位列表
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
*/
|
||||
@SaCheckPermission(value = {"safety:violationRecord:add", "safety:violationRecord:edit"}, mode = SaMode.OR)
|
||||
@GetMapping("/contractorList")
|
||||
public R<List<SubContractor>> contractorList(Long projectId) {
|
||||
List<SubContractor> list = contractorService.lambdaQuery()
|
||||
@ -136,8 +140,10 @@ public class HseViolationRecordController extends BaseController {
|
||||
|
||||
/**
|
||||
* 分包人员列表
|
||||
*
|
||||
* @param contractorId 分包ID
|
||||
*/
|
||||
@SaCheckPermission(value = {"safety:violationRecord:add", "safety:violationRecord:edit"}, mode = SaMode.OR)
|
||||
@GetMapping("/contractorUserList")
|
||||
public R<List<SysUser>> contractorUserList(Long contractorId) {
|
||||
List<SysUser> sysUsers = userService.selectUserListByContractorId(contractorId);
|
||||
@ -146,8 +152,10 @@ public class HseViolationRecordController extends BaseController {
|
||||
|
||||
/**
|
||||
* 班组列表
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
*/
|
||||
@SaCheckPermission(value = {"safety:violationRecord:add", "safety:violationRecord:edit"}, mode = SaMode.OR)
|
||||
@GetMapping("/teamList")
|
||||
public R<List<BusProjectTeam>> teamList(Long projectId) {
|
||||
List<BusProjectTeam> list = projectTeamService.lambdaQuery()
|
||||
@ -159,8 +167,10 @@ public class HseViolationRecordController extends BaseController {
|
||||
|
||||
/**
|
||||
* 班组列表
|
||||
*
|
||||
* @param teamId 班组ID
|
||||
*/
|
||||
@SaCheckPermission(value = {"safety:violationRecord:add", "safety:violationRecord:edit"}, mode = SaMode.OR)
|
||||
@GetMapping("/teamUserList")
|
||||
public R<List<BusProjectTeamMemberVo>> teamUserList(Long teamId) {
|
||||
BusProjectTeamMemberQueryReq req = new BusProjectTeamMemberQueryReq();
|
||||
@ -173,6 +183,7 @@ public class HseViolationRecordController extends BaseController {
|
||||
/**
|
||||
* 获取版本列表
|
||||
*/
|
||||
@SaCheckPermission(value = {"safety:violationRecord:add", "safety:violationRecord:edit"}, mode = SaMode.OR)
|
||||
@GetMapping("/versionList")
|
||||
public R<List<HseViolationRecordVersionVo>> getVersionList(String jobKey, Long projectId) {
|
||||
return R.ok(hseViolationRecordService.getVersionList(jobKey, projectId));
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
package org.dromara.safety.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -16,10 +15,15 @@ import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.safety.bo.req.WgzQuestionReq;
|
||||
import org.dromara.safety.domain.WgzQuestionBank;
|
||||
import org.dromara.safety.domain.bo.WgzQuestionBankBo;
|
||||
import org.dromara.safety.domain.bo.WgzQuestionCategoryBo;
|
||||
import org.dromara.safety.domain.vo.WgzQuestionBankVo;
|
||||
import org.dromara.safety.domain.vo.WgzQuestionCategoryVo;
|
||||
import org.dromara.safety.service.IWgzQuestionBankService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.dromara.safety.service.IWgzQuestionCategoryService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
/**
|
||||
@ -36,6 +40,17 @@ public class WgzQuestionBankController extends BaseController {
|
||||
|
||||
private final IWgzQuestionBankService iWgzQuestionBankService;
|
||||
|
||||
private final IWgzQuestionCategoryService iWgzQuestionCategoryService;
|
||||
|
||||
/**
|
||||
* 查询题库_题库类别列表
|
||||
*/
|
||||
@SaCheckPermission(value = {"safety:wgzQuestionBank:add", "safety:wgzQuestionBank:edit", "safety:wgzQuestionBank:list"}, mode = SaMode.OR)
|
||||
@GetMapping("/questionCategory/list")
|
||||
public TableDataInfo<WgzQuestionCategoryVo> list(@Validated WgzQuestionCategoryBo bo, PageQuery pageQuery) {
|
||||
return iWgzQuestionCategoryService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询题库列表
|
||||
*/
|
||||
|
||||
@ -2,16 +2,20 @@ package org.dromara.safety.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.safety.domain.bo.WgzQuestionSavePdfBo;
|
||||
import org.dromara.safety.domain.vo.WgzQuestionSavePdfVo;
|
||||
import org.dromara.safety.service.IWgzQuestionSavePdfService;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 用户试卷存储Controller
|
||||
@ -27,15 +31,29 @@ public class WgzQuestionSaveController extends BaseController {
|
||||
|
||||
private final IWgzQuestionSavePdfService iwgzQuestionSavePdfService;
|
||||
|
||||
private final ISysOssService ossService;
|
||||
|
||||
/**
|
||||
* 查询用户试卷存储列表
|
||||
*/
|
||||
@SaCheckPermission("safety:wgzQuestionSave:listPdf")
|
||||
@SaCheckPermission("safety:wgzQuestionSave:list")
|
||||
@GetMapping("/listPdf")
|
||||
public TableDataInfo<WgzQuestionSavePdfVo> list(@Validated WgzQuestionSavePdfBo bo, PageQuery pageQuery) {
|
||||
return iwgzQuestionSavePdfService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传线下考试试卷存储
|
||||
*/
|
||||
@SaCheckPermission("safety:wgzQuestionSave:add")
|
||||
@Log(title = "用户试卷存储", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/upload/zip")
|
||||
public R<Boolean> batchUploadFileByZip(@RequestParam("file") MultipartFile multipartFile,
|
||||
Long projectId) {
|
||||
return R.ok(iwgzQuestionSavePdfService.batchUploadFileByZip(multipartFile, projectId));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 查询用户试卷存储列表
|
||||
// */
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
package org.dromara.safety.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
@ -17,8 +14,8 @@ import org.dromara.safety.domain.WgzQuestionsConfiguration;
|
||||
import org.dromara.safety.domain.bo.WgzQuestionsConfigurationBo;
|
||||
import org.dromara.safety.domain.vo.WgzQuestionsConfigurationVo;
|
||||
import org.dromara.safety.service.IWgzQuestionsConfigurationService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 题库配置Controller
|
||||
@ -43,8 +40,6 @@ public class WgzQuestionsConfigurationController extends BaseController {
|
||||
return iWgzQuestionsConfigurationService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取题库配置详细信息
|
||||
*/
|
||||
@ -76,15 +71,4 @@ public class WgzQuestionsConfigurationController extends BaseController {
|
||||
public R<Void> edit(@Validated @RequestBody WgzQuestionsConfiguration bo) {
|
||||
return toAjax(iWgzQuestionsConfigurationService.update(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除题库配置
|
||||
*/
|
||||
@SaCheckPermission("safety:wzgQuestionsConfiguration:remove")
|
||||
@Log(title = "题库配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iWgzQuestionsConfigurationService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package org.dromara.safety.controller.app;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
@ -93,6 +92,7 @@ public class WgzShiJuan extends BaseController {
|
||||
|
||||
/**
|
||||
* 创建题目板块
|
||||
*
|
||||
* @param topicPrefix 板块标题前缀
|
||||
* @param questions 题目列表
|
||||
* @param score 每题分数
|
||||
@ -108,5 +108,4 @@ public class WgzShiJuan extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
package org.dromara.safety.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 安全会议纪要对象 hse_document_safety_meeting
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("hse_document_safety_meeting")
|
||||
public class HseDocumentSafetyMeeting extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 父级(0代表顶级)
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 文件url
|
||||
*/
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 文件类型(1文件-2文件夹-3图片)
|
||||
*/
|
||||
private String fileType;
|
||||
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
private String fileSuffix;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1删除)
|
||||
*/
|
||||
private String fileStatus;
|
||||
|
||||
/**
|
||||
* 原文件名
|
||||
*/
|
||||
private String originalName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
private Date deletedAt;
|
||||
|
||||
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
package org.dromara.safety.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 题库对象 hse_question_bank
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("hse_question_bank")
|
||||
public class HseQuestionBank extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题目类别
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 题目类型
|
||||
*/
|
||||
private String questionType;
|
||||
|
||||
/**
|
||||
* 题目内容
|
||||
*/
|
||||
private String questionContent;
|
||||
|
||||
/**
|
||||
* 选项(以JSON数组形式存储)
|
||||
*/
|
||||
private String options;
|
||||
|
||||
/**
|
||||
* 正确答案
|
||||
*/
|
||||
private String correctAnswer;
|
||||
|
||||
/**
|
||||
* 创建人设备类型
|
||||
*/
|
||||
private String wxOrPc;
|
||||
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
package org.dromara.safety.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 题库类别对象 hse_questions_category
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
@Data
|
||||
@TableName("hse_questions_category")
|
||||
public class HseQuestionsCategory implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题库类别
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
package org.dromara.safety.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 题库配置对象 hse_questions_config
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("hse_questions_config")
|
||||
public class HseQuestionsConfig implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
private Long singleChoice;
|
||||
|
||||
/**
|
||||
* 单选分数
|
||||
*/
|
||||
private Long singleScore;
|
||||
|
||||
/**
|
||||
* 多选题(单位/道)
|
||||
*/
|
||||
private Long multipleChoice;
|
||||
|
||||
/**
|
||||
* 多选分数
|
||||
*/
|
||||
private Long multipleScore;
|
||||
|
||||
/**
|
||||
* 判断题(单位/道)
|
||||
*/
|
||||
private Long estimate;
|
||||
|
||||
/**
|
||||
* 判断分数
|
||||
*/
|
||||
private Long estimateScore;
|
||||
|
||||
/**
|
||||
* 满分
|
||||
*/
|
||||
private Long fullMark;
|
||||
|
||||
/**
|
||||
* 及格线
|
||||
*/
|
||||
private Long passScore;
|
||||
|
||||
/**
|
||||
* 答题最大时间(单位/分钟)
|
||||
*/
|
||||
private Long answerTime;
|
||||
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.documentsafetymeeting;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/4/14 10:06
|
||||
*/
|
||||
@Data
|
||||
public class HseDocumentSafetyMeetingCreateFileReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -4889729533450017719L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@NotNull(message = "项目id不能为空")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 父级(0代表顶级)
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.documentsafetymeeting;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/4/14 10:06
|
||||
*/
|
||||
@Data
|
||||
public class HseDocumentSafetyMeetingCreateFolderReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 486922166637112952L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@NotNull(message = "项目id不能为空")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 父级(0代表顶级)
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
@NotNull(message = "文件名称不能为空")
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.documentsafetymeeting;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/4/14 10:04
|
||||
*/
|
||||
@Data
|
||||
public class HseDocumentSafetyMeetingQueryReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -5290567924829663119L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 父级(0代表顶级)
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 文件类型(1文件-2文件夹-3图片)
|
||||
*/
|
||||
private String fileType;
|
||||
|
||||
/**
|
||||
* 不是文件类型(1文件-2文件夹-3图片)
|
||||
*/
|
||||
private String notFileType;
|
||||
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.questionbank;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/3/24 17:32
|
||||
*/
|
||||
@Data
|
||||
public class HseQuestionBankCreateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 9014952417764490638L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题目类别
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 题目类型
|
||||
*/
|
||||
private String questionType;
|
||||
|
||||
/**
|
||||
* 题目内容
|
||||
*/
|
||||
private String questionContent;
|
||||
|
||||
/**
|
||||
* 选项(以JSON数组形式存储)
|
||||
*/
|
||||
private List<String> optionList;
|
||||
|
||||
/**
|
||||
* 正确答案
|
||||
*/
|
||||
private String correctAnswer;
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.questionbank;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/3/24 17:33
|
||||
*/
|
||||
@Data
|
||||
public class HseQuestionBankQueryReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -8924454189341614745L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题目类别
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 题目类型
|
||||
*/
|
||||
private String questionType;
|
||||
|
||||
/**
|
||||
* 题目内容
|
||||
*/
|
||||
private String questionContent;
|
||||
|
||||
/**
|
||||
* 选项(以JSON数组形式存储)
|
||||
*/
|
||||
private List<String> optionList;
|
||||
|
||||
/**
|
||||
* 正确答案
|
||||
*/
|
||||
private String correctAnswer;
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.questionbank;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/3/24 17:33
|
||||
*/
|
||||
@Data
|
||||
public class HseQuestionBankUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 4537637385171186219L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 题目类别
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 题目类型
|
||||
*/
|
||||
private String questionType;
|
||||
|
||||
/**
|
||||
* 题目内容
|
||||
*/
|
||||
private String questionContent;
|
||||
|
||||
/**
|
||||
* 选项(以JSON数组形式存储)
|
||||
*/
|
||||
private List<String> optionList;
|
||||
|
||||
/**
|
||||
* 正确答案
|
||||
*/
|
||||
private String correctAnswer;
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.questionscategory;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/4/15 9:39
|
||||
*/
|
||||
@Data
|
||||
public class HseQuestionsCategoryCreateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -3517465472029929723L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题库类别
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.questionscategory;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/4/15 9:39
|
||||
*/
|
||||
@Data
|
||||
public class HseQuestionsCategoryQueryReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 8543449238477998979L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题库类别
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.questionscategory;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/4/15 9:39
|
||||
*/
|
||||
@Data
|
||||
public class HseQuestionsCategoryUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -6588543841396112020L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题库类别
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.questionsconfig;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/3/24 17:34
|
||||
*/
|
||||
@Data
|
||||
public class HseQuestionsConfigCreateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -6430325731025840429L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
private Long singleChoice;
|
||||
|
||||
/**
|
||||
* 单选分数
|
||||
*/
|
||||
private Long singleScore;
|
||||
|
||||
/**
|
||||
* 多选题(单位/道)
|
||||
*/
|
||||
private Long multipleChoice;
|
||||
|
||||
/**
|
||||
* 多选分数
|
||||
*/
|
||||
private Long multipleScore;
|
||||
|
||||
/**
|
||||
* 判断题(单位/道)
|
||||
*/
|
||||
private Long estimate;
|
||||
|
||||
/**
|
||||
* 判断分数
|
||||
*/
|
||||
private Long estimateScore;
|
||||
|
||||
/**
|
||||
* 满分
|
||||
*/
|
||||
private Long fullMark;
|
||||
|
||||
/**
|
||||
* 及格线
|
||||
*/
|
||||
private Long passScore;
|
||||
|
||||
/**
|
||||
* 答题最大时间(单位/分钟)
|
||||
*/
|
||||
private Long answerTime;
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.questionsconfig;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/3/24 17:34
|
||||
*/
|
||||
@Data
|
||||
public class HseQuestionsConfigQueryReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 8187034953273515023L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
private Long singleChoice;
|
||||
|
||||
/**
|
||||
* 单选分数
|
||||
*/
|
||||
private Long singleScore;
|
||||
|
||||
/**
|
||||
* 多选题(单位/道)
|
||||
*/
|
||||
private Long multipleChoice;
|
||||
|
||||
/**
|
||||
* 多选分数
|
||||
*/
|
||||
private Long multipleScore;
|
||||
|
||||
/**
|
||||
* 判断题(单位/道)
|
||||
*/
|
||||
private Long estimate;
|
||||
|
||||
/**
|
||||
* 判断分数
|
||||
*/
|
||||
private Long estimateScore;
|
||||
|
||||
/**
|
||||
* 满分
|
||||
*/
|
||||
private Long fullMark;
|
||||
|
||||
/**
|
||||
* 及格线
|
||||
*/
|
||||
private Long passScore;
|
||||
|
||||
/**
|
||||
* 答题最大时间(单位/分钟)
|
||||
*/
|
||||
private Long answerTime;
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
package org.dromara.safety.domain.dto.questionsconfig;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/3/24 17:34
|
||||
*/
|
||||
@Data
|
||||
public class HseQuestionsConfigUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 6861554491377407420L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
private Long singleChoice;
|
||||
|
||||
/**
|
||||
* 单选分数
|
||||
*/
|
||||
private Long singleScore;
|
||||
|
||||
/**
|
||||
* 多选题(单位/道)
|
||||
*/
|
||||
private Long multipleChoice;
|
||||
|
||||
/**
|
||||
* 多选分数
|
||||
*/
|
||||
private Long multipleScore;
|
||||
|
||||
/**
|
||||
* 判断题(单位/道)
|
||||
*/
|
||||
private Long estimate;
|
||||
|
||||
/**
|
||||
* 判断分数
|
||||
*/
|
||||
private Long estimateScore;
|
||||
|
||||
/**
|
||||
* 满分
|
||||
*/
|
||||
private Long fullMark;
|
||||
|
||||
/**
|
||||
* 及格线
|
||||
*/
|
||||
private Long passScore;
|
||||
|
||||
/**
|
||||
* 答题最大时间(单位/分钟)
|
||||
*/
|
||||
private Long answerTime;
|
||||
}
|
||||
@ -1,74 +0,0 @@
|
||||
package org.dromara.safety.domain.vo.documentsafetymeeting;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/4/14 17:44
|
||||
*/
|
||||
@Data
|
||||
public class HseDocumentSafetyMeetingRecycleBinVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1302984678621164410L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 父级(0代表顶级)
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 文件url
|
||||
*/
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
private String fileSuffix;
|
||||
|
||||
/**
|
||||
* 文件类型(1文件夹 2文件 3图片)
|
||||
*/
|
||||
private String fileType;
|
||||
|
||||
/**
|
||||
* 原文件名
|
||||
*/
|
||||
private String originalName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
private Date deletedAt;
|
||||
|
||||
}
|
||||
@ -1,74 +0,0 @@
|
||||
package org.dromara.safety.domain.vo.documentsafetymeeting;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.safety.domain.HseDocumentSafetyMeeting;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 安全会议纪要视图对象 hse_document_safety_meeting
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Data
|
||||
@AutoMapper(target = HseDocumentSafetyMeeting.class)
|
||||
public class HseDocumentSafetyMeetingVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 父级(0代表顶级)
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 文件url
|
||||
*/
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
private String fileSuffix;
|
||||
|
||||
/**
|
||||
* 文件类型(1文件夹 2文件 3图片)
|
||||
*/
|
||||
private String fileType;
|
||||
|
||||
/**
|
||||
* 原文件名
|
||||
*/
|
||||
private String originalName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@ -1,84 +0,0 @@
|
||||
package org.dromara.safety.domain.vo.questionbank;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.safety.domain.HseQuestionBank;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 题库视图对象 hse_question_bank
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = HseQuestionBank.class)
|
||||
public class HseQuestionBankVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@ExcelProperty(value = "项目id")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题目类别id
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 题目类别名称
|
||||
*/
|
||||
@ExcelProperty(value = "题目类别名称")
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 题目类型
|
||||
*/
|
||||
@ExcelProperty(value = "题目类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "safety_question_type")
|
||||
private String questionType;
|
||||
|
||||
/**
|
||||
* 题目内容
|
||||
*/
|
||||
@ExcelProperty(value = "题目内容")
|
||||
private String questionContent;
|
||||
|
||||
/**
|
||||
* 选项(以JSON数组形式存储)
|
||||
*/
|
||||
@ExcelProperty(value = "选项")
|
||||
private List<String> optionList;
|
||||
|
||||
/**
|
||||
* 正确答案
|
||||
*/
|
||||
@ExcelProperty(value = "正确答案")
|
||||
private String correctAnswer;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
package org.dromara.safety.domain.vo.questionscategory;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.safety.domain.HseQuestionsCategory;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 题库类别视图对象 hse_questions_category
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = HseQuestionsCategory.class)
|
||||
public class HseQuestionsCategoryVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 题库类别
|
||||
*/
|
||||
@ExcelProperty(value = "题库类别")
|
||||
private String categoryName;
|
||||
|
||||
}
|
||||
@ -1,94 +0,0 @@
|
||||
package org.dromara.safety.domain.vo.questionsconfig;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.safety.domain.HseQuestionsConfig;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 题库配置视图对象 hse_questions_config
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = HseQuestionsConfig.class)
|
||||
public class HseQuestionsConfigVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@ExcelProperty(value = "项目id")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
@ExcelProperty(value = "单选题")
|
||||
private Long singleChoice;
|
||||
|
||||
/**
|
||||
* 单选分数
|
||||
*/
|
||||
@ExcelProperty(value = "单选分数")
|
||||
private Long singleScore;
|
||||
|
||||
/**
|
||||
* 多选题(单位/道)
|
||||
*/
|
||||
@ExcelProperty(value = "多选题")
|
||||
private Long multipleChoice;
|
||||
|
||||
/**
|
||||
* 多选分数
|
||||
*/
|
||||
@ExcelProperty(value = "多选分数")
|
||||
private Long multipleScore;
|
||||
|
||||
/**
|
||||
* 判断题(单位/道)
|
||||
*/
|
||||
@ExcelProperty(value = "判断题")
|
||||
private Long estimate;
|
||||
|
||||
/**
|
||||
* 判断分数
|
||||
*/
|
||||
@ExcelProperty(value = "判断分数")
|
||||
private Long estimateScore;
|
||||
|
||||
/**
|
||||
* 满分
|
||||
*/
|
||||
@ExcelProperty(value = "满分")
|
||||
private Long fullMark;
|
||||
|
||||
/**
|
||||
* 及格线
|
||||
*/
|
||||
@ExcelProperty(value = "及格线")
|
||||
private Long passScore;
|
||||
|
||||
/**
|
||||
* 答题最大时间(单位/分钟)
|
||||
*/
|
||||
@ExcelProperty(value = "答题最大时间")
|
||||
private Long answerTime;
|
||||
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package org.dromara.safety.mapper;
|
||||
|
||||
import org.dromara.safety.domain.HseDocumentSafetyMeeting;
|
||||
import org.dromara.safety.domain.vo.documentsafetymeeting.HseDocumentSafetyMeetingVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 安全会议纪要Mapper接口
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
public interface HseDocumentSafetyMeetingMapper extends BaseMapperPlus<HseDocumentSafetyMeeting, HseDocumentSafetyMeetingVo> {
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package org.dromara.safety.mapper;
|
||||
|
||||
import org.dromara.safety.domain.HseQuestionBank;
|
||||
import org.dromara.safety.domain.vo.questionbank.HseQuestionBankVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 题库Mapper接口
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
public interface HseQuestionBankMapper extends BaseMapperPlus<HseQuestionBank, HseQuestionBankVo> {
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package org.dromara.safety.mapper;
|
||||
|
||||
import org.dromara.safety.domain.HseQuestionsCategory;
|
||||
import org.dromara.safety.domain.vo.questionscategory.HseQuestionsCategoryVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 题库类别Mapper接口
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
public interface HseQuestionsCategoryMapper extends BaseMapperPlus<HseQuestionsCategory, HseQuestionsCategoryVo> {
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package org.dromara.safety.mapper;
|
||||
|
||||
import org.dromara.safety.domain.HseQuestionsConfig;
|
||||
import org.dromara.safety.domain.vo.questionsconfig.HseQuestionsConfigVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 题库配置Mapper接口
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
public interface HseQuestionsConfigMapper extends BaseMapperPlus<HseQuestionsConfig, HseQuestionsConfigVo> {
|
||||
|
||||
}
|
||||
@ -1,125 +0,0 @@
|
||||
package org.dromara.safety.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.domain.HseDocumentSafetyMeeting;
|
||||
import org.dromara.safety.domain.dto.documentsafetymeeting.HseDocumentSafetyMeetingCreateFileReq;
|
||||
import org.dromara.safety.domain.dto.documentsafetymeeting.HseDocumentSafetyMeetingCreateFolderReq;
|
||||
import org.dromara.safety.domain.dto.documentsafetymeeting.HseDocumentSafetyMeetingQueryReq;
|
||||
import org.dromara.safety.domain.vo.documentsafetymeeting.HseDocumentSafetyMeetingRecycleBinVo;
|
||||
import org.dromara.safety.domain.vo.documentsafetymeeting.HseDocumentSafetyMeetingVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全会议纪要Service接口
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
public interface IHseDocumentSafetyMeetingService extends IService<HseDocumentSafetyMeeting> {
|
||||
|
||||
/**
|
||||
* 查询安全会议纪要
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 安全会议纪要
|
||||
*/
|
||||
HseDocumentSafetyMeetingVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询安全会议纪要列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 安全会议纪要分页列表
|
||||
*/
|
||||
List<HseDocumentSafetyMeetingVo> queryList(HseDocumentSafetyMeetingQueryReq req);
|
||||
|
||||
/**
|
||||
* 分页查询安全会议纪要回收站列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 安全会议纪要分页列表
|
||||
*/
|
||||
TableDataInfo<HseDocumentSafetyMeetingRecycleBinVo> queryRecycleBinPageList(HseDocumentSafetyMeetingQueryReq req, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 新增安全会议纪要文件夹
|
||||
*
|
||||
* @param req 文件夹创建请求
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Long insertByFolder(HseDocumentSafetyMeetingCreateFolderReq req);
|
||||
|
||||
/**
|
||||
* 新增安全会议纪要文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @param req 文件上传请求
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Long insertByFile(MultipartFile file, HseDocumentSafetyMeetingCreateFileReq req);
|
||||
|
||||
/**
|
||||
* 批量恢复安全会议纪要信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean recoveryBatchById(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 批量删除安全会议纪要信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithRecycleBin(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 彻底批量删除安全会议纪要
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean completelyDelete(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取安全会议纪要视图对象
|
||||
*
|
||||
* @param documentSafetyMeeting 安全会议纪要对象
|
||||
* @return 安全会议纪要视图对象
|
||||
*/
|
||||
HseDocumentSafetyMeetingVo getVo(HseDocumentSafetyMeeting documentSafetyMeeting);
|
||||
|
||||
/**
|
||||
* 获取安全会议纪要查询条件封装
|
||||
*
|
||||
* @param req 安全会议纪要查询条件
|
||||
* @return 安全会议纪要查询条件封装
|
||||
*/
|
||||
LambdaQueryWrapper<HseDocumentSafetyMeeting> buildQueryWrapper(HseDocumentSafetyMeetingQueryReq req);
|
||||
|
||||
/**
|
||||
* 获取安全会议纪要分页对象视图
|
||||
*
|
||||
* @param documentSafetyMeetingPage 安全会议纪要分页对象
|
||||
* @return 安全会议纪要分页对象视图
|
||||
*/
|
||||
Page<HseDocumentSafetyMeetingVo> getVoPage(Page<HseDocumentSafetyMeeting> documentSafetyMeetingPage);
|
||||
|
||||
/**
|
||||
* 递归查询所有的文件和文件夹以及文件夹下的子文件夹的id
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @return 整合所有的id集合
|
||||
*/
|
||||
List<Long> getAllChildIdList(Collection<Long> ids);
|
||||
|
||||
}
|
||||
@ -1,99 +0,0 @@
|
||||
package org.dromara.safety.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.domain.HseQuestionBank;
|
||||
import org.dromara.safety.domain.dto.questionbank.HseQuestionBankCreateReq;
|
||||
import org.dromara.safety.domain.dto.questionbank.HseQuestionBankQueryReq;
|
||||
import org.dromara.safety.domain.dto.questionbank.HseQuestionBankUpdateReq;
|
||||
import org.dromara.safety.domain.vo.questionbank.HseQuestionBankVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题库Service接口
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
public interface IHseQuestionBankService extends IService<HseQuestionBank> {
|
||||
|
||||
/**
|
||||
* 查询题库
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 题库
|
||||
*/
|
||||
HseQuestionBankVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询题库列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 题库分页列表
|
||||
*/
|
||||
TableDataInfo<HseQuestionBankVo> queryPageList(HseQuestionBankQueryReq req, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的题库列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 题库列表
|
||||
*/
|
||||
List<HseQuestionBankVo> queryList(HseQuestionBankQueryReq req);
|
||||
|
||||
/**
|
||||
* 新增题库
|
||||
*
|
||||
* @param req 题库
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Long insertByBo(HseQuestionBankCreateReq req, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 修改题库
|
||||
*
|
||||
* @param req 题库
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(HseQuestionBankUpdateReq req);
|
||||
|
||||
/**
|
||||
* 校验并批量删除题库信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 获取题库视图对象
|
||||
*
|
||||
* @param questionBank 题库对象
|
||||
* @return 题库视图对象
|
||||
*/
|
||||
HseQuestionBankVo getVo(HseQuestionBank questionBank);
|
||||
|
||||
/**
|
||||
* 获取题库查询条件封装
|
||||
*
|
||||
* @param req 题库查询条件
|
||||
* @return 题库查询条件封装
|
||||
*/
|
||||
LambdaQueryWrapper<HseQuestionBank> buildQueryWrapper(HseQuestionBankQueryReq req);
|
||||
|
||||
/**
|
||||
* 获取题库分页对象视图
|
||||
*
|
||||
* @param questionBankPage 题库分页对象
|
||||
* @return 题库分页对象视图
|
||||
*/
|
||||
Page<HseQuestionBankVo> getVoPage(Page<HseQuestionBank> questionBankPage);
|
||||
}
|
||||
@ -1,99 +0,0 @@
|
||||
package org.dromara.safety.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.domain.HseQuestionsCategory;
|
||||
import org.dromara.safety.domain.dto.questionscategory.HseQuestionsCategoryCreateReq;
|
||||
import org.dromara.safety.domain.dto.questionscategory.HseQuestionsCategoryQueryReq;
|
||||
import org.dromara.safety.domain.dto.questionscategory.HseQuestionsCategoryUpdateReq;
|
||||
import org.dromara.safety.domain.vo.questionscategory.HseQuestionsCategoryVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题库类别Service接口
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
public interface IHseQuestionsCategoryService extends IService<HseQuestionsCategory> {
|
||||
|
||||
/**
|
||||
* 查询题库类别
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 题库类别
|
||||
*/
|
||||
HseQuestionsCategoryVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询题库类别列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 题库类别分页列表
|
||||
*/
|
||||
TableDataInfo<HseQuestionsCategoryVo> queryPageList(HseQuestionsCategoryQueryReq req, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的题库类别列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 题库类别列表
|
||||
*/
|
||||
List<HseQuestionsCategoryVo> queryList(HseQuestionsCategoryQueryReq req);
|
||||
|
||||
/**
|
||||
* 新增题库类别
|
||||
*
|
||||
* @param req 题库类别
|
||||
* @return 新增题库类别组件
|
||||
*/
|
||||
Long insertByBo(HseQuestionsCategoryCreateReq req);
|
||||
|
||||
/**
|
||||
* 修改题库类别
|
||||
*
|
||||
* @param req 题库类别
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(HseQuestionsCategoryUpdateReq req);
|
||||
|
||||
/**
|
||||
* 校验并批量删除题库类别信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 获取题库类别视图对象
|
||||
*
|
||||
* @param questionsCategory 题库类别对象
|
||||
* @return 题库类别视图对象
|
||||
*/
|
||||
HseQuestionsCategoryVo getVo(HseQuestionsCategory questionsCategory);
|
||||
|
||||
/**
|
||||
* 获取题库类别查询条件封装
|
||||
*
|
||||
* @param req 题库类别查询条件
|
||||
* @return 题库类别查询条件封装
|
||||
*/
|
||||
LambdaQueryWrapper<HseQuestionsCategory> buildQueryWrapper(HseQuestionsCategoryQueryReq req);
|
||||
|
||||
/**
|
||||
* 获取题库类别分页对象视图
|
||||
*
|
||||
* @param questionsCategoryPage 题库类别分页对象
|
||||
* @return 题库类别分页对象视图
|
||||
*/
|
||||
Page<HseQuestionsCategoryVo> getVoPage(Page<HseQuestionsCategory> questionsCategoryPage);
|
||||
|
||||
}
|
||||
@ -1,98 +0,0 @@
|
||||
package org.dromara.safety.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.domain.HseQuestionsConfig;
|
||||
import org.dromara.safety.domain.dto.questionsconfig.HseQuestionsConfigCreateReq;
|
||||
import org.dromara.safety.domain.dto.questionsconfig.HseQuestionsConfigQueryReq;
|
||||
import org.dromara.safety.domain.dto.questionsconfig.HseQuestionsConfigUpdateReq;
|
||||
import org.dromara.safety.domain.vo.questionsconfig.HseQuestionsConfigVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题库配置Service接口
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
public interface IHseQuestionsConfigService extends IService<HseQuestionsConfig> {
|
||||
|
||||
/**
|
||||
* 查询题库配置
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 题库配置
|
||||
*/
|
||||
HseQuestionsConfigVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询题库配置列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 题库配置分页列表
|
||||
*/
|
||||
TableDataInfo<HseQuestionsConfigVo> queryPageList(HseQuestionsConfigQueryReq req, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的题库配置列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 题库配置列表
|
||||
*/
|
||||
List<HseQuestionsConfigVo> queryList(HseQuestionsConfigQueryReq req);
|
||||
|
||||
/**
|
||||
* 新增题库配置
|
||||
*
|
||||
* @param req 题库配置
|
||||
* @return 新增配置id
|
||||
*/
|
||||
Long insertByBo(HseQuestionsConfigCreateReq req);
|
||||
|
||||
/**
|
||||
* 修改题库配置
|
||||
*
|
||||
* @param req 题库配置
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(HseQuestionsConfigUpdateReq req);
|
||||
|
||||
/**
|
||||
* 校验并批量删除题库配置信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 获取题库配置视图对象
|
||||
*
|
||||
* @param questionsConfig 题库配置对象
|
||||
* @return 题库配置视图对象
|
||||
*/
|
||||
HseQuestionsConfigVo getVo(HseQuestionsConfig questionsConfig);
|
||||
|
||||
/**
|
||||
* 获取题库配置查询条件封装
|
||||
*
|
||||
* @param req 题库配置查询条件
|
||||
* @return 题库配置查询条件封装
|
||||
*/
|
||||
LambdaQueryWrapper<HseQuestionsConfig> buildQueryWrapper(HseQuestionsConfigQueryReq req);
|
||||
|
||||
/**
|
||||
* 获取题库配置分页对象视图
|
||||
*
|
||||
* @param questionsConfigPage 题库配置分页对象
|
||||
* @return 题库配置分页对象视图
|
||||
*/
|
||||
Page<HseQuestionsConfigVo> getVoPage(Page<HseQuestionsConfig> questionsConfigPage);
|
||||
}
|
||||
@ -7,6 +7,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.domain.WgzQuestionSavePdf;
|
||||
import org.dromara.safety.domain.bo.WgzQuestionSavePdfBo;
|
||||
import org.dromara.safety.domain.vo.WgzQuestionSavePdfVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -20,6 +21,7 @@ import java.util.List;
|
||||
public interface IWgzQuestionSavePdfService extends IService<WgzQuestionSavePdf> {
|
||||
/**
|
||||
* 查询单个
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
WgzQuestionSavePdf queryById(Long id);
|
||||
@ -36,6 +38,7 @@ public interface IWgzQuestionSavePdfService extends IService<WgzQuestionSavePdf>
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入用户试卷存储pdf
|
||||
*
|
||||
* @param bo 用户试卷存储pdf新增业务对象
|
||||
* @return
|
||||
*/
|
||||
@ -43,6 +46,7 @@ public interface IWgzQuestionSavePdfService extends IService<WgzQuestionSavePdf>
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改用户试卷存储pdf
|
||||
*
|
||||
* @param bo 用户试卷存储pdf编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
@ -50,6 +54,7 @@ public interface IWgzQuestionSavePdfService extends IService<WgzQuestionSavePdf>
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
@ -68,4 +73,13 @@ public interface IWgzQuestionSavePdfService extends IService<WgzQuestionSavePdf>
|
||||
|
||||
//根据当前用户ID删除用户试卷存储pdf
|
||||
Boolean deleteByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 批量上传文件
|
||||
*
|
||||
* @param multipartFile 文件
|
||||
* @param projectId 项目ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean batchUploadFileByZip(MultipartFile multipartFile, Long projectId);
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import org.dromara.safety.domain.WgzQuestionsConfiguration;
|
||||
import org.dromara.safety.domain.bo.WgzQuestionsConfigurationBo;
|
||||
import org.dromara.safety.domain.vo.WgzQuestionsConfigurationVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -19,6 +18,7 @@ import java.util.List;
|
||||
public interface IWgzQuestionsConfigurationService extends IService<WgzQuestionsConfiguration> {
|
||||
/**
|
||||
* 查询单个
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
WgzQuestionsConfiguration queryById(Long id);
|
||||
@ -35,6 +35,7 @@ public interface IWgzQuestionsConfigurationService extends IService<WgzQuestions
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入题库配置
|
||||
*
|
||||
* @param bo 题库配置新增业务对象
|
||||
* @return
|
||||
*/
|
||||
@ -42,19 +43,12 @@ public interface IWgzQuestionsConfigurationService extends IService<WgzQuestions
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改题库配置
|
||||
*
|
||||
* @param bo 题库配置编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean update(WgzQuestionsConfiguration bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 务工者APP相关
|
||||
* =================================================================================================================
|
||||
|
||||
@ -1,454 +0,0 @@
|
||||
package org.dromara.safety.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.safety.constant.HseDocumentSafetyMeetingConstant;
|
||||
import org.dromara.safety.domain.HseDocumentSafetyMeeting;
|
||||
import org.dromara.safety.domain.dto.documentsafetymeeting.HseDocumentSafetyMeetingCreateFileReq;
|
||||
import org.dromara.safety.domain.dto.documentsafetymeeting.HseDocumentSafetyMeetingCreateFolderReq;
|
||||
import org.dromara.safety.domain.dto.documentsafetymeeting.HseDocumentSafetyMeetingQueryReq;
|
||||
import org.dromara.common.enums.DocumentStatusEnum;
|
||||
import org.dromara.common.enums.DocumentTypeEnum;
|
||||
import org.dromara.safety.domain.vo.documentsafetymeeting.HseDocumentSafetyMeetingRecycleBinVo;
|
||||
import org.dromara.safety.domain.vo.documentsafetymeeting.HseDocumentSafetyMeetingVo;
|
||||
import org.dromara.safety.mapper.HseDocumentSafetyMeetingMapper;
|
||||
import org.dromara.safety.service.IHseDocumentSafetyMeetingService;
|
||||
import org.dromara.system.domain.vo.SysOssUploadVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 安全会议纪要Service业务层处理
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HseDocumentSafetyMeetingServiceImpl extends ServiceImpl<HseDocumentSafetyMeetingMapper, HseDocumentSafetyMeeting>
|
||||
implements IHseDocumentSafetyMeetingService {
|
||||
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
@Resource
|
||||
private ISysOssService ossService;
|
||||
|
||||
/**
|
||||
* 查询安全会议纪要
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 安全会议纪要
|
||||
*/
|
||||
@Override
|
||||
public HseDocumentSafetyMeetingVo queryById(Long id) {
|
||||
HseDocumentSafetyMeeting documentSafetyMeeting = this.getById(id);
|
||||
if (documentSafetyMeeting == null) {
|
||||
throw new ServiceException("安全会议纪要信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return this.getVo(documentSafetyMeeting);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询安全会议纪要列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 安全会议纪要分页列表
|
||||
*/
|
||||
@Override
|
||||
public List<HseDocumentSafetyMeetingVo> queryList(HseDocumentSafetyMeetingQueryReq req) {
|
||||
LambdaQueryWrapper<HseDocumentSafetyMeeting> lqw = buildQueryWrapper(req);
|
||||
// 排除已经删除的文件
|
||||
lqw.eq(HseDocumentSafetyMeeting::getFileStatus, DocumentStatusEnum.NORMAL.getValue());
|
||||
List<HseDocumentSafetyMeeting> result = this.list(lqw);
|
||||
return result.stream().map(this::getVo).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询安全会议纪要回收站列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 安全会议纪要分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<HseDocumentSafetyMeetingRecycleBinVo> queryRecycleBinPageList(HseDocumentSafetyMeetingQueryReq req, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<HseDocumentSafetyMeeting> lqw = this.buildQueryWrapper(req);
|
||||
lqw.eq(HseDocumentSafetyMeeting::getFileStatus, DocumentStatusEnum.DELETE.getValue());
|
||||
Page<HseDocumentSafetyMeeting> result = this.page(pageQuery.build(), lqw);
|
||||
List<HseDocumentSafetyMeeting> documentSafetyMeetingList = result.getRecords();
|
||||
// 添加分页信息
|
||||
Page<HseDocumentSafetyMeetingRecycleBinVo> documentSafetyMeetingVoPage = new Page<>(
|
||||
result.getCurrent(),
|
||||
result.getSize(),
|
||||
result.getTotal());
|
||||
if (CollUtil.isEmpty(documentSafetyMeetingList)) {
|
||||
return TableDataInfo.build(documentSafetyMeetingVoPage);
|
||||
}
|
||||
// 对象列表 => 封装对象列表
|
||||
List<HseDocumentSafetyMeetingRecycleBinVo> list = documentSafetyMeetingList.stream().map(documentSafetyMeeting -> {
|
||||
HseDocumentSafetyMeetingRecycleBinVo resp = new HseDocumentSafetyMeetingRecycleBinVo();
|
||||
BeanUtils.copyProperties(documentSafetyMeeting, resp);
|
||||
return resp;
|
||||
}).toList();
|
||||
documentSafetyMeetingVoPage.setRecords(list);
|
||||
return TableDataInfo.build(documentSafetyMeetingVoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增安全会议纪要文件夹
|
||||
*
|
||||
* @param req 文件夹创建请求
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Long insertByFolder(HseDocumentSafetyMeetingCreateFolderReq req) {
|
||||
if (req == null) {
|
||||
throw new ServiceException("文件夹创建请求不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (StringUtils.isEmpty(req.getFileName())) {
|
||||
throw new ServiceException("文件夹名称不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
HseDocumentSafetyMeeting documentSafetyMeeting = new HseDocumentSafetyMeeting();
|
||||
BeanUtils.copyProperties(req, documentSafetyMeeting);
|
||||
Long pid = req.getPid();
|
||||
String filePath;
|
||||
if (pid != null && pid != 0) {
|
||||
HseDocumentSafetyMeeting pDocumentSafetyMeeting = this.getById(pid);
|
||||
// 判断父级目录是否存在
|
||||
validParentFolder(pDocumentSafetyMeeting, req.getProjectId());
|
||||
filePath = pDocumentSafetyMeeting.getFilePath() + "/" + req.getFileName();
|
||||
} else {
|
||||
filePath = HseDocumentSafetyMeetingConstant.getTopFolderPrefix(req.getProjectId()) + req.getFileName();
|
||||
}
|
||||
// 填充默认值
|
||||
documentSafetyMeeting.setFilePath(filePath);
|
||||
documentSafetyMeeting.setFileType(DocumentTypeEnum.FOLDER.getValue());
|
||||
boolean save = this.save(documentSafetyMeeting);
|
||||
if (!save) {
|
||||
throw new ServiceException("新增目录失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
return documentSafetyMeeting.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增安全会议纪要文件
|
||||
*
|
||||
* @param req 文件上传请求
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Long insertByFile(MultipartFile file, HseDocumentSafetyMeetingCreateFileReq req) {
|
||||
// 数据校验
|
||||
if (ObjectUtils.isEmpty(file)) {
|
||||
throw new ServiceException("文件不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
Long projectId = req.getProjectId();
|
||||
if (projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("项目不存在", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 拼接文件名
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
String suffix = FileUtil.getSuffix(originalFilename);
|
||||
String uuid = IdUtil.fastSimpleUUID();
|
||||
String date = DateUtils.getDate();
|
||||
String fileName = String.format("%s_%s.%s", date, uuid, suffix);
|
||||
// 拼接文件路径
|
||||
Long pid = req.getPid();
|
||||
String filePath;
|
||||
if (pid != null && pid != 0) {
|
||||
HseDocumentSafetyMeeting pDocumentSafetyMeeting = this.getById(pid);
|
||||
// 判断父级目录是否存在
|
||||
validParentFolder(pDocumentSafetyMeeting, projectId);
|
||||
filePath = pDocumentSafetyMeeting.getFilePath() + "/" + fileName;
|
||||
} else {
|
||||
filePath = HseDocumentSafetyMeetingConstant.getTopFolderPrefix(projectId) + fileName;
|
||||
}
|
||||
// 上传文件
|
||||
SysOssUploadVo ossUploadVo = ossService.uploadWithNoSave(file, filePath);
|
||||
// 保存文件信息
|
||||
HseDocumentSafetyMeeting documentSafetyMeeting = new HseDocumentSafetyMeeting();
|
||||
documentSafetyMeeting.setFilePath(filePath);
|
||||
documentSafetyMeeting.setFileUrl(ossUploadVo.getOssId());
|
||||
documentSafetyMeeting.setFileSuffix(suffix);
|
||||
// 判断文件类型
|
||||
if (HseDocumentSafetyMeetingConstant.PICTURE_SUFFIX_LIST.contains(suffix)) {
|
||||
documentSafetyMeeting.setFileType(DocumentTypeEnum.PICTURE.getValue());
|
||||
} else {
|
||||
documentSafetyMeeting.setFileType(DocumentTypeEnum.FILE.getValue());
|
||||
}
|
||||
documentSafetyMeeting.setFileName(ossUploadVo.getFileName());
|
||||
documentSafetyMeeting.setOriginalName(originalFilename);
|
||||
documentSafetyMeeting.setProjectId(projectId);
|
||||
documentSafetyMeeting.setPid(pid);
|
||||
boolean save = this.save(documentSafetyMeeting);
|
||||
if (!save) {
|
||||
throw new ServiceException("新增文件失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
// 返回主键
|
||||
return documentSafetyMeeting.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量恢复安全会议纪要信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean recoveryBatchById(Collection<Long> ids) {
|
||||
List<Long> allParentIdsRecursively = getAllParentIdsRecursively(ids);
|
||||
// 需要更新状态的文件集合
|
||||
allParentIdsRecursively.addAll(ids);
|
||||
List<HseDocumentSafetyMeeting> updateList = allParentIdsRecursively.stream().map(id -> {
|
||||
HseDocumentSafetyMeeting documentSafetyMeeting = new HseDocumentSafetyMeeting();
|
||||
documentSafetyMeeting.setId(id);
|
||||
documentSafetyMeeting.setFileStatus(DocumentStatusEnum.NORMAL.getValue());
|
||||
return documentSafetyMeeting;
|
||||
}).toList();
|
||||
boolean result = this.updateBatchById(updateList);
|
||||
if (!result) {
|
||||
throw new ServiceException("恢复文件失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private List<Long> getAllParentIdsRecursively(Collection<Long> ids) {
|
||||
// 使用 list() 方法批量查询当前 id 列表对应的实体数据
|
||||
List<HseDocumentSafetyMeeting> fileList = this.lambdaQuery()
|
||||
.in(HseDocumentSafetyMeeting::getId, ids)
|
||||
.eq(HseDocumentSafetyMeeting::getFileStatus, DocumentStatusEnum.DELETE.getValue())
|
||||
.list();
|
||||
// 通过 stream 流过滤出非 0 的父 id,并去重
|
||||
List<Long> parentIdList = fileList.stream()
|
||||
.map(HseDocumentSafetyMeeting::getPid)
|
||||
.filter(pid -> pid != 0)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
// 如果父 id 列表为空,说明递归终止,返回空列表
|
||||
if (parentIdList.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 递归查询父 id 列表对应的上级父 id
|
||||
List<Long> higherParentIds = getAllParentIdsRecursively(parentIdList);
|
||||
// 将当前层的父 id 和上级递归得到的父 id 合并
|
||||
List<Long> allParentIds = new ArrayList<>();
|
||||
allParentIds.addAll(parentIdList);
|
||||
allParentIds.addAll(higherParentIds);
|
||||
// 返回合并后去重的结果
|
||||
return allParentIds.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验父级目录是否存在
|
||||
*
|
||||
* @param pDocumentSafetyMeeting 父级目录
|
||||
* @param projectId 当前项目id
|
||||
*/
|
||||
private void validParentFolder(HseDocumentSafetyMeeting pDocumentSafetyMeeting, Long projectId) {
|
||||
// 判断父级目录是否存在
|
||||
if (pDocumentSafetyMeeting == null) {
|
||||
throw new ServiceException("父级目录不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 判断父级目录是否是文件夹
|
||||
if (DocumentTypeEnum.FILE.getValue().equals(pDocumentSafetyMeeting.getFileType())) {
|
||||
throw new ServiceException("父级目录不是文件夹", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 判断是否为同一个项目
|
||||
if (!pDocumentSafetyMeeting.getProjectId().equals(projectId)) {
|
||||
throw new ServiceException("父级目录不属于当前项目", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除安全会议纪要信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithRecycleBin(Collection<Long> ids) {
|
||||
// 获取所有需要删除的元素
|
||||
List<Long> allChildIdList = this.getAllChildIdList(ids);
|
||||
if (CollUtil.isEmpty(allChildIdList)) {
|
||||
return true;
|
||||
}
|
||||
// 批量修改状态为已删除
|
||||
List<HseDocumentSafetyMeeting> documentSafetyMeetingList = allChildIdList.stream().map(id -> {
|
||||
HseDocumentSafetyMeeting documentSafetyMeeting = new HseDocumentSafetyMeeting();
|
||||
documentSafetyMeeting.setId(id);
|
||||
documentSafetyMeeting.setDeletedAt(new Date());
|
||||
documentSafetyMeeting.setFileStatus(DocumentStatusEnum.DELETE.getValue());
|
||||
return documentSafetyMeeting;
|
||||
}).toList();
|
||||
// 批量修改
|
||||
boolean result = this.updateBatchById(documentSafetyMeetingList);
|
||||
if (!result) {
|
||||
throw new ServiceException("数据库操作失败", HttpStatus.ERROR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 彻底批量删除安全会议纪要
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean completelyDelete(Collection<Long> ids) {
|
||||
// 获取所有需要删除的元素
|
||||
List<Long> allChildIdList = this.getAllChildIdList(ids);
|
||||
if (CollUtil.isEmpty(allChildIdList)) {
|
||||
return true;
|
||||
}
|
||||
boolean result = this.removeBatchByIds(allChildIdList);
|
||||
if (!result) {
|
||||
throw new ServiceException("数据库操作失败", HttpStatus.ERROR);
|
||||
}
|
||||
// todo 删除oss文件
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取安全会议纪要视图对象
|
||||
*
|
||||
* @param documentSafetyMeeting 安全会议纪要对象
|
||||
* @return 安全会议纪要视图对象
|
||||
*/
|
||||
@Override
|
||||
public HseDocumentSafetyMeetingVo getVo(HseDocumentSafetyMeeting documentSafetyMeeting) {
|
||||
// 对象转封装类
|
||||
HseDocumentSafetyMeetingVo documentSafetyMeetingVo = new HseDocumentSafetyMeetingVo();
|
||||
if (documentSafetyMeeting == null) {
|
||||
return documentSafetyMeetingVo;
|
||||
}
|
||||
BeanUtils.copyProperties(documentSafetyMeeting, documentSafetyMeetingVo);
|
||||
return documentSafetyMeetingVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取安全会议纪要查询条件封装
|
||||
*
|
||||
* @param req 安全会议纪要查询条件
|
||||
* @return 安全会议纪要查询条件封装
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryWrapper<HseDocumentSafetyMeeting> buildQueryWrapper(HseDocumentSafetyMeetingQueryReq req) {
|
||||
LambdaQueryWrapper<HseDocumentSafetyMeeting> lqw = new LambdaQueryWrapper<>();
|
||||
if (req == null) {
|
||||
return lqw;
|
||||
}
|
||||
Long projectId = req.getProjectId();
|
||||
Long pid = req.getPid();
|
||||
String fileType = req.getFileType();
|
||||
String notFileType = req.getNotFileType();
|
||||
// 精确查询
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), HseDocumentSafetyMeeting::getProjectId, projectId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(pid), HseDocumentSafetyMeeting::getPid, pid);
|
||||
lqw.eq(StringUtils.isNotBlank(fileType), HseDocumentSafetyMeeting::getFileType, fileType);
|
||||
// 不等于
|
||||
lqw.ne(StringUtils.isNotBlank(notFileType), HseDocumentSafetyMeeting::getFileType, notFileType);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取安全会议纪要分页对象视图
|
||||
*
|
||||
* @param documentSafetyMeetingPage 安全会议纪要分页对象
|
||||
* @return 安全会议纪要分页对象视图
|
||||
*/
|
||||
@Override
|
||||
public Page<HseDocumentSafetyMeetingVo> getVoPage(Page<HseDocumentSafetyMeeting> documentSafetyMeetingPage) {
|
||||
// 获取安全会议纪要列表
|
||||
List<HseDocumentSafetyMeeting> documentSafetyMeetingList = documentSafetyMeetingPage.getRecords();
|
||||
// 添加分页信息
|
||||
Page<HseDocumentSafetyMeetingVo> documentSafetyMeetingVoPage = new Page<>(
|
||||
documentSafetyMeetingPage.getCurrent(),
|
||||
documentSafetyMeetingPage.getSize(),
|
||||
documentSafetyMeetingPage.getTotal());
|
||||
if (CollUtil.isEmpty(documentSafetyMeetingList)) {
|
||||
return documentSafetyMeetingVoPage;
|
||||
}
|
||||
// 对象列表 => 封装对象列表
|
||||
List<HseDocumentSafetyMeetingVo> documentSafetyMeetingVoList = documentSafetyMeetingList
|
||||
.stream().map(this::getVo).toList();
|
||||
documentSafetyMeetingVoPage.setRecords(documentSafetyMeetingVoList);
|
||||
return documentSafetyMeetingVoPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询所有的文件和文件夹以及文件夹下的子文件夹的id
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @return 整合所有的id集合
|
||||
*/
|
||||
@Override
|
||||
public List<Long> getAllChildIdList(Collection<Long> ids) {
|
||||
List<Long> idList = new ArrayList<>();
|
||||
for (Long id : ids) {
|
||||
// 将当前id加入集合
|
||||
idList.add(id);
|
||||
// 查询当前记录(判断是否为文件夹)
|
||||
HseDocumentSafetyMeeting record = this.getById(id);
|
||||
if (record != null && DocumentTypeEnum.FOLDER.getValue().equals(record.getFileType())) {
|
||||
// 如果是文件夹,递归查询子节点
|
||||
getChildIds(id, idList);
|
||||
}
|
||||
}
|
||||
return idList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询给定父级id下所有子文件和子文件夹的id
|
||||
*
|
||||
* @param parentId 父级文件夹id
|
||||
* @param ids 存放id的集合(递归过程中不断添加)
|
||||
*/
|
||||
private void getChildIds(Long parentId, List<Long> ids) {
|
||||
// 条件查询,查询pid为parentId的记录
|
||||
List<HseDocumentSafetyMeeting> childList = this.lambdaQuery()
|
||||
.eq(HseDocumentSafetyMeeting::getPid, parentId)
|
||||
.eq(HseDocumentSafetyMeeting::getFileStatus, DocumentStatusEnum.NORMAL.getValue())
|
||||
.list();
|
||||
// 遍历所有子记录
|
||||
for (HseDocumentSafetyMeeting child : childList) {
|
||||
ids.add(child.getId());
|
||||
// 如果子节点是文件夹,继续递归
|
||||
if (DocumentTypeEnum.FOLDER.getValue().equals(child.getFileType())) {
|
||||
getChildIds(child.getId(), ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,290 +0,0 @@
|
||||
package org.dromara.safety.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.dromara.common.core.constant.CacheConstants;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.domain.dto.UserOnlineDTO;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.safety.domain.HseQuestionBank;
|
||||
import org.dromara.safety.domain.HseQuestionsCategory;
|
||||
import org.dromara.safety.domain.dto.questionbank.HseQuestionBankCreateReq;
|
||||
import org.dromara.safety.domain.dto.questionbank.HseQuestionBankQueryReq;
|
||||
import org.dromara.safety.domain.dto.questionbank.HseQuestionBankUpdateReq;
|
||||
import org.dromara.safety.domain.vo.questionbank.HseQuestionBankVo;
|
||||
import org.dromara.safety.mapper.HseQuestionBankMapper;
|
||||
import org.dromara.safety.service.IHseQuestionBankService;
|
||||
import org.dromara.safety.service.IHseQuestionsCategoryService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 题库Service业务层处理
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Service
|
||||
public class HseQuestionBankServiceImpl extends ServiceImpl<HseQuestionBankMapper, HseQuestionBank>
|
||||
implements IHseQuestionBankService {
|
||||
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
@Resource
|
||||
private IHseQuestionsCategoryService questionsCategoryService;
|
||||
|
||||
/**
|
||||
* 查询题库
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 题库
|
||||
*/
|
||||
@Override
|
||||
public HseQuestionBankVo queryById(Long id) {
|
||||
HseQuestionBank questionBank = this.getById(id);
|
||||
if (questionBank == null) {
|
||||
throw new ServiceException("题库信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return this.getVo(questionBank);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询题库列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 题库分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<HseQuestionBankVo> queryPageList(HseQuestionBankQueryReq req, PageQuery pageQuery) {
|
||||
Page<HseQuestionBank> result = this.page(pageQuery.build(), buildQueryWrapper(req));
|
||||
return TableDataInfo.build(this.getVoPage(result));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的题库列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 题库列表
|
||||
*/
|
||||
@Override
|
||||
public List<HseQuestionBankVo> queryList(HseQuestionBankQueryReq req) {
|
||||
LambdaQueryWrapper<HseQuestionBank> lqw = buildQueryWrapper(req);
|
||||
return this.list(lqw).stream().map(this::getVo).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增题库
|
||||
*
|
||||
* @param req 题库
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Long insertByBo(HseQuestionBankCreateReq req, HttpServletRequest request) {
|
||||
// 将实体类和 DTO 进行转换
|
||||
HseQuestionBank questionBank = new HseQuestionBank();
|
||||
BeanUtils.copyProperties(req, questionBank);
|
||||
// 获取当前登录设备
|
||||
String token = request.getHeader("authorization");
|
||||
UserOnlineDTO userOnlineDTO = RedisUtils.getCacheObject(CacheConstants.ONLINE_TOKEN_KEY + token);
|
||||
questionBank.setWxOrPc(userOnlineDTO.getDeviceType());
|
||||
// 数据校验
|
||||
validEntityBeforeSave(questionBank, true);
|
||||
// 写入数据库
|
||||
boolean save = this.save(questionBank);
|
||||
if (!save) {
|
||||
throw new ServiceException("新增题库失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
// 返回新写入的数据
|
||||
return questionBank.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改题库
|
||||
*
|
||||
* @param req 题库
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(HseQuestionBankUpdateReq req) {
|
||||
// 将实体类和 DTO 进行转换
|
||||
HseQuestionBank questionBank = new HseQuestionBank();
|
||||
BeanUtils.copyProperties(req, questionBank);
|
||||
// 数据校验
|
||||
validEntityBeforeSave(questionBank, false);
|
||||
// 判断是否存在
|
||||
HseQuestionBank oldQuestionBank = this.getById(questionBank.getId());
|
||||
if (oldQuestionBank == null) {
|
||||
throw new ServiceException("修改题库失败,数据不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 操作数据库
|
||||
return this.updateById(questionBank);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HseQuestionBank entity, Boolean create) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
Long categoryId = entity.getCategoryId();
|
||||
String questionType = entity.getQuestionType();
|
||||
String questionContent = entity.getQuestionContent();
|
||||
Long projectId = entity.getProjectId();
|
||||
if (create) {
|
||||
if (categoryId == null) {
|
||||
throw new ServiceException("分类类型不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (StringUtils.isEmpty(questionType)) {
|
||||
throw new ServiceException("题目类型不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (StringUtils.isEmpty(questionContent)) {
|
||||
throw new ServiceException("题目内容不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (projectId == null) {
|
||||
throw new ServiceException("项目id不能为空", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
if (projectId != null && projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
if (categoryId != null && questionsCategoryService.getById(categoryId) == null) {
|
||||
throw new ServiceException("对应题目分类类型不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除题库信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
}
|
||||
return this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库视图对象
|
||||
*
|
||||
* @param questionBank 题库对象
|
||||
* @return 题库视图对象
|
||||
*/
|
||||
@Override
|
||||
public HseQuestionBankVo getVo(HseQuestionBank questionBank) {
|
||||
// 对象转封装类
|
||||
HseQuestionBankVo questionBankVo = new HseQuestionBankVo();
|
||||
if (questionBank == null) {
|
||||
return questionBankVo;
|
||||
}
|
||||
BeanUtils.copyProperties(questionBank, questionBankVo);
|
||||
// 获取题目分类名称
|
||||
Long categoryId = questionBank.getCategoryId();
|
||||
HseQuestionsCategory category = questionsCategoryService.getById(categoryId);
|
||||
if (category != null) {
|
||||
questionBankVo.setCategoryName(category.getCategoryName());
|
||||
}
|
||||
return questionBankVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库查询条件封装
|
||||
*
|
||||
* @param req 题库查询条件
|
||||
* @return 题库查询条件封装
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryWrapper<HseQuestionBank> buildQueryWrapper(HseQuestionBankQueryReq req) {
|
||||
LambdaQueryWrapper<HseQuestionBank> lqw = new LambdaQueryWrapper<>();
|
||||
if (req == null) {
|
||||
return lqw;
|
||||
}
|
||||
Long id = req.getId();
|
||||
Long projectId = req.getProjectId();
|
||||
Long categoryId = req.getCategoryId();
|
||||
String questionType = req.getQuestionType();
|
||||
String questionContent = req.getQuestionContent();
|
||||
List<String> optionList = req.getOptionList();
|
||||
String correctAnswer = req.getCorrectAnswer();
|
||||
// JSON 数组查询
|
||||
if (CollUtil.isNotEmpty(optionList)) {
|
||||
for (String option : optionList) {
|
||||
lqw.like(HseQuestionBank::getOptions, "\"" + option + "\"");
|
||||
}
|
||||
}
|
||||
// 模糊查询
|
||||
lqw.like(StringUtils.isNotBlank(questionContent), HseQuestionBank::getQuestionContent, questionContent);
|
||||
lqw.like(StringUtils.isNotBlank(correctAnswer), HseQuestionBank::getCorrectAnswer, correctAnswer);
|
||||
// 精准查询
|
||||
lqw.eq(ObjectUtils.isNotEmpty(id), HseQuestionBank::getId, id);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), HseQuestionBank::getProjectId, projectId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(categoryId), HseQuestionBank::getCategoryId, categoryId);
|
||||
lqw.eq(StringUtils.isNotBlank(questionType), HseQuestionBank::getQuestionType, questionType);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库分页对象视图
|
||||
*
|
||||
* @param questionBankPage 题库分页对象
|
||||
* @return 题库分页对象视图
|
||||
*/
|
||||
@Override
|
||||
public Page<HseQuestionBankVo> getVoPage(Page<HseQuestionBank> questionBankPage) {
|
||||
// 获取分页数据
|
||||
List<HseQuestionBank> questionBankList = questionBankPage.getRecords();
|
||||
// 添加分页信息
|
||||
Page<HseQuestionBankVo> questionBankVoPage = new Page<>(
|
||||
questionBankPage.getCurrent(),
|
||||
questionBankPage.getSize(),
|
||||
questionBankPage.getTotal()
|
||||
);
|
||||
if (CollUtil.isEmpty(questionBankList)) {
|
||||
return questionBankVoPage;
|
||||
}
|
||||
// 关联查询题目分类信息
|
||||
Set<Long> categoryIdList = questionBankList.stream().map(HseQuestionBank::getCategoryId)
|
||||
.collect(Collectors.toSet());
|
||||
Map<Long, List<HseQuestionsCategory>> questionCategoryMap = questionsCategoryService.listByIds(categoryIdList)
|
||||
.stream().collect(Collectors.groupingBy(HseQuestionsCategory::getId));
|
||||
// 对象列表 => 封装对象列表
|
||||
List<HseQuestionBankVo> questionBankVoList = questionBankList.stream().map(questionBank -> {
|
||||
HseQuestionBankVo questionBankVo = new HseQuestionBankVo();
|
||||
BeanUtils.copyProperties(questionBank, questionBankVo);
|
||||
// 获取题目分类名称
|
||||
Long categoryId = questionBank.getCategoryId();
|
||||
String categoryName = null;
|
||||
if (questionCategoryMap.containsKey(categoryId)) {
|
||||
HseQuestionsCategory category = questionCategoryMap.get(categoryId).get(0);
|
||||
categoryName = category.getCategoryName();
|
||||
}
|
||||
questionBankVo.setCategoryName(categoryName);
|
||||
// 返回封装对象
|
||||
return questionBankVo;
|
||||
}).toList();
|
||||
questionBankVoPage.setRecords(questionBankVoList);
|
||||
return questionBankVoPage;
|
||||
}
|
||||
}
|
||||
@ -1,219 +0,0 @@
|
||||
package org.dromara.safety.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.safety.domain.HseQuestionsCategory;
|
||||
import org.dromara.safety.domain.dto.questionscategory.HseQuestionsCategoryCreateReq;
|
||||
import org.dromara.safety.domain.dto.questionscategory.HseQuestionsCategoryQueryReq;
|
||||
import org.dromara.safety.domain.dto.questionscategory.HseQuestionsCategoryUpdateReq;
|
||||
import org.dromara.safety.domain.vo.questionscategory.HseQuestionsCategoryVo;
|
||||
import org.dromara.safety.mapper.HseQuestionsCategoryMapper;
|
||||
import org.dromara.safety.service.IHseQuestionsCategoryService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题库类别Service业务层处理
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
@Service
|
||||
public class HseQuestionsCategoryServiceImpl extends ServiceImpl<HseQuestionsCategoryMapper, HseQuestionsCategory>
|
||||
implements IHseQuestionsCategoryService {
|
||||
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
/**
|
||||
* 查询题库类别
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 题库类别
|
||||
*/
|
||||
@Override
|
||||
public HseQuestionsCategoryVo queryById(Long id) {
|
||||
HseQuestionsCategory questionsCategory = this.getById(id);
|
||||
if (questionsCategory == null) {
|
||||
throw new ServiceException("题库类别信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return this.getVo(questionsCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询题库类别列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 题库类别分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<HseQuestionsCategoryVo> queryPageList(HseQuestionsCategoryQueryReq req, PageQuery pageQuery) {
|
||||
Page<HseQuestionsCategory> result = this.page(pageQuery.build(), buildQueryWrapper(req));
|
||||
return TableDataInfo.build(this.getVoPage(result));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的题库类别列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 题库类别列表
|
||||
*/
|
||||
@Override
|
||||
public List<HseQuestionsCategoryVo> queryList(HseQuestionsCategoryQueryReq req) {
|
||||
LambdaQueryWrapper<HseQuestionsCategory> lqw = this.buildQueryWrapper(req);
|
||||
return this.list(lqw).stream().map(this::getVo).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增题库类别
|
||||
*
|
||||
* @param req 题库类别
|
||||
* @return 新增题库类别主键
|
||||
*/
|
||||
@Override
|
||||
public Long insertByBo(HseQuestionsCategoryCreateReq req) {
|
||||
// 将实体类和 DTO 进行转换
|
||||
HseQuestionsCategory questionsCategory = new HseQuestionsCategory();
|
||||
BeanUtils.copyProperties(req, questionsCategory);
|
||||
// 数据校验
|
||||
validEntityBeforeSave(questionsCategory, true);
|
||||
// 写入数据库
|
||||
boolean save = this.save(questionsCategory);
|
||||
if (!save) {
|
||||
throw new ServiceException("新增题库类别失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
// 返回新写入的数据
|
||||
return questionsCategory.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改题库类别
|
||||
*
|
||||
* @param req 题库类别
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(HseQuestionsCategoryUpdateReq req) {
|
||||
// 将实体类和 DTO 进行转换
|
||||
HseQuestionsCategory questionsCategory = new HseQuestionsCategory();
|
||||
BeanUtils.copyProperties(req, questionsCategory);
|
||||
// 数据校验
|
||||
validEntityBeforeSave(questionsCategory, false);
|
||||
// 判断是否存在
|
||||
HseQuestionsCategory oldQuestionsCategory = this.getById(questionsCategory.getId());
|
||||
if (oldQuestionsCategory == null) {
|
||||
throw new ServiceException("修改题库类别失败,数据不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 操作数据库
|
||||
return this.updateById(questionsCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HseQuestionsCategory entity, Boolean create) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
Long projectId = entity.getProjectId();
|
||||
if (create) {
|
||||
if (projectId == null) {
|
||||
throw new ServiceException("项目id不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
if (projectId != null && projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除题库类别信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
}
|
||||
return this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库类别视图对象
|
||||
*
|
||||
* @param questionsCategory 题库类别对象
|
||||
* @return 题库类别视图对象
|
||||
*/
|
||||
@Override
|
||||
public HseQuestionsCategoryVo getVo(HseQuestionsCategory questionsCategory) {
|
||||
// 对象转封装类
|
||||
HseQuestionsCategoryVo questionsCategoryVo = new HseQuestionsCategoryVo();
|
||||
if (questionsCategory == null) {
|
||||
return questionsCategoryVo;
|
||||
}
|
||||
BeanUtils.copyProperties(questionsCategory, questionsCategoryVo);
|
||||
return questionsCategoryVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库类别查询条件封装
|
||||
*
|
||||
* @param req 题库类别查询条件
|
||||
* @return 题库类别查询条件封装
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryWrapper<HseQuestionsCategory> buildQueryWrapper(HseQuestionsCategoryQueryReq req) {
|
||||
LambdaQueryWrapper<HseQuestionsCategory> lqw = new LambdaQueryWrapper<>();
|
||||
if (req == null) {
|
||||
return lqw;
|
||||
}
|
||||
Long projectId = req.getProjectId();
|
||||
String categoryName = req.getCategoryName();
|
||||
// 模糊查询
|
||||
lqw.like(StringUtils.isNotBlank(categoryName), HseQuestionsCategory::getCategoryName, categoryName);
|
||||
// 精确查询
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), HseQuestionsCategory::getProjectId, projectId);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库类别分页对象视图
|
||||
*
|
||||
* @param questionsCategoryPage 题库类别分页对象
|
||||
* @return 题库类别分页对象视图
|
||||
*/
|
||||
@Override
|
||||
public Page<HseQuestionsCategoryVo> getVoPage(Page<HseQuestionsCategory> questionsCategoryPage) {
|
||||
// 获取分页数据
|
||||
List<HseQuestionsCategory> questionsCategoryList = questionsCategoryPage.getRecords();
|
||||
// 添加分页信息
|
||||
Page<HseQuestionsCategoryVo> questionsCategoryVoPage = new Page<>(
|
||||
questionsCategoryPage.getCurrent(),
|
||||
questionsCategoryPage.getSize(),
|
||||
questionsCategoryPage.getTotal()
|
||||
);
|
||||
if (CollUtil.isEmpty(questionsCategoryList)) {
|
||||
return questionsCategoryVoPage;
|
||||
}
|
||||
// 对象列表 => 封装对象列表
|
||||
List<HseQuestionsCategoryVo> questionsCategoryVoList = questionsCategoryList.stream().map(this::getVo).toList();
|
||||
questionsCategoryVoPage.setRecords(questionsCategoryVoList);
|
||||
return questionsCategoryVoPage;
|
||||
}
|
||||
}
|
||||
@ -1,235 +0,0 @@
|
||||
package org.dromara.safety.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.safety.domain.HseQuestionsConfig;
|
||||
import org.dromara.safety.domain.dto.questionsconfig.HseQuestionsConfigCreateReq;
|
||||
import org.dromara.safety.domain.dto.questionsconfig.HseQuestionsConfigQueryReq;
|
||||
import org.dromara.safety.domain.dto.questionsconfig.HseQuestionsConfigUpdateReq;
|
||||
import org.dromara.safety.domain.vo.questionsconfig.HseQuestionsConfigVo;
|
||||
import org.dromara.safety.mapper.HseQuestionsConfigMapper;
|
||||
import org.dromara.safety.service.IHseQuestionsConfigService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题库配置Service业务层处理
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Service
|
||||
public class HseQuestionsConfigServiceImpl extends ServiceImpl<HseQuestionsConfigMapper, HseQuestionsConfig>
|
||||
implements IHseQuestionsConfigService {
|
||||
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
/**
|
||||
* 查询题库配置
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 题库配置
|
||||
*/
|
||||
@Override
|
||||
public HseQuestionsConfigVo queryById(Long id) {
|
||||
HseQuestionsConfig questionsConfig = this.getById(id);
|
||||
if (questionsConfig == null) {
|
||||
throw new ServiceException("题库配置信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return this.getVo(questionsConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询题库配置列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 题库配置分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<HseQuestionsConfigVo> queryPageList(HseQuestionsConfigQueryReq req, PageQuery pageQuery) {
|
||||
Page<HseQuestionsConfig> result = this.page(pageQuery.build(), buildQueryWrapper(req));
|
||||
return TableDataInfo.build(this.getVoPage(result));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的题库配置列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 题库配置列表
|
||||
*/
|
||||
@Override
|
||||
public List<HseQuestionsConfigVo> queryList(HseQuestionsConfigQueryReq req) {
|
||||
LambdaQueryWrapper<HseQuestionsConfig> lqw = buildQueryWrapper(req);
|
||||
return this.list(lqw).stream().map(this::getVo).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增题库配置
|
||||
*
|
||||
* @param req 题库配置
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Long insertByBo(HseQuestionsConfigCreateReq req) {
|
||||
// 将实体类和 DTO 进行转换
|
||||
HseQuestionsConfig questionsConfig = new HseQuestionsConfig();
|
||||
BeanUtils.copyProperties(req, questionsConfig);
|
||||
// 数据校验
|
||||
validEntityBeforeSave(questionsConfig, true);
|
||||
// 写入数据库
|
||||
boolean save = this.save(questionsConfig);
|
||||
if (!save) {
|
||||
throw new ServiceException("新增题库配置失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
// 返回新写入的数据
|
||||
return questionsConfig.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改题库配置
|
||||
*
|
||||
* @param req 题库配置
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(HseQuestionsConfigUpdateReq req) {
|
||||
// 将实体类和 DTO 进行转换
|
||||
HseQuestionsConfig questionsConfig = new HseQuestionsConfig();
|
||||
BeanUtils.copyProperties(req, questionsConfig);
|
||||
// 数据校验
|
||||
validEntityBeforeSave(questionsConfig, false);
|
||||
// 判断是否存在
|
||||
HseQuestionsConfig oldQuestionsConfig = this.getById(questionsConfig.getId());
|
||||
if (oldQuestionsConfig == null) {
|
||||
throw new ServiceException("修改题库配置失败,数据不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 操作数据库
|
||||
return this.updateById(questionsConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HseQuestionsConfig entity, Boolean create) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
Long projectId = entity.getProjectId();
|
||||
if (create) {
|
||||
if (projectId == null) {
|
||||
throw new ServiceException("项目id不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
if (projectId != null && projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除题库配置信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
}
|
||||
return this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库配置视图对象
|
||||
*
|
||||
* @param questionsConfig 题库配置对象
|
||||
* @return 题库配置视图对象
|
||||
*/
|
||||
@Override
|
||||
public HseQuestionsConfigVo getVo(HseQuestionsConfig questionsConfig) {
|
||||
// 对象转封装类
|
||||
HseQuestionsConfigVo questionsConfigVo = new HseQuestionsConfigVo();
|
||||
if (questionsConfig == null) {
|
||||
return questionsConfigVo;
|
||||
}
|
||||
BeanUtils.copyProperties(questionsConfig, questionsConfigVo);
|
||||
return questionsConfigVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库配置查询条件封装
|
||||
*
|
||||
* @param req 题库配置查询条件
|
||||
* @return 题库配置查询条件封装
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryWrapper<HseQuestionsConfig> buildQueryWrapper(HseQuestionsConfigQueryReq req) {
|
||||
LambdaQueryWrapper<HseQuestionsConfig> lqw = new LambdaQueryWrapper<>();
|
||||
if (req == null) {
|
||||
return lqw;
|
||||
}
|
||||
Long id = req.getId();
|
||||
Long projectId = req.getProjectId();
|
||||
Long singleChoice = req.getSingleChoice();
|
||||
Long singleScore = req.getSingleScore();
|
||||
Long multipleChoice = req.getMultipleChoice();
|
||||
Long multipleScore = req.getMultipleScore();
|
||||
Long estimate = req.getEstimate();
|
||||
Long estimateScore = req.getEstimateScore();
|
||||
Long fullMark = req.getFullMark();
|
||||
Long passScore = req.getPassScore();
|
||||
Long answerTime = req.getAnswerTime();
|
||||
// 精准查询
|
||||
lqw.eq(ObjectUtils.isNotEmpty(id), HseQuestionsConfig::getId, id);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), HseQuestionsConfig::getProjectId, projectId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(singleChoice), HseQuestionsConfig::getSingleChoice, singleChoice);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(singleScore), HseQuestionsConfig::getSingleScore, singleScore);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(multipleChoice), HseQuestionsConfig::getMultipleChoice, multipleChoice);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(multipleScore), HseQuestionsConfig::getMultipleScore, multipleScore);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(estimate), HseQuestionsConfig::getEstimate, estimate);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(estimateScore), HseQuestionsConfig::getEstimateScore, estimateScore);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(fullMark), HseQuestionsConfig::getFullMark, fullMark);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(passScore), HseQuestionsConfig::getPassScore, passScore);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(answerTime), HseQuestionsConfig::getAnswerTime, answerTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库配置分页对象视图
|
||||
*
|
||||
* @param questionsConfigPage 题库配置分页对象
|
||||
* @return 题库配置分页对象视图
|
||||
*/
|
||||
@Override
|
||||
public Page<HseQuestionsConfigVo> getVoPage(Page<HseQuestionsConfig> questionsConfigPage) {
|
||||
// 获取分页数据
|
||||
List<HseQuestionsConfig> questionsConfigList = questionsConfigPage.getRecords();
|
||||
// 添加分页信息
|
||||
Page<HseQuestionsConfigVo> questionsConfigVoPage = new Page<>(
|
||||
questionsConfigPage.getCurrent(),
|
||||
questionsConfigPage.getSize(),
|
||||
questionsConfigPage.getTotal()
|
||||
);
|
||||
if (CollUtil.isEmpty(questionsConfigList)) {
|
||||
return questionsConfigVoPage;
|
||||
}
|
||||
// 对象列表 => 封装对象列表
|
||||
List<HseQuestionsConfigVo> questionsConfigVoList = questionsConfigList.stream().map(this::getVo).toList();
|
||||
questionsConfigVoPage.setRecords(questionsConfigVoList);
|
||||
return questionsConfigVoPage;
|
||||
}
|
||||
}
|
||||
@ -2,30 +2,49 @@ package org.dromara.safety.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.common.core.utils.file.FileUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.utils.IdCardEncryptorUtil;
|
||||
import org.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.project.domain.BusProjectTeamMember;
|
||||
import org.dromara.project.service.IBusProjectTeamMemberService;
|
||||
import org.dromara.safety.domain.WgzQuestionSavePdf;
|
||||
import org.dromara.safety.domain.bo.WgzQuestionSavePdfBo;
|
||||
import org.dromara.safety.domain.dto.questionuseranswer.HseQuestionUserAnswerUploadTemp;
|
||||
import org.dromara.safety.domain.enums.HseSafetyExamTypeEnum;
|
||||
import org.dromara.safety.domain.vo.WgzQuestionSavePdfVo;
|
||||
import org.dromara.safety.mapper.WgzQuestionSavePdfMapper;
|
||||
import org.dromara.safety.service.IWgzQuestionSavePdfService;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户试卷存储pdfService业务层处理
|
||||
@ -33,15 +52,26 @@ import java.util.Map;
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WgzQuestionSavePdfServiceImpl extends ServiceImpl<WgzQuestionSavePdfMapper, WgzQuestionSavePdf> implements IWgzQuestionSavePdfService {
|
||||
public class WgzQuestionSavePdfServiceImpl extends ServiceImpl<WgzQuestionSavePdfMapper, WgzQuestionSavePdf>
|
||||
implements IWgzQuestionSavePdfService {
|
||||
|
||||
@Resource
|
||||
private ISysUserService userService;
|
||||
private ISysOssService ossService;
|
||||
|
||||
@Resource
|
||||
private ISubConstructionUserService constructionUserService;
|
||||
|
||||
@Resource
|
||||
private IBusProjectTeamMemberService projectTeamMemberService;
|
||||
|
||||
@Resource
|
||||
private IdCardEncryptorUtil idCardEncryptorUtil;
|
||||
|
||||
@Resource
|
||||
private ISysUserService userService;
|
||||
|
||||
@Override
|
||||
public WgzQuestionSavePdf queryById(Long id) {
|
||||
return getById(id);
|
||||
@ -161,4 +191,186 @@ public class WgzQuestionSavePdfServiceImpl extends ServiceImpl<WgzQuestionSavePd
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量上传文件
|
||||
*
|
||||
* @param multipartFile 文件
|
||||
* @param projectId 项目ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchUploadFileByZip(MultipartFile multipartFile, Long projectId) {
|
||||
// 1. 校验
|
||||
String originalFilename = multipartFile.getOriginalFilename();
|
||||
if (originalFilename == null) {
|
||||
throw new ServiceException("文件名不存在", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 校验是否为压缩包zip格式
|
||||
String suffix = FileUtil.getSuffix(originalFilename);
|
||||
if (!suffix.equals("zip")) {
|
||||
throw new ServiceException("请上传zip格式的压缩文件", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 2. 临时存储文件路径
|
||||
// 2.1 压缩包临时文件路径
|
||||
File tempZipFile = null;
|
||||
String randomStr = RandomUtil.randomString(16);
|
||||
String tempZipFilePath = randomStr + "-" + originalFilename;
|
||||
// 2.2 解压后的文件夹路径
|
||||
File destDir = null;
|
||||
String basePath = "unzip_path";
|
||||
String destDirPath = String.format("%s/%s/%s/%s", basePath, DateUtils.getDate(), projectId, randomStr);
|
||||
// 3. 构建临时存储对象
|
||||
List<HseQuestionUserAnswerUploadTemp> tempList = new ArrayList<>();
|
||||
try {
|
||||
// 4. 创建临时文件
|
||||
tempZipFile = File.createTempFile(tempZipFilePath, null);
|
||||
multipartFile.transferTo(tempZipFile);
|
||||
// 5. 解压 zip
|
||||
destDir = new File(destDirPath);
|
||||
ZipUtil.unzip(tempZipFile, destDir);
|
||||
// 4. 遍历文件夹
|
||||
scanFolder(destDir, tempList, projectId);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("文件上传失败", HttpStatus.ERROR);
|
||||
} finally {
|
||||
if (tempZipFile != null) {
|
||||
// 删除临时文件
|
||||
boolean delete = tempZipFile.delete();
|
||||
if (!delete) {
|
||||
log.error("临时文件删除失败,路径:{}", tempZipFilePath);
|
||||
}
|
||||
}
|
||||
if (destDir != null) {
|
||||
Path dirPath = Paths.get(basePath);
|
||||
try {
|
||||
FileUtils.deleteDirectory(dirPath);
|
||||
} catch (IOException e) {
|
||||
log.error("解压文件删除失败,路径:{}", destDirPath, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 8. 遍历临时对象,进行存储
|
||||
if (CollUtil.isEmpty(tempList)) {
|
||||
return true;
|
||||
}
|
||||
// 8.1 获取用户身份证列表
|
||||
Set<String> idCardList = tempList.stream().map(HseQuestionUserAnswerUploadTemp::getUserIdCard)
|
||||
.map(idCard -> idCardEncryptorUtil.encrypt(idCard))
|
||||
.collect(Collectors.toSet());
|
||||
// 8.2 根据用户身份证列表查询用户信息
|
||||
Map<String, List<SubConstructionUser>> userIdMap = constructionUserService.lambdaQuery()
|
||||
.in(SubConstructionUser::getSfzNumber, idCardList).list()
|
||||
.stream().collect(Collectors.groupingBy(SubConstructionUser::getSfzNumber));
|
||||
// 8.3 遍历临时对象,构造用户试卷存储对象
|
||||
List<WgzQuestionSavePdf> savePdfList = tempList.stream().map(temp -> {
|
||||
WgzQuestionSavePdf savePdf = new WgzQuestionSavePdf();
|
||||
// 8.4 获取对应用户id
|
||||
String userIdCard = temp.getUserIdCard();
|
||||
// 加密
|
||||
userIdCard = idCardEncryptorUtil.encrypt(userIdCard);
|
||||
Long userId = null;
|
||||
if (userIdMap.containsKey(userIdCard)) {
|
||||
SubConstructionUser constructionUser = userIdMap.get(userIdCard).getFirst();
|
||||
userId = constructionUser.getSysUserId();
|
||||
Long userProjectId = constructionUser.getProjectId() != null ?
|
||||
constructionUser.getProjectId() : temp.getProjectId();
|
||||
savePdf.setProjectId(userProjectId);
|
||||
}
|
||||
// 8.5 判断用户是否存在
|
||||
if (userId == null) {
|
||||
String userName = temp.getUserName();
|
||||
String message = String.format("用户[%s:%s]不存在", userName, userIdCard);
|
||||
throw new ServiceException(message, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 8.6 设置其他属性
|
||||
String pass = String.format("%s,%s", temp.getPassScore(), temp.getFullScore());
|
||||
savePdf.setType(HseSafetyExamTypeEnum.OFFLINE.getValue());
|
||||
savePdf.setUserId(userId);
|
||||
savePdf.setPath(temp.getFile());
|
||||
savePdf.setPass(pass);
|
||||
savePdf.setTimeOut(0);
|
||||
savePdf.setTakeTime(0L);
|
||||
savePdf.setSumScore(Double.valueOf(temp.getScore()));
|
||||
return savePdf;
|
||||
}).toList();
|
||||
// 9. 保存
|
||||
boolean b = this.saveBatch(savePdfList);
|
||||
if (!b) {
|
||||
throw new ServiceException("数据库操作失败", HttpStatus.ERROR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫描文件夹
|
||||
*
|
||||
* @param folder 文件夹
|
||||
* @param tempList 临时对象列表
|
||||
* @param projectId 项目id
|
||||
*/
|
||||
private void scanFolder(File folder, List<HseQuestionUserAnswerUploadTemp> tempList, Long projectId) {
|
||||
if (!folder.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
// 当前文件夹是否符合格式:姓名-身份证-满分-得分-及格分
|
||||
String folderName = folder.getName();
|
||||
String[] userParts = folderName.split("-");
|
||||
boolean isUserFolder = userParts.length == 5
|
||||
&& isNumber(userParts[2])
|
||||
&& isNumber(userParts[3])
|
||||
&& isNumber(userParts[4])
|
||||
&& userParts[1].length() == 18;
|
||||
if (isUserFolder) {
|
||||
// 找到了匹配的用户文件夹,执行上传逻辑
|
||||
File[] files = folder.listFiles();
|
||||
if (files == null) {
|
||||
return;
|
||||
}
|
||||
List<Long> fileIdList = new ArrayList<>();
|
||||
for (File file : files) {
|
||||
if (file.isFile()) {
|
||||
SysOssVo upload = ossService.upload(file);
|
||||
if (upload != null) {
|
||||
fileIdList.add(upload.getOssId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fileIdList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String fileIdStr = fileIdList.stream()
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.joining(","));
|
||||
// 创建对象
|
||||
HseQuestionUserAnswerUploadTemp temp = new HseQuestionUserAnswerUploadTemp();
|
||||
temp.setProjectId(projectId);
|
||||
temp.setUserName(userParts[0]);
|
||||
temp.setUserIdCard(userParts[1]);
|
||||
temp.setFullScore(Long.parseLong(userParts[2]));
|
||||
temp.setScore(Long.parseLong(userParts[3]));
|
||||
temp.setPassScore(Long.parseLong(userParts[4]));
|
||||
temp.setFile(fileIdStr);
|
||||
tempList.add(temp);
|
||||
return; // 关键!匹配后不再递归子目录
|
||||
}
|
||||
// 不符合格式 -> 继续扫描子目录
|
||||
File[] children = folder.listFiles();
|
||||
if (children != null) {
|
||||
for (File child : children) {
|
||||
if (child.isDirectory()) {
|
||||
scanFolder(child, tempList, projectId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否为数字
|
||||
*/
|
||||
private boolean isNumber(String value) {
|
||||
return value != null && value.matches("\\d+");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
package org.dromara.safety.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.domain.WgzQuestionsConfiguration;
|
||||
@ -12,11 +15,9 @@ import org.dromara.safety.domain.vo.WgzQuestionsConfigurationVo;
|
||||
import org.dromara.safety.mapper.WgzQuestionsConfigurationMapper;
|
||||
import org.dromara.safety.service.IWgzQuestionsConfigurationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 题库配置Service业务层处理
|
||||
@ -24,8 +25,10 @@ import java.util.Collection;
|
||||
* @author ruoyi
|
||||
* @date 2025-02-17
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WgzQuestionsConfigurationServiceImpl extends ServiceImpl<WgzQuestionsConfigurationMapper, WgzQuestionsConfiguration> implements IWgzQuestionsConfigurationService {
|
||||
public class WgzQuestionsConfigurationServiceImpl extends ServiceImpl<WgzQuestionsConfigurationMapper, WgzQuestionsConfiguration>
|
||||
implements IWgzQuestionsConfigurationService {
|
||||
|
||||
@Override
|
||||
public WgzQuestionsConfiguration queryById(Long id) {
|
||||
@ -84,14 +87,6 @@ public class WgzQuestionsConfigurationServiceImpl extends ServiceImpl<WgzQuestio
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 务工者APP相关
|
||||
* =================================================================================================================
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.safety.mapper.HseDocumentSafetyMeetingMapper">
|
||||
|
||||
</mapper>
|
||||
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.safety.mapper.HseQuestionBankMapper">
|
||||
|
||||
</mapper>
|
||||
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.safety.mapper.HseQuestionsCategoryMapper">
|
||||
|
||||
</mapper>
|
||||
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.safety.mapper.HseQuestionsConfigMapper">
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user