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 fef34492..fa709ecc 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 @@ -4,5 +4,5 @@ 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 + ErrorCode ELECTRONIC_CONTRACTS_NOT_EXISTS = new ErrorCode(300011, "合同档案不存在"); +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/ElectronicContractsController.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/ElectronicContractsController.java new file mode 100644 index 00000000..c98f83f6 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/ElectronicContractsController.java @@ -0,0 +1,102 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts; + +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.electroniccontracts.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts.ElectronicContractsDO; +import cn.iocoder.yudao.module.ea.convert.electroniccontracts.ElectronicContractsConvert; +import cn.iocoder.yudao.module.ea.service.electroniccontracts.ElectronicContractsService; + +@Tag(name = "管理后台 - 合同档案") +@RestController +@RequestMapping("/ea/electronic-contracts") +@Validated +public class ElectronicContractsController { + + @Resource + private ElectronicContractsService electronicContractsService; + + @PostMapping("/create") + @Operation(summary = "创建合同档案") + @PreAuthorize("@ss.hasPermission('ea:electronic-contracts:create')") + public CommonResult createElectronicContracts(@Valid @RequestBody ElectronicContractsCreateReqVO createReqVO) { + return success(electronicContractsService.createElectronicContracts(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新合同档案") + @PreAuthorize("@ss.hasPermission('ea:electronic-contracts:update')") + public CommonResult updateElectronicContracts(@Valid @RequestBody ElectronicContractsUpdateReqVO updateReqVO) { + electronicContractsService.updateElectronicContracts(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除合同档案") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('ea:electronic-contracts:delete')") + public CommonResult deleteElectronicContracts(@RequestParam("id") Long id) { + electronicContractsService.deleteElectronicContracts(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得合同档案") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('ea:electronic-contracts:query')") + public CommonResult getElectronicContracts(@RequestParam("id") Long id) { + ElectronicContractsDO electronicContracts = electronicContractsService.getElectronicContracts(id); + return success(ElectronicContractsConvert.INSTANCE.convert(electronicContracts)); + } + + @GetMapping("/list") + @Operation(summary = "获得合同档案列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('ea:electronic-contracts:query')") + public CommonResult> getElectronicContractsList(@RequestParam("ids") Collection ids) { + List list = electronicContractsService.getElectronicContractsList(ids); + return success(ElectronicContractsConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得合同档案分页") + @PreAuthorize("@ss.hasPermission('ea:electronic-contracts:query')") + public CommonResult> getElectronicContractsPage(@Valid ElectronicContractsPageReqVO pageVO) { + PageResult pageResult = electronicContractsService.getElectronicContractsPage(pageVO); + return success(ElectronicContractsConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出合同档案 Excel") + @PreAuthorize("@ss.hasPermission('ea:electronic-contracts:export')") + @OperateLog(type = EXPORT) + public void exportElectronicContractsExcel(@Valid ElectronicContractsExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = electronicContractsService.getElectronicContractsList(exportReqVO); + // 导出 Excel + List datas = ElectronicContractsConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "合同档案.xls", "数据", ElectronicContractsExcelVO.class, datas); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsBaseVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsBaseVO.java new file mode 100644 index 00000000..22ba4be9 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsBaseVO.java @@ -0,0 +1,94 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import javax.validation.constraints.*; + +/** + * 合同档案 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class ElectronicContractsBaseVO { + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体id", example = "15565") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "所属部门id", example = "10629") + private Long deptId; + + @Schema(description = "所属部门", example = "赵六") + private String deptName; + + @Schema(description = "合同编号") + private String contractCode; + + @Schema(description = "合同名称") + private String contractTitle; + + @Schema(description = "合同类型", example = "2") + private String contractType; + + @Schema(description = "签署方") + private String signatory; + + @Schema(description = "签署日期") + private LocalDate signDate; + + @Schema(description = "生效日期") + private LocalDate effectiveDate; + + @Schema(description = "截止日期") + private LocalDate expiryDate; + + @Schema(description = "状态", example = "1") + private String contractStatus; + + @Schema(description = "金额") + private Long contractAmount; + + @Schema(description = "附件") + private String contractAttachment; + + @Schema(description = "处理结果") + private String handleResult; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "借阅状态", example = "1") + private String borrowStatus; + + @Schema(description = "归档时间") + private String recordTime; + + @Schema(description = "纸档位置") + private String position; + + @Schema(description = "完整性") + private Integer cherks; + + @Schema(description = "归档id,一个归档id对应多个合同档案", example = "26409") + private Long recordId; + + @Schema(description = "用户id", example = "7723") + private Long userId; + + @Schema(description = "归档状态", example = "1") + private String fileStatus; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsCreateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsCreateReqVO.java new file mode 100644 index 00000000..2008c5d2 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.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 ElectronicContractsCreateReqVO extends ElectronicContractsBaseVO { + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsExcelVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsExcelVO.java new file mode 100644 index 00000000..083df6bb --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsExcelVO.java @@ -0,0 +1,102 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 合同档案 Excel VO + * + * @author 芋道源码 + */ +@Data +public class ElectronicContractsExcelVO { + + @ExcelProperty("主键") + private Long id; + + @ExcelProperty("制单人") + private String createBy; + + @ExcelProperty("创建日期") + private LocalDateTime createTime; + + @ExcelProperty("业务实体id") + private Long companyId; + + @ExcelProperty("业务实体") + private String company; + + @ExcelProperty("所属部门id") + private Long deptId; + + @ExcelProperty("所属部门") + private String deptName; + + @ExcelProperty("合同编号") + private String contractCode; + + @ExcelProperty("合同名称") + private String contractTitle; + + @ExcelProperty("合同类型") + private String contractType; + + @ExcelProperty("签署方") + private String signatory; + + @ExcelProperty("签署日期") + private LocalDate signDate; + + @ExcelProperty("生效日期") + private LocalDate effectiveDate; + + @ExcelProperty("截止日期") + private LocalDate expiryDate; + + @ExcelProperty("状态") + private String contractStatus; + + @ExcelProperty("金额") + private Long contractAmount; + + @ExcelProperty("附件") + private String contractAttachment; + + @ExcelProperty("处理结果") + private String handleResult; + + @ExcelProperty("年度") + private String year; + + @ExcelProperty("月份") + private String period; + + @ExcelProperty("借阅状态") + private String borrowStatus; + + @ExcelProperty("归档时间") + private String recordTime; + + @ExcelProperty("纸档位置") + private String position; + + @ExcelProperty("完整性") + private Integer cherks; + + @ExcelProperty("归档id,一个归档id对应多个合同档案") + private Long recordId; + + @ExcelProperty("用户id") + private Long userId; + + @ExcelProperty("归档状态") + private String fileStatus; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsExportReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsExportReqVO.java new file mode 100644 index 00000000..8388f070 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsExportReqVO.java @@ -0,0 +1,101 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo; + +import lombok.*; + +import java.time.LocalDate; +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,参数和 ElectronicContractsPageReqVO 是一致的") +@Data +public class ElectronicContractsExportReqVO { + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "创建日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "业务实体id", example = "15565") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "所属部门id", example = "10629") + private Long deptId; + + @Schema(description = "所属部门", example = "赵六") + private String deptName; + + @Schema(description = "合同编号") + private String contractCode; + + @Schema(description = "合同名称") + private String contractTitle; + + @Schema(description = "合同类型", example = "2") + private String contractType; + + @Schema(description = "签署方") + private String signatory; + + @Schema(description = "签署日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDate[] signDate; + + @Schema(description = "生效日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDate[] effectiveDate; + + @Schema(description = "截止日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDate[] expiryDate; + + @Schema(description = "状态", example = "1") + private String contractStatus; + + @Schema(description = "金额") + private Long contractAmount; + + @Schema(description = "附件") + private String contractAttachment; + + @Schema(description = "处理结果") + private String handleResult; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "借阅状态", example = "1") + private String borrowStatus; + + @Schema(description = "归档时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] recordTime; + + @Schema(description = "纸档位置") + private String position; + + @Schema(description = "完整性") + private Integer cherks; + + @Schema(description = "归档id,一个归档id对应多个合同档案", example = "26409") + private Long recordId; + + @Schema(description = "用户id", example = "7723") + private Long userId; + + @Schema(description = "归档状态", example = "1") + private String fileStatus; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsPageReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsPageReqVO.java new file mode 100644 index 00000000..82948511 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsPageReqVO.java @@ -0,0 +1,103 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo; + +import lombok.*; + +import java.time.LocalDate; +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 ElectronicContractsPageReqVO extends PageParam { + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "创建日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "业务实体id", example = "15565") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "所属部门id", example = "10629") + private Long deptId; + + @Schema(description = "所属部门", example = "赵六") + private String deptName; + + @Schema(description = "合同编号") + private String contractCode; + + @Schema(description = "合同名称") + private String contractTitle; + + @Schema(description = "合同类型", example = "2") + private String contractType; + + @Schema(description = "签署方") + private String signatory; + + @Schema(description = "签署日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDate[] signDate; + + @Schema(description = "生效日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDate[] effectiveDate; + + @Schema(description = "截止日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDate[] expiryDate; + + @Schema(description = "状态", example = "1") + private String contractStatus; + + @Schema(description = "金额") + private Long contractAmount; + + @Schema(description = "附件") + private String contractAttachment; + + @Schema(description = "处理结果") + private String handleResult; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "借阅状态", example = "1") + private String borrowStatus; + + @Schema(description = "归档时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] recordTime; + + @Schema(description = "纸档位置") + private String position; + + @Schema(description = "完整性") + private Integer cherks; + + @Schema(description = "归档id,一个归档id对应多个合同档案", example = "26409") + private Long recordId; + + @Schema(description = "用户id", example = "7723") + private Long userId; + + @Schema(description = "归档状态", example = "1") + private String fileStatus; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsRespVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsRespVO.java new file mode 100644 index 00000000..dfe99fc1 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.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 ElectronicContractsRespVO extends ElectronicContractsBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32308") + 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/electroniccontracts/vo/ElectronicContractsUpdateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsUpdateReqVO.java new file mode 100644 index 00000000..27085a66 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccontracts/vo/ElectronicContractsUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.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 ElectronicContractsUpdateReqVO extends ElectronicContractsBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32308") + @NotNull(message = "主键不能为空") + private Long id; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electroniccontracts/ElectronicContractsConvert.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electroniccontracts/ElectronicContractsConvert.java new file mode 100644 index 00000000..d5708c32 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electroniccontracts/ElectronicContractsConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.ea.convert.electroniccontracts; + +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.electroniccontracts.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts.ElectronicContractsDO; + +/** + * 合同档案 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ElectronicContractsConvert { + + ElectronicContractsConvert INSTANCE = Mappers.getMapper(ElectronicContractsConvert.class); + + ElectronicContractsDO convert(ElectronicContractsCreateReqVO bean); + + ElectronicContractsDO convert(ElectronicContractsUpdateReqVO bean); + + ElectronicContractsRespVO convert(ElectronicContractsDO 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/electroniccontracts/ElectronicContractsDO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electroniccontracts/ElectronicContractsDO.java new file mode 100644 index 00000000..281f9469 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electroniccontracts/ElectronicContractsDO.java @@ -0,0 +1,132 @@ +package cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts; + +import lombok.*; + +import java.time.LocalDate; +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_contracts") +@KeySequence("ea_electronic_contracts_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ElectronicContractsDO extends BaseDO { + + /** + * 主键 + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 制单人 + */ + private String createBy; + /** + * 业务实体id + */ + private Long companyId; + /** + * 业务实体 + */ + private String company; + /** + * 所属部门id + */ + private Long deptId; + /** + * 所属部门 + */ + private String deptName; + /** + * 合同编号 + */ + private String contractCode; + /** + * 合同名称 + */ + private String contractTitle; + /** + * 合同类型 + */ + private String contractType; + /** + * 签署方 + */ + private String signatory; + /** + * 签署日期 + */ + private LocalDate signDate; + /** + * 生效日期 + */ + private LocalDate effectiveDate; + /** + * 截止日期 + */ + private LocalDate expiryDate; + /** + * 状态 + */ + private String contractStatus; + /** + * 金额 + */ + private Long contractAmount; + /** + * 附件 + */ + private String contractAttachment; + /** + * 处理结果 + */ + private String handleResult; + /** + * 年度 + */ + private String year; + /** + * 月份 + */ + private String period; + /** + * 借阅状态 + */ + private String borrowStatus; + /** + * 归档时间 + */ + private String recordTime; + /** + * 纸档位置 + */ + private String position; + /** + * 完整性 + */ + private Integer cherks; + /** + * 归档id,一个归档id对应多个合同档案 + */ + private Long recordId; + /** + * 用户id + */ + private Long userId; + /** + * 归档状态 + */ + private String fileStatus; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electroniccontracts/ElectronicContractsMapper.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electroniccontracts/ElectronicContractsMapper.java new file mode 100644 index 00000000..c41cbbd0 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electroniccontracts/ElectronicContractsMapper.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.ea.dal.mysql.electroniccontracts; + +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.electroniccontracts.ElectronicContractsDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo.*; + +/** + * 合同档案 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ElectronicContractsMapper extends BaseMapperX { + + default PageResult selectPage(ElectronicContractsPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ElectronicContractsDO::getCreateBy, reqVO.getCreateBy()) + .betweenIfPresent(ElectronicContractsDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ElectronicContractsDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(ElectronicContractsDO::getCompany, reqVO.getCompany()) + .eqIfPresent(ElectronicContractsDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(ElectronicContractsDO::getDeptName, reqVO.getDeptName()) + .eqIfPresent(ElectronicContractsDO::getContractCode, reqVO.getContractCode()) + .eqIfPresent(ElectronicContractsDO::getContractTitle, reqVO.getContractTitle()) + .eqIfPresent(ElectronicContractsDO::getContractType, reqVO.getContractType()) + .eqIfPresent(ElectronicContractsDO::getSignatory, reqVO.getSignatory()) + .betweenIfPresent(ElectronicContractsDO::getSignDate, reqVO.getSignDate()) + .betweenIfPresent(ElectronicContractsDO::getEffectiveDate, reqVO.getEffectiveDate()) + .betweenIfPresent(ElectronicContractsDO::getExpiryDate, reqVO.getExpiryDate()) + .eqIfPresent(ElectronicContractsDO::getContractStatus, reqVO.getContractStatus()) + .eqIfPresent(ElectronicContractsDO::getContractAmount, reqVO.getContractAmount()) + .eqIfPresent(ElectronicContractsDO::getContractAttachment, reqVO.getContractAttachment()) + .eqIfPresent(ElectronicContractsDO::getHandleResult, reqVO.getHandleResult()) + .eqIfPresent(ElectronicContractsDO::getYear, reqVO.getYear()) + .eqIfPresent(ElectronicContractsDO::getPeriod, reqVO.getPeriod()) + .eqIfPresent(ElectronicContractsDO::getBorrowStatus, reqVO.getBorrowStatus()) + .betweenIfPresent(ElectronicContractsDO::getRecordTime, reqVO.getRecordTime()) + .eqIfPresent(ElectronicContractsDO::getPosition, reqVO.getPosition()) + .eqIfPresent(ElectronicContractsDO::getCherks, reqVO.getCherks()) + .eqIfPresent(ElectronicContractsDO::getRecordId, reqVO.getRecordId()) + .eqIfPresent(ElectronicContractsDO::getUserId, reqVO.getUserId()) + .eqIfPresent(ElectronicContractsDO::getFileStatus, reqVO.getFileStatus()) + .orderByDesc(ElectronicContractsDO::getId)); + } + + default List selectList(ElectronicContractsExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(ElectronicContractsDO::getCreateBy, reqVO.getCreateBy()) + .betweenIfPresent(ElectronicContractsDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ElectronicContractsDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(ElectronicContractsDO::getCompany, reqVO.getCompany()) + .eqIfPresent(ElectronicContractsDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(ElectronicContractsDO::getDeptName, reqVO.getDeptName()) + .eqIfPresent(ElectronicContractsDO::getContractCode, reqVO.getContractCode()) + .eqIfPresent(ElectronicContractsDO::getContractTitle, reqVO.getContractTitle()) + .eqIfPresent(ElectronicContractsDO::getContractType, reqVO.getContractType()) + .eqIfPresent(ElectronicContractsDO::getSignatory, reqVO.getSignatory()) + .betweenIfPresent(ElectronicContractsDO::getSignDate, reqVO.getSignDate()) + .betweenIfPresent(ElectronicContractsDO::getEffectiveDate, reqVO.getEffectiveDate()) + .betweenIfPresent(ElectronicContractsDO::getExpiryDate, reqVO.getExpiryDate()) + .eqIfPresent(ElectronicContractsDO::getContractStatus, reqVO.getContractStatus()) + .eqIfPresent(ElectronicContractsDO::getContractAmount, reqVO.getContractAmount()) + .eqIfPresent(ElectronicContractsDO::getContractAttachment, reqVO.getContractAttachment()) + .eqIfPresent(ElectronicContractsDO::getHandleResult, reqVO.getHandleResult()) + .eqIfPresent(ElectronicContractsDO::getYear, reqVO.getYear()) + .eqIfPresent(ElectronicContractsDO::getPeriod, reqVO.getPeriod()) + .eqIfPresent(ElectronicContractsDO::getBorrowStatus, reqVO.getBorrowStatus()) + .betweenIfPresent(ElectronicContractsDO::getRecordTime, reqVO.getRecordTime()) + .eqIfPresent(ElectronicContractsDO::getPosition, reqVO.getPosition()) + .eqIfPresent(ElectronicContractsDO::getCherks, reqVO.getCherks()) + .eqIfPresent(ElectronicContractsDO::getRecordId, reqVO.getRecordId()) + .eqIfPresent(ElectronicContractsDO::getUserId, reqVO.getUserId()) + .eqIfPresent(ElectronicContractsDO::getFileStatus, reqVO.getFileStatus()) + .orderByDesc(ElectronicContractsDO::getId)); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccontracts/ElectronicContractsService.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccontracts/ElectronicContractsService.java new file mode 100644 index 00000000..90592a45 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccontracts/ElectronicContractsService.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.ea.service.electroniccontracts; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts.ElectronicContractsDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 合同档案 Service 接口 + * + * @author 芋道源码 + */ +public interface ElectronicContractsService { + + /** + * 创建合同档案 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createElectronicContracts(@Valid ElectronicContractsCreateReqVO createReqVO); + + /** + * 更新合同档案 + * + * @param updateReqVO 更新信息 + */ + void updateElectronicContracts(@Valid ElectronicContractsUpdateReqVO updateReqVO); + + /** + * 删除合同档案 + * + * @param id 编号 + */ + void deleteElectronicContracts(Long id); + + /** + * 获得合同档案 + * + * @param id 编号 + * @return 合同档案 + */ + ElectronicContractsDO getElectronicContracts(Long id); + + /** + * 获得合同档案列表 + * + * @param ids 编号 + * @return 合同档案列表 + */ + List getElectronicContractsList(Collection ids); + + /** + * 获得合同档案分页 + * + * @param pageReqVO 分页查询 + * @return 合同档案分页 + */ + PageResult getElectronicContractsPage(ElectronicContractsPageReqVO pageReqVO); + + /** + * 获得合同档案列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 合同档案列表 + */ + List getElectronicContractsList(ElectronicContractsExportReqVO exportReqVO); + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccontracts/ElectronicContractsServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccontracts/ElectronicContractsServiceImpl.java new file mode 100644 index 00000000..1051c0b1 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccontracts/ElectronicContractsServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.ea.service.electroniccontracts; + +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.electroniccontracts.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts.ElectronicContractsDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.ea.convert.electroniccontracts.ElectronicContractsConvert; +import cn.iocoder.yudao.module.ea.dal.mysql.electroniccontracts.ElectronicContractsMapper; + +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 ElectronicContractsServiceImpl implements ElectronicContractsService { + + @Resource + private ElectronicContractsMapper electronicContractsMapper; + + @Override + public Long createElectronicContracts(ElectronicContractsCreateReqVO createReqVO) { + // 插入 + ElectronicContractsDO electronicContracts = ElectronicContractsConvert.INSTANCE.convert(createReqVO); + electronicContractsMapper.insert(electronicContracts); + // 返回 + return electronicContracts.getId(); + } + + @Override + public void updateElectronicContracts(ElectronicContractsUpdateReqVO updateReqVO) { + // 校验存在 + validateElectronicContractsExists(updateReqVO.getId()); + // 更新 + ElectronicContractsDO updateObj = ElectronicContractsConvert.INSTANCE.convert(updateReqVO); + electronicContractsMapper.updateById(updateObj); + } + + @Override + public void deleteElectronicContracts(Long id) { + // 校验存在 + validateElectronicContractsExists(id); + // 删除 + electronicContractsMapper.deleteById(id); + } + + private void validateElectronicContractsExists(Long id) { + if (electronicContractsMapper.selectById(id) == null) { + throw exception(ELECTRONIC_CONTRACTS_NOT_EXISTS); + } + } + + @Override + public ElectronicContractsDO getElectronicContracts(Long id) { + return electronicContractsMapper.selectById(id); + } + + @Override + public List getElectronicContractsList(Collection ids) { + return electronicContractsMapper.selectBatchIds(ids); + } + + @Override + public PageResult getElectronicContractsPage(ElectronicContractsPageReqVO pageReqVO) { + return electronicContractsMapper.selectPage(pageReqVO); + } + + @Override + public List getElectronicContractsList(ElectronicContractsExportReqVO exportReqVO) { + return electronicContractsMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electroniccontracts/ElectronicContractsMapper.xml b/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electroniccontracts/ElectronicContractsMapper.xml new file mode 100644 index 00000000..77074f46 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electroniccontracts/ElectronicContractsMapper.xml @@ -0,0 +1,12 @@ + + + + + + +