diff --git a/yudao-module-electronic/yudao-module-ea-api/src/main/java/cn/iocoder/yudao/module/ea/enums/ErrorCodeConstants.java b/yudao-module-electronic/yudao-module-ea-api/src/main/java/cn/iocoder/yudao/module/ea/enums/ErrorCodeConstants.java index 673247a2..9e7a21c4 100644 --- a/yudao-module-electronic/yudao-module-ea-api/src/main/java/cn/iocoder/yudao/module/ea/enums/ErrorCodeConstants.java +++ b/yudao-module-electronic/yudao-module-ea-api/src/main/java/cn/iocoder/yudao/module/ea/enums/ErrorCodeConstants.java @@ -12,4 +12,5 @@ public interface ErrorCodeConstants { ErrorCode ELECTRONIC_CONSULTATION_NOT_EXISTS = new ErrorCode(300013, "咨询档案不存在"); ErrorCode ELECTRONIC_CUSTOMER_COMPLAINT_NOT_EXISTS = new ErrorCode(300014, "客诉档案不存在"); ErrorCode ELECTRONIC_OTHER_NOT_EXISTS = new ErrorCode(300015, "其他档案不存在"); + ErrorCode ELECTRONIC_ATTACHMENT_NOT_EXISTS = new ErrorCode(300016, "电子档案附件不存在"); } diff --git a/yudao-module-electronic/yudao-module-ea-biz/pom.xml b/yudao-module-electronic/yudao-module-ea-biz/pom.xml index 52afc28c..884824c7 100644 --- a/yudao-module-electronic/yudao-module-ea-biz/pom.xml +++ b/yudao-module-electronic/yudao-module-ea-biz/pom.xml @@ -23,6 +23,12 @@ 1.7.3-snapshot compile + + cn.iocoder.boot + yudao-module-infra-biz + 1.7.3-snapshot + compile + - \ No newline at end of file + diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/ElectronicAttachmentController.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/ElectronicAttachmentController.java new file mode 100644 index 00000000..f10396b8 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/ElectronicAttachmentController.java @@ -0,0 +1,121 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment; + +import cn.hutool.core.io.IoUtil; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.*; +import cn.iocoder.yudao.module.ea.convert.electronicattachment.ElectronicAttachmentConvert; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment.ElectronicAttachmentDO; +import cn.iocoder.yudao.module.ea.service.electronicattachment.ElectronicAttachmentService; +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; +import cn.iocoder.yudao.module.infra.service.file.FileService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "管理后台 - 电子档案附件") +@RestController +@RequestMapping("/ea/electronic-attachment") +@Validated +public class ElectronicAttachmentController { + + @Resource + private ElectronicAttachmentService electronicAttachmentService; + + @Resource + private FileService fileService; + + @PostMapping("/create") + @Operation(summary = "创建电子档案附件") + @PreAuthorize("@ss.hasPermission('ea:electronic-attachment:create')") + public CommonResult createElectronicAttachment(@Valid @RequestBody ElectronicAttachmentCreateReqVO createReqVO) { + return success(electronicAttachmentService.createElectronicAttachment(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新电子档案附件") + @PreAuthorize("@ss.hasPermission('ea:electronic-attachment:update')") + public CommonResult updateElectronicAttachment(@Valid @RequestBody ElectronicAttachmentUpdateReqVO updateReqVO) { + electronicAttachmentService.updateElectronicAttachment(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除电子档案附件") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('ea:electronic-attachment:delete')") + public CommonResult deleteElectronicAttachment(@RequestParam("id") Long id) { + electronicAttachmentService.deleteElectronicAttachment(id); + return success(true); + } + + + @PostMapping("/upload") + @Operation(summary = "上传电子档案附件") + @Parameter(name = "multipartFile", description = "文件", required = true) + @PreAuthorize("@ss.hasPermission('ea:electronic-attachment:create')") + public CommonResult upload(@RequestParam("multipartFile") MultipartFile multipartFile) throws IOException { + String fileUrl = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream())); + FilePageReqVO pageReqVO = new FilePageReqVO(); + String lastSegment = fileUrl.substring(fileUrl.lastIndexOf("/") + 1); + pageReqVO.setPath(lastSegment); + PageResult filePage = fileService.getFilePage(pageReqVO); + return success(filePage.getList().get(0)); + } + + @GetMapping("/get") + @Operation(summary = "获得电子档案附件") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('ea:electronic-attachment:query')") + public CommonResult getElectronicAttachment(@RequestParam("id") Long id) { + ElectronicAttachmentDO electronicAttachment = electronicAttachmentService.getElectronicAttachment(id); + return success(ElectronicAttachmentConvert.INSTANCE.convert(electronicAttachment)); + } + + @GetMapping("/list") + @Operation(summary = "获得电子档案附件列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('ea:electronic-attachment:query')") + public CommonResult> getElectronicAttachmentList(@RequestParam("ids") Collection ids) { + List list = electronicAttachmentService.getElectronicAttachmentList(ids); + return success(ElectronicAttachmentConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得电子档案附件分页") + @PreAuthorize("@ss.hasPermission('ea:electronic-attachment:query')") + public CommonResult> getElectronicAttachmentPage(@Valid ElectronicAttachmentPageReqVO pageVO) { + PageResult pageResult = electronicAttachmentService.getElectronicAttachmentPage(pageVO); + return success(ElectronicAttachmentConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出电子档案附件 Excel") + @PreAuthorize("@ss.hasPermission('ea:electronic-attachment:export')") + @OperateLog(type = EXPORT) + public void exportElectronicAttachmentExcel(@Valid ElectronicAttachmentExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = electronicAttachmentService.getElectronicAttachmentList(exportReqVO); + // 导出 Excel + List datas = ElectronicAttachmentConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "电子档案附件.xls", "数据", ElectronicAttachmentExcelVO.class, datas); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentBaseVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentBaseVO.java new file mode 100644 index 00000000..301b15aa --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentBaseVO.java @@ -0,0 +1,59 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * 电子档案附件 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class ElectronicAttachmentBaseVO { + + @Schema(description = "业务id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23183") + @NotNull(message = "业务id不能为空") + private Long businessId; + + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "业务类型不能为空") + private String businessType; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体id", example = "23467") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "删除状态", example = "2") + private String delStatus; + + @Schema(description = "文件后缀") + private String suffix; + + @Schema(description = "文件地址", example = "https://www.iocoder.cn") + private String fileUrl; + + @Schema(description = "绝对路径") + private String fileAp; + + @Schema(description = "流程号") + private String flowCode; + + @Schema(description = "用户id", example = "4434") + private Long userId; + + @Schema(description = "摘要") + private String note; + + @Schema(description = "所属部门id", example = "14022") + private Long deptId; + + @Schema(description = "所属部门", example = "芋艿") + private String deptName; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentCreateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentCreateReqVO.java new file mode 100644 index 00000000..01938f65 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 电子档案附件创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ElectronicAttachmentCreateReqVO extends ElectronicAttachmentBaseVO { + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentExcelVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentExcelVO.java new file mode 100644 index 00000000..390208c0 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentExcelVO.java @@ -0,0 +1,67 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 电子档案附件 Excel VO + * + * @author 芋道源码 + */ +@Data +public class ElectronicAttachmentExcelVO { + + @ExcelProperty("主键") + private Long id; + + @ExcelProperty("业务id") + private Long businessId; + + @ExcelProperty("业务类型") + private String businessType; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @ExcelProperty("制单人") + private String createBy; + + @ExcelProperty("业务实体id") + private Long companyId; + + @ExcelProperty("业务实体") + private String company; + + @ExcelProperty("删除状态") + private String delStatus; + + @ExcelProperty("文件后缀") + private String suffix; + + @ExcelProperty("文件地址") + private String fileUrl; + + @ExcelProperty("绝对路径") + private String fileAp; + + @ExcelProperty("流程号") + private String flowCode; + + @ExcelProperty("用户id") + private Long userId; + + @ExcelProperty("摘要") + private String note; + + @ExcelProperty("所属部门id") + private Long deptId; + + @ExcelProperty("所属部门") + private String deptName; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentExportReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentExportReqVO.java new file mode 100644 index 00000000..3a64b8d2 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentExportReqVO.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 电子档案附件 Excel 导出 Request VO,参数和 ElectronicAttachmentPageReqVO 是一致的") +@Data +public class ElectronicAttachmentExportReqVO { + + @Schema(description = "业务id", example = "23183") + private Long businessId; + + @Schema(description = "业务类型", example = "1") + private String businessType; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体id", example = "23467") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "删除状态", example = "2") + private String delStatus; + + @Schema(description = "文件后缀") + private String suffix; + + @Schema(description = "文件地址", example = "https://www.iocoder.cn") + private String fileUrl; + + @Schema(description = "绝对路径") + private String fileAp; + + @Schema(description = "流程号") + private String flowCode; + + @Schema(description = "用户id", example = "4434") + private Long userId; + + @Schema(description = "摘要") + private String note; + + @Schema(description = "所属部门id", example = "14022") + private Long deptId; + + @Schema(description = "所属部门", example = "芋艿") + private String deptName; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentPageReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentPageReqVO.java new file mode 100644 index 00000000..c860341b --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentPageReqVO.java @@ -0,0 +1,64 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 电子档案附件分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ElectronicAttachmentPageReqVO extends PageParam { + + @Schema(description = "业务id", example = "23183") + private Long businessId; + + @Schema(description = "业务类型", example = "1") + private String businessType; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体id", example = "23467") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "删除状态", example = "2") + private String delStatus; + + @Schema(description = "文件后缀") + private String suffix; + + @Schema(description = "文件地址", example = "https://www.iocoder.cn") + private String fileUrl; + + @Schema(description = "绝对路径") + private String fileAp; + + @Schema(description = "流程号") + private String flowCode; + + @Schema(description = "用户id", example = "4434") + private Long userId; + + @Schema(description = "摘要") + private String note; + + @Schema(description = "所属部门id", example = "14022") + private Long deptId; + + @Schema(description = "所属部门", example = "芋艿") + private String deptName; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentRespVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentRespVO.java new file mode 100644 index 00000000..0c6cd6a7 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 电子档案附件 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ElectronicAttachmentRespVO extends ElectronicAttachmentBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23298") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentUpdateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentUpdateReqVO.java new file mode 100644 index 00000000..256cffff --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicattachment/vo/ElectronicAttachmentUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 电子档案附件更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ElectronicAttachmentUpdateReqVO extends ElectronicAttachmentBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23298") + @NotNull(message = "主键不能为空") + private Long id; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicattachment/ElectronicAttachmentConvert.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicattachment/ElectronicAttachmentConvert.java new file mode 100644 index 00000000..0c614be2 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicattachment/ElectronicAttachmentConvert.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.ea.convert.electronicattachment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentCreateReqVO; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentExcelVO; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentRespVO; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentUpdateReqVO; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment.ElectronicAttachmentDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 电子档案附件 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ElectronicAttachmentConvert { + + ElectronicAttachmentConvert INSTANCE = Mappers.getMapper(ElectronicAttachmentConvert.class); + + ElectronicAttachmentDO convert(ElectronicAttachmentCreateReqVO bean); + + ElectronicAttachmentDO convert(ElectronicAttachmentUpdateReqVO bean); + + ElectronicAttachmentRespVO convert(ElectronicAttachmentDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electronicattachment/ElectronicAttachmentDO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electronicattachment/ElectronicAttachmentDO.java new file mode 100644 index 00000000..482e1810 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electronicattachment/ElectronicAttachmentDO.java @@ -0,0 +1,87 @@ +package cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 电子档案附件 DO + * + * @author 芋道源码 + */ +@TableName("ea_electronic_attachment") +@KeySequence("ea_electronic_attachment_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ElectronicAttachmentDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 业务id + */ + private Long businessId; + /** + * 业务类型 + */ + private String businessType; + /** + * 制单人 + */ + private String createBy; + /** + * 业务实体id + */ + private Long companyId; + /** + * 业务实体 + */ + private String company; + /** + * 删除状态 + */ + private String delStatus; + /** + * 文件后缀 + */ + private String suffix; + /** + * 文件地址 + */ + private String fileUrl; + /** + * 绝对路径 + */ + private String fileAp; + /** + * 流程号 + */ + private String flowCode; + /** + * 用户id + */ + private Long userId; + /** + * 摘要 + */ + private String note; + /** + * 所属部门id + */ + private Long deptId; + /** + * 所属部门 + */ + private String deptName; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicattachment/ElectronicAttachmentMapper.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicattachment/ElectronicAttachmentMapper.java new file mode 100644 index 00000000..d6a23533 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicattachment/ElectronicAttachmentMapper.java @@ -0,0 +1,61 @@ +package cn.iocoder.yudao.module.ea.dal.mysql.electronicattachment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentExportReqVO; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentPageReqVO; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment.ElectronicAttachmentDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 电子档案附件 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ElectronicAttachmentMapper extends BaseMapperX { + + default PageResult selectPage(ElectronicAttachmentPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ElectronicAttachmentDO::getBusinessId, reqVO.getBusinessId()) + .eqIfPresent(ElectronicAttachmentDO::getBusinessType, reqVO.getBusinessType()) + .betweenIfPresent(ElectronicAttachmentDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ElectronicAttachmentDO::getCreateBy, reqVO.getCreateBy()) + .eqIfPresent(ElectronicAttachmentDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(ElectronicAttachmentDO::getCompany, reqVO.getCompany()) + .eqIfPresent(ElectronicAttachmentDO::getDelStatus, reqVO.getDelStatus()) + .eqIfPresent(ElectronicAttachmentDO::getSuffix, reqVO.getSuffix()) + .eqIfPresent(ElectronicAttachmentDO::getFileUrl, reqVO.getFileUrl()) + .eqIfPresent(ElectronicAttachmentDO::getFileAp, reqVO.getFileAp()) + .eqIfPresent(ElectronicAttachmentDO::getFlowCode, reqVO.getFlowCode()) + .eqIfPresent(ElectronicAttachmentDO::getUserId, reqVO.getUserId()) + .eqIfPresent(ElectronicAttachmentDO::getNote, reqVO.getNote()) + .eqIfPresent(ElectronicAttachmentDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(ElectronicAttachmentDO::getDeptName, reqVO.getDeptName()) + .orderByDesc(ElectronicAttachmentDO::getId)); + } + + default List selectList(ElectronicAttachmentExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(ElectronicAttachmentDO::getBusinessId, reqVO.getBusinessId()) + .eqIfPresent(ElectronicAttachmentDO::getBusinessType, reqVO.getBusinessType()) + .betweenIfPresent(ElectronicAttachmentDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ElectronicAttachmentDO::getCreateBy, reqVO.getCreateBy()) + .eqIfPresent(ElectronicAttachmentDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(ElectronicAttachmentDO::getCompany, reqVO.getCompany()) + .eqIfPresent(ElectronicAttachmentDO::getDelStatus, reqVO.getDelStatus()) + .eqIfPresent(ElectronicAttachmentDO::getSuffix, reqVO.getSuffix()) + .eqIfPresent(ElectronicAttachmentDO::getFileUrl, reqVO.getFileUrl()) + .eqIfPresent(ElectronicAttachmentDO::getFileAp, reqVO.getFileAp()) + .eqIfPresent(ElectronicAttachmentDO::getFlowCode, reqVO.getFlowCode()) + .eqIfPresent(ElectronicAttachmentDO::getUserId, reqVO.getUserId()) + .eqIfPresent(ElectronicAttachmentDO::getNote, reqVO.getNote()) + .eqIfPresent(ElectronicAttachmentDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(ElectronicAttachmentDO::getDeptName, reqVO.getDeptName()) + .orderByDesc(ElectronicAttachmentDO::getId)); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicattachment/ElectronicAttachmentService.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicattachment/ElectronicAttachmentService.java new file mode 100644 index 00000000..63086c0e --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicattachment/ElectronicAttachmentService.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.ea.service.electronicattachment; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment.ElectronicAttachmentDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 电子档案附件 Service 接口 + * + * @author 芋道源码 + */ +public interface ElectronicAttachmentService { + + /** + * 创建电子档案附件 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createElectronicAttachment(@Valid ElectronicAttachmentCreateReqVO createReqVO); + + /** + * 更新电子档案附件 + * + * @param updateReqVO 更新信息 + */ + void updateElectronicAttachment(@Valid ElectronicAttachmentUpdateReqVO updateReqVO); + + /** + * 删除电子档案附件 + * + * @param id 编号 + */ + void deleteElectronicAttachment(Long id); + + /** + * 获得电子档案附件 + * + * @param id 编号 + * @return 电子档案附件 + */ + ElectronicAttachmentDO getElectronicAttachment(Long id); + + /** + * 获得电子档案附件列表 + * + * @param ids 编号 + * @return 电子档案附件列表 + */ + List getElectronicAttachmentList(Collection ids); + + /** + * 获得电子档案附件分页 + * + * @param pageReqVO 分页查询 + * @return 电子档案附件分页 + */ + PageResult getElectronicAttachmentPage(ElectronicAttachmentPageReqVO pageReqVO); + + /** + * 获得电子档案附件列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 电子档案附件列表 + */ + List getElectronicAttachmentList(ElectronicAttachmentExportReqVO exportReqVO); + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicattachment/ElectronicAttachmentServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicattachment/ElectronicAttachmentServiceImpl.java new file mode 100644 index 00000000..17b0c96c --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicattachment/ElectronicAttachmentServiceImpl.java @@ -0,0 +1,85 @@ +package cn.iocoder.yudao.module.ea.service.electronicattachment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentCreateReqVO; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentExportReqVO; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentPageReqVO; +import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentUpdateReqVO; +import cn.iocoder.yudao.module.ea.convert.electronicattachment.ElectronicAttachmentConvert; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment.ElectronicAttachmentDO; +import cn.iocoder.yudao.module.ea.dal.mysql.electronicattachment.ElectronicAttachmentMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.ea.enums.ErrorCodeConstants.ELECTRONIC_ATTACHMENT_NOT_EXISTS; + +/** + * 电子档案附件 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ElectronicAttachmentServiceImpl implements ElectronicAttachmentService { + + @Resource + private ElectronicAttachmentMapper electronicAttachmentMapper; + + @Override + public Long createElectronicAttachment(ElectronicAttachmentCreateReqVO createReqVO) { + // 插入 + ElectronicAttachmentDO electronicAttachment = ElectronicAttachmentConvert.INSTANCE.convert(createReqVO); + electronicAttachmentMapper.insert(electronicAttachment); + // 返回 + return electronicAttachment.getId(); + } + + @Override + public void updateElectronicAttachment(ElectronicAttachmentUpdateReqVO updateReqVO) { + // 校验存在 + validateElectronicAttachmentExists(updateReqVO.getId()); + // 更新 + ElectronicAttachmentDO updateObj = ElectronicAttachmentConvert.INSTANCE.convert(updateReqVO); + electronicAttachmentMapper.updateById(updateObj); + } + + @Override + public void deleteElectronicAttachment(Long id) { + // 校验存在 + validateElectronicAttachmentExists(id); + // 删除 + electronicAttachmentMapper.deleteById(id); + } + + private void validateElectronicAttachmentExists(Long id) { + if (electronicAttachmentMapper.selectById(id) == null) { + throw exception(ELECTRONIC_ATTACHMENT_NOT_EXISTS); + } + } + + @Override + public ElectronicAttachmentDO getElectronicAttachment(Long id) { + return electronicAttachmentMapper.selectById(id); + } + + @Override + public List getElectronicAttachmentList(Collection ids) { + return electronicAttachmentMapper.selectBatchIds(ids); + } + + @Override + public PageResult getElectronicAttachmentPage(ElectronicAttachmentPageReqVO pageReqVO) { + return electronicAttachmentMapper.selectPage(pageReqVO); + } + + @Override + public List getElectronicAttachmentList(ElectronicAttachmentExportReqVO exportReqVO) { + return electronicAttachmentMapper.selectList(exportReqVO); + } + +}