diff --git a/pom.xml b/pom.xml index b468a9b2..862d6bed 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,7 @@ yudao-module-bs yudao-module-archives + yudao-module-electronic ${project.artifactId} diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java index 19abaa6f..5f7f3497 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java @@ -32,14 +32,15 @@ public abstract class BaseDO implements Serializable { * * 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。 */ - @TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR) + + @TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR,exist = false) private String creator; /** * 更新者,目前使用 SysUser 的 id 编号 * * 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。 */ - @TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR) + @TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR ,exist = false) private String updater; /** * 是否删除 diff --git a/yudao-module-electronic/pom.xml b/yudao-module-electronic/pom.xml new file mode 100644 index 00000000..6b76b85c --- /dev/null +++ b/yudao-module-electronic/pom.xml @@ -0,0 +1,106 @@ + + + 4.0.0 + + cn.iocoder.boot + yudao + 1.7.3-snapshot + + + yudao-module-electronic + pom + + + yudao-module-ea-api + yudao-module-ea-biz + + + + + cn.iocoder.boot + yudao-common + + + + + org.springframework.boot + spring-boot-starter-validation + true + + + + cn.iocoder.boot + yudao-spring-boot-starter-biz-tenant + + + cn.iocoder.boot + yudao-module-archives-api + ${revision} + + + cn.iocoder.boot + yudao-spring-boot-starter-biz-data-permission + + + + + cn.iocoder.boot + yudao-spring-boot-starter-biz-operatelog + + + + cn.iocoder.boot + yudao-module-bpm-api + ${revision} + + + + + cn.iocoder.boot + yudao-spring-boot-starter-web + + + cn.iocoder.boot + yudao-spring-boot-starter-security + + + + + cn.iocoder.boot + yudao-spring-boot-starter-mybatis + + + + + cn.iocoder.boot + yudao-spring-boot-starter-test + + + + + cn.iocoder.boot + yudao-spring-boot-starter-excel + + + cn.iocoder.boot + yudao-module-bpm-api + 1.7.3-snapshot + compile + + + cn.iocoder.boot + yudao-module-system-biz + 1.7.3-snapshot + compile + + + + + 8 + 8 + UTF-8 + + + \ No newline at end of file diff --git a/yudao-module-electronic/yudao-module-ea-api/pom.xml b/yudao-module-electronic/yudao-module-ea-api/pom.xml new file mode 100644 index 00000000..a3525fd5 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-api/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + cn.iocoder.boot + yudao-module-electronic + 1.7.3-snapshot + + + yudao-module-ea-api + + + 8 + 8 + UTF-8 + + + \ No newline at end of file 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 new file mode 100644 index 00000000..fef34492 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-api/src/main/java/cn/iocoder/yudao/module/ea/enums/ErrorCodeConstants.java @@ -0,0 +1,8 @@ +package cn.iocoder.yudao.module.ea.enums; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; + +public interface ErrorCodeConstants { + ErrorCode ELECTRONIC_ASSETS_NOT_EXISTS = new ErrorCode(300010, "资产档案不存在"); + +} \ No newline at end of file diff --git a/yudao-module-electronic/yudao-module-ea-biz/pom.xml b/yudao-module-electronic/yudao-module-ea-biz/pom.xml new file mode 100644 index 00000000..52afc28c --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + cn.iocoder.boot + yudao-module-electronic + 1.7.3-snapshot + + + yudao-module-ea-biz + + + 8 + 8 + UTF-8 + + + + cn.iocoder.boot + yudao-module-ea-api + 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/electronicassets/ElectronicAssetsController.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/ElectronicAssetsController.java new file mode 100644 index 00000000..fdf13e66 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/ElectronicAssetsController.java @@ -0,0 +1,102 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicassets; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO; +import cn.iocoder.yudao.module.ea.convert.electronicassets.ElectronicAssetsConvert; +import cn.iocoder.yudao.module.ea.service.electronicassets.ElectronicAssetsService; + +@Tag(name = "管理后台 - 资产档案") +@RestController +@RequestMapping("/ea/electronic") +@Validated +public class ElectronicAssetsController { + + @Resource + private ElectronicAssetsService electronicAssetsService; + + @PostMapping("/create") + @Operation(summary = "创建资产档案") + @PreAuthorize("@ss.hasPermission('ea:electronic:create')") + public CommonResult createElectronicAssets(@Valid @RequestBody ElectronicAssetsCreateReqVO createReqVO) { + return success(electronicAssetsService.createElectronicAssets(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新资产档案") + @PreAuthorize("@ss.hasPermission('ea:electronic:update')") + public CommonResult updateElectronicAssets(@Valid @RequestBody ElectronicAssetsUpdateReqVO updateReqVO) { + electronicAssetsService.updateElectronicAssets(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除资产档案") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('ea:electronic:delete')") + public CommonResult deleteElectronicAssets(@RequestParam("id") Long id) { + electronicAssetsService.deleteElectronicAssets(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得资产档案") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('ea:electronic:query')") + public CommonResult getElectronicAssets(@RequestParam("id") Long id) { + ElectronicAssetsDO electronicAssets = electronicAssetsService.getElectronicAssets(id); + return success(ElectronicAssetsConvert.INSTANCE.convert(electronicAssets)); + } + + @GetMapping("/list") + @Operation(summary = "获得资产档案列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('ea:electronic:query')") + public CommonResult> getElectronicAssetsList(@RequestParam("ids") Collection ids) { + List list = electronicAssetsService.getElectronicAssetsList(ids); + return success(ElectronicAssetsConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得资产档案分页") + @PreAuthorize("@ss.hasPermission('ea:electronic:query')") + public CommonResult> getElectronicAssetsPage(@Valid ElectronicAssetsPageReqVO pageVO) { + PageResult pageResult = electronicAssetsService.getElectronicAssetsPage(pageVO); + return success(ElectronicAssetsConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出资产档案 Excel") + @PreAuthorize("@ss.hasPermission('ea:electronic:export')") + @OperateLog(type = EXPORT) + public void exportElectronicAssetsExcel(@Valid ElectronicAssetsExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = electronicAssetsService.getElectronicAssetsList(exportReqVO); + // 导出 Excel + List datas = ElectronicAssetsConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "资产档案.xls", "数据", ElectronicAssetsExcelVO.class, datas); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsBaseVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsBaseVO.java new file mode 100644 index 00000000..aed16385 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsBaseVO.java @@ -0,0 +1,94 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import javax.validation.constraints.*; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +/** + * 资产档案 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class ElectronicAssetsBaseVO { + + @Schema(description = "业务实体id", example = "5984") + private Long companyId; + + @Schema(description = "业务实体名称") + private String company; + + @Schema(description = "部门id", example = "32352") + private Long deptId; + + @Schema(description = "部门名称", example = "芋艿") + private String deptName; + + @Schema(description = "资产编号") + private String assetCode; + + @Schema(description = "资产名称", example = "王五") + private String assetName; + + @Schema(description = "资产描述", example = "你说的对") + private String assetDescription; + + @Schema(description = "资产类型", example = "2") + private String assetType; + + @Schema(description = "购买日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime purchaseDate; + + @Schema(description = "报废日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime disposalDate; + + @Schema(description = "资产状态", example = "1") + private String assetStatus; + + @Schema(description = "资产价格", example = "21847") + private BigDecimal purchasePrice; + + @Schema(description = "资产数量") + private Integer assetQuantity; + + @Schema(description = "购买渠道") + private String purchaseChannel; + + @Schema(description = "文件来源") + private String source; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "借阅状态", example = "2") + private String borrowStatus; + + @Schema(description = "纸档位置") + private String position; + + @Schema(description = "完整性") + private String cherks; + + @Schema(description = "归档id", example = "5964") + private Long recordId; + + @Schema(description = "归档状态", example = "1") + private String fileStatus; + + @Schema(description = "制单人") + private String createBy; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsCreateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsCreateReqVO.java new file mode 100644 index 00000000..9d9bb7c8 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.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 ElectronicAssetsCreateReqVO extends ElectronicAssetsBaseVO { + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsExcelVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsExcelVO.java new file mode 100644 index 00000000..4ec12f73 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsExcelVO.java @@ -0,0 +1,97 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 资产档案 Excel VO + * + * @author 芋道源码 + */ +@Data +public class ElectronicAssetsExcelVO { + + @ExcelProperty("资产档案id") + private Long id; + + @ExcelProperty("业务实体id") + private Long companyId; + + @ExcelProperty("业务实体名称") + private String company; + + @ExcelProperty("部门id") + private Long deptId; + + @ExcelProperty("部门名称") + private String deptName; + + @ExcelProperty("资产编号") + private String assetCode; + + @ExcelProperty("资产名称") + private String assetName; + + @ExcelProperty("资产描述") + private String assetDescription; + + @ExcelProperty("资产类型") + private String assetType; + + @ExcelProperty("购买日期") + private LocalDateTime purchaseDate; + + @ExcelProperty("报废日期") + private LocalDateTime disposalDate; + + @ExcelProperty("资产状态") + private String assetStatus; + + @ExcelProperty("资产价格") + private BigDecimal purchasePrice; + + @ExcelProperty("资产数量") + private Integer assetQuantity; + + @ExcelProperty("购买渠道") + private String purchaseChannel; + + @ExcelProperty("文件来源") + private String source; + + @ExcelProperty("年度") + private String year; + + @ExcelProperty("月份") + private String period; + + @ExcelProperty("借阅状态") + private String borrowStatus; + + @ExcelProperty("纸档位置") + private String position; + + @ExcelProperty("完整性") + private String cherks; + + @ExcelProperty("归档id") + private Long recordId; + + @ExcelProperty("归档状态") + private String fileStatus; + + @ExcelProperty("创建日期") + private LocalDateTime createTime; + + @ExcelProperty("制单人") + private String createBy; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsExportReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsExportReqVO.java new file mode 100644 index 00000000..885d2e69 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsExportReqVO.java @@ -0,0 +1,93 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo; + +import lombok.*; + +import java.math.BigDecimal; +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,参数和 ElectronicAssetsPageReqVO 是一致的") +@Data +public class ElectronicAssetsExportReqVO { + + @Schema(description = "业务实体id", example = "5984") + private Long companyId; + + @Schema(description = "业务实体名称") + private String company; + + @Schema(description = "部门id", example = "32352") + private Long deptId; + + @Schema(description = "部门名称", example = "芋艿") + private String deptName; + + @Schema(description = "资产编号") + private String assetCode; + + @Schema(description = "资产名称", example = "王五") + private String assetName; + + @Schema(description = "资产描述", example = "你说的对") + private String assetDescription; + + @Schema(description = "资产类型", example = "2") + private String assetType; + + @Schema(description = "购买日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] purchaseDate; + + @Schema(description = "报废日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] disposalDate; + + @Schema(description = "资产状态", example = "1") + private String assetStatus; + + @Schema(description = "资产价格", example = "21847") + private BigDecimal purchasePrice; + + @Schema(description = "资产数量") + private Integer assetQuantity; + + @Schema(description = "购买渠道") + private String purchaseChannel; + + @Schema(description = "文件来源") + private String source; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "借阅状态", example = "2") + private String borrowStatus; + + @Schema(description = "纸档位置") + private String position; + + @Schema(description = "完整性") + private String cherks; + + @Schema(description = "归档id", example = "5964") + private Long recordId; + + @Schema(description = "归档状态", example = "1") + private String fileStatus; + + @Schema(description = "创建日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "制单人") + private String createBy; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsPageReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsPageReqVO.java new file mode 100644 index 00000000..fdf95532 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsPageReqVO.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo; + +import lombok.*; + +import java.math.BigDecimal; +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 ElectronicAssetsPageReqVO extends PageParam { + + @Schema(description = "业务实体id", example = "5984") + private Long companyId; + + @Schema(description = "业务实体名称") + private String company; + + @Schema(description = "部门id", example = "32352") + private Long deptId; + + @Schema(description = "部门名称", example = "芋艿") + private String deptName; + + @Schema(description = "资产编号") + private String assetCode; + + @Schema(description = "资产名称", example = "王五") + private String assetName; + + @Schema(description = "资产描述", example = "你说的对") + private String assetDescription; + + @Schema(description = "资产类型", example = "2") + private String assetType; + + @Schema(description = "购买日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] purchaseDate; + + @Schema(description = "报废日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] disposalDate; + + @Schema(description = "资产状态", example = "1") + private String assetStatus; + + @Schema(description = "资产价格", example = "21847") + private BigDecimal purchasePrice; + + @Schema(description = "资产数量") + private Integer assetQuantity; + + @Schema(description = "购买渠道") + private String purchaseChannel; + + @Schema(description = "文件来源") + private String source; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "借阅状态", example = "2") + private String borrowStatus; + + @Schema(description = "纸档位置") + private String position; + + @Schema(description = "完整性") + private String cherks; + + @Schema(description = "归档id", example = "5964") + private Long recordId; + + @Schema(description = "归档状态", example = "1") + private String fileStatus; + + @Schema(description = "创建日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "制单人") + private String createBy; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsRespVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsRespVO.java new file mode 100644 index 00000000..777f57d3 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.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 ElectronicAssetsRespVO extends ElectronicAssetsBaseVO { + + @Schema(description = "资产档案id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17700") + 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/electronicassets/vo/ElectronicAssetsUpdateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsUpdateReqVO.java new file mode 100644 index 00000000..1927b6fa --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicassets/vo/ElectronicAssetsUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.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 ElectronicAssetsUpdateReqVO extends ElectronicAssetsBaseVO { + + @Schema(description = "资产档案id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17700") + @NotNull(message = "资产档案id不能为空") + private Long id; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicassets/ElectronicAssetsConvert.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicassets/ElectronicAssetsConvert.java new file mode 100644 index 00000000..b5953c23 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicassets/ElectronicAssetsConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.ea.convert.electronicassets; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO; + +/** + * 资产档案 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ElectronicAssetsConvert { + + ElectronicAssetsConvert INSTANCE = Mappers.getMapper(ElectronicAssetsConvert.class); + + ElectronicAssetsDO convert(ElectronicAssetsCreateReqVO bean); + + ElectronicAssetsDO convert(ElectronicAssetsUpdateReqVO bean); + + ElectronicAssetsRespVO convert(ElectronicAssetsDO 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/electronicassets/ElectronicAssetsDO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electronicassets/ElectronicAssetsDO.java new file mode 100644 index 00000000..2f7ca12f --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electronicassets/ElectronicAssetsDO.java @@ -0,0 +1,126 @@ +package cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.math.BigDecimal; +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_assets") +@KeySequence("ea_electronic_assets_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ElectronicAssetsDO extends BaseDO { + + /** + * 资产档案id + */ + @TableId + private Long id; + /** + * 业务实体id + */ + private Long companyId; + /** + * 业务实体名称 + */ + private String company; + /** + * 部门id + */ + private Long deptId; + /** + * 部门名称 + */ + private String deptName; + /** + * 资产编号 + */ + private String assetCode; + /** + * 资产名称 + */ + private String assetName; + /** + * 资产描述 + */ + private String assetDescription; + /** + * 资产类型 + */ + private String assetType; + /** + * 购买日期 + */ + private LocalDateTime purchaseDate; + /** + * 报废日期 + */ + private LocalDateTime disposalDate; + /** + * 资产状态 + */ + private String assetStatus; + /** + * 资产价格 + */ + private BigDecimal purchasePrice; + /** + * 资产数量 + */ + private Integer assetQuantity; + /** + * 购买渠道 + */ + private String purchaseChannel; + /** + * 文件来源 + */ + private String source; + /** + * 年度 + */ + private String year; + /** + * 月份 + */ + private String period; + /** + * 借阅状态 + */ + private String borrowStatus; + /** + * 纸档位置 + */ + private String position; + /** + * 完整性 + */ + private String cherks; + /** + * 归档id + */ + private Long recordId; + /** + * 归档状态 + */ + private String fileStatus; + /** + * 制单人 + */ + private String createBy; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicassets/ElectronicAssetsMapper.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicassets/ElectronicAssetsMapper.java new file mode 100644 index 00000000..e9ab4169 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicassets/ElectronicAssetsMapper.java @@ -0,0 +1,78 @@ +package cn.iocoder.yudao.module.ea.dal.mysql.electronicassets; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.*; + +/** + * 资产档案 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ElectronicAssetsMapper extends BaseMapperX { + + default PageResult selectPage(ElectronicAssetsPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ElectronicAssetsDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(ElectronicAssetsDO::getCompany, reqVO.getCompany()) + .eqIfPresent(ElectronicAssetsDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(ElectronicAssetsDO::getDeptName, reqVO.getDeptName()) + .eqIfPresent(ElectronicAssetsDO::getAssetCode, reqVO.getAssetCode()) + .likeIfPresent(ElectronicAssetsDO::getAssetName, reqVO.getAssetName()) + .eqIfPresent(ElectronicAssetsDO::getAssetDescription, reqVO.getAssetDescription()) + .eqIfPresent(ElectronicAssetsDO::getAssetType, reqVO.getAssetType()) + .betweenIfPresent(ElectronicAssetsDO::getPurchaseDate, reqVO.getPurchaseDate()) + .betweenIfPresent(ElectronicAssetsDO::getDisposalDate, reqVO.getDisposalDate()) + .eqIfPresent(ElectronicAssetsDO::getAssetStatus, reqVO.getAssetStatus()) + .eqIfPresent(ElectronicAssetsDO::getPurchasePrice, reqVO.getPurchasePrice()) + .eqIfPresent(ElectronicAssetsDO::getAssetQuantity, reqVO.getAssetQuantity()) + .eqIfPresent(ElectronicAssetsDO::getPurchaseChannel, reqVO.getPurchaseChannel()) + .eqIfPresent(ElectronicAssetsDO::getSource, reqVO.getSource()) + .eqIfPresent(ElectronicAssetsDO::getYear, reqVO.getYear()) + .eqIfPresent(ElectronicAssetsDO::getPeriod, reqVO.getPeriod()) + .eqIfPresent(ElectronicAssetsDO::getBorrowStatus, reqVO.getBorrowStatus()) + .eqIfPresent(ElectronicAssetsDO::getPosition, reqVO.getPosition()) + .eqIfPresent(ElectronicAssetsDO::getCherks, reqVO.getCherks()) + .eqIfPresent(ElectronicAssetsDO::getRecordId, reqVO.getRecordId()) + .eqIfPresent(ElectronicAssetsDO::getFileStatus, reqVO.getFileStatus()) + .betweenIfPresent(ElectronicAssetsDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ElectronicAssetsDO::getCreateBy, reqVO.getCreateBy()) + .orderByDesc(ElectronicAssetsDO::getId)); + } + + default List selectList(ElectronicAssetsExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(ElectronicAssetsDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(ElectronicAssetsDO::getCompany, reqVO.getCompany()) + .eqIfPresent(ElectronicAssetsDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(ElectronicAssetsDO::getDeptName, reqVO.getDeptName()) + .eqIfPresent(ElectronicAssetsDO::getAssetCode, reqVO.getAssetCode()) + .likeIfPresent(ElectronicAssetsDO::getAssetName, reqVO.getAssetName()) + .eqIfPresent(ElectronicAssetsDO::getAssetDescription, reqVO.getAssetDescription()) + .eqIfPresent(ElectronicAssetsDO::getAssetType, reqVO.getAssetType()) + .betweenIfPresent(ElectronicAssetsDO::getPurchaseDate, reqVO.getPurchaseDate()) + .betweenIfPresent(ElectronicAssetsDO::getDisposalDate, reqVO.getDisposalDate()) + .eqIfPresent(ElectronicAssetsDO::getAssetStatus, reqVO.getAssetStatus()) + .eqIfPresent(ElectronicAssetsDO::getPurchasePrice, reqVO.getPurchasePrice()) + .eqIfPresent(ElectronicAssetsDO::getAssetQuantity, reqVO.getAssetQuantity()) + .eqIfPresent(ElectronicAssetsDO::getPurchaseChannel, reqVO.getPurchaseChannel()) + .eqIfPresent(ElectronicAssetsDO::getSource, reqVO.getSource()) + .eqIfPresent(ElectronicAssetsDO::getYear, reqVO.getYear()) + .eqIfPresent(ElectronicAssetsDO::getPeriod, reqVO.getPeriod()) + .eqIfPresent(ElectronicAssetsDO::getBorrowStatus, reqVO.getBorrowStatus()) + .eqIfPresent(ElectronicAssetsDO::getPosition, reqVO.getPosition()) + .eqIfPresent(ElectronicAssetsDO::getCherks, reqVO.getCherks()) + .eqIfPresent(ElectronicAssetsDO::getRecordId, reqVO.getRecordId()) + .eqIfPresent(ElectronicAssetsDO::getFileStatus, reqVO.getFileStatus()) + .betweenIfPresent(ElectronicAssetsDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ElectronicAssetsDO::getCreateBy, reqVO.getCreateBy()) + .orderByDesc(ElectronicAssetsDO::getId)); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicassets/ElectronicAssetsService.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicassets/ElectronicAssetsService.java new file mode 100644 index 00000000..499f980e --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicassets/ElectronicAssetsService.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.ea.service.electronicassets; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 资产档案 Service 接口 + * + * @author 芋道源码 + */ +public interface ElectronicAssetsService { + + /** + * 创建资产档案 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createElectronicAssets(@Valid ElectronicAssetsCreateReqVO createReqVO); + + /** + * 更新资产档案 + * + * @param updateReqVO 更新信息 + */ + void updateElectronicAssets(@Valid ElectronicAssetsUpdateReqVO updateReqVO); + + /** + * 删除资产档案 + * + * @param id 编号 + */ + void deleteElectronicAssets(Long id); + + /** + * 获得资产档案 + * + * @param id 编号 + * @return 资产档案 + */ + ElectronicAssetsDO getElectronicAssets(Long id); + + /** + * 获得资产档案列表 + * + * @param ids 编号 + * @return 资产档案列表 + */ + List getElectronicAssetsList(Collection ids); + + /** + * 获得资产档案分页 + * + * @param pageReqVO 分页查询 + * @return 资产档案分页 + */ + PageResult getElectronicAssetsPage(ElectronicAssetsPageReqVO pageReqVO); + + /** + * 获得资产档案列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 资产档案列表 + */ + List getElectronicAssetsList(ElectronicAssetsExportReqVO exportReqVO); + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicassets/ElectronicAssetsServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicassets/ElectronicAssetsServiceImpl.java new file mode 100644 index 00000000..7f6099d5 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicassets/ElectronicAssetsServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.ea.service.electronicassets; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.ea.convert.electronicassets.ElectronicAssetsConvert; +import cn.iocoder.yudao.module.ea.dal.mysql.electronicassets.ElectronicAssetsMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.ea.enums.ErrorCodeConstants.*; + +/** + * 资产档案 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ElectronicAssetsServiceImpl implements ElectronicAssetsService { + + @Resource + private ElectronicAssetsMapper electronicAssetsMapper; + + @Override + public Long createElectronicAssets(ElectronicAssetsCreateReqVO createReqVO) { + // 插入 + ElectronicAssetsDO electronicAssets = ElectronicAssetsConvert.INSTANCE.convert(createReqVO); + electronicAssetsMapper.insert(electronicAssets); + // 返回 + return electronicAssets.getId(); + } + + @Override + public void updateElectronicAssets(ElectronicAssetsUpdateReqVO updateReqVO) { + // 校验存在 + validateElectronicAssetsExists(updateReqVO.getId()); + // 更新 + ElectronicAssetsDO updateObj = ElectronicAssetsConvert.INSTANCE.convert(updateReqVO); + electronicAssetsMapper.updateById(updateObj); + } + + @Override + public void deleteElectronicAssets(Long id) { + // 校验存在 + validateElectronicAssetsExists(id); + // 删除 + electronicAssetsMapper.deleteById(id); + } + + private void validateElectronicAssetsExists(Long id) { + if (electronicAssetsMapper.selectById(id) == null) { + throw exception(ELECTRONIC_ASSETS_NOT_EXISTS); + } + } + + @Override + public ElectronicAssetsDO getElectronicAssets(Long id) { + return electronicAssetsMapper.selectById(id); + } + + @Override + public List getElectronicAssetsList(Collection ids) { + return electronicAssetsMapper.selectBatchIds(ids); + } + + @Override + public PageResult getElectronicAssetsPage(ElectronicAssetsPageReqVO pageReqVO) { + return electronicAssetsMapper.selectPage(pageReqVO); + } + + @Override + public List getElectronicAssetsList(ElectronicAssetsExportReqVO exportReqVO) { + return electronicAssetsMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electronicassets/ElectronicAssetsMapper.xml b/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electronicassets/ElectronicAssetsMapper.xml new file mode 100644 index 00000000..0197fbb7 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electronicassets/ElectronicAssetsMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml index cbf947bc..d2d0fa0b 100644 --- a/yudao-server/pom.xml +++ b/yudao-server/pom.xml @@ -112,6 +112,12 @@ yudao-spring-boot-starter-protection + + cn.iocoder.boot + yudao-module-ea-biz + 1.7.3-snapshot + +