diff --git a/sql/accounting20230921JilingLee.sql b/sql/accounting20230921JilingLee.sql index f23c1174..1fd81dc4 100644 --- a/sql/accounting20230921JilingLee.sql +++ b/sql/accounting20230921JilingLee.sql @@ -79,8 +79,8 @@ CREATE TABLE `accounting_invoices` ( SET FOREIGN_KEY_CHECKS = 1; -- 插入发票菜单 -SELECT * FROM `system_menu` WHERE `name`='会计档案'; -SET @menuId = LAST_INSERT_ID(); +SELECT `id` INTO @menuId FROM `system_menu` WHERE `name`='会计档案'; + INSERT INTO `lyr-one`.`system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('发票管理', '', 2, 0, @menuId, 'invoices', '', 'accounting/invoices/index', 'Invoices', 0, b'1', b'1', b'1', '', '2023-09-20 14:03:48', '', '2023-09-20 14:03:48', b'0'); SET @menuId2 = LAST_INSERT_ID(); INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '发票查询', 'accounting:invoices:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-20 14:03:48', '', '2023-09-20 14:03:48', b'0'); diff --git a/sql/archives20230914JilingLee.sql b/sql/archives20230914JilingLee.sql index c6bad429..9931ed3f 100644 --- a/sql/archives20230914JilingLee.sql +++ b/sql/archives20230914JilingLee.sql @@ -60,8 +60,8 @@ CREATE TABLE `archives_turn_over` ( SET FOREIGN_KEY_CHECKS = 1; -- 插入档案移交菜单 -SELECT * FROM system_menu WHERE name='档案管理'; -SET @menuId = LAST_INSERT_ID(); +SELECT `id` INTO @menuId FROM system_menu WHERE name='档案管理'; + INSERT INTO `lyr-one`.`system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('移交管理', '', 2, 0, @menuId, 'turn-over', '', 'archives/turnOver/index', 'TurnOver', 0, b'1', b'1', b'1', '', '2023-09-13 14:05:07', '', '2023-09-13 14:10:33', b'0'); SET @menuId2 = LAST_INSERT_ID(); INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '移交管理查询', 'archives:turn-over:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-13 14:05:07', '', '2023-09-13 14:05:07', b'0'); diff --git a/sql/archives20230915JilingLee.sql b/sql/archives20230915JilingLee.sql index 5ce4aaef..15ee54b7 100644 --- a/sql/archives20230915JilingLee.sql +++ b/sql/archives20230915JilingLee.sql @@ -44,8 +44,8 @@ CREATE TABLE `archives_package` ( SET FOREIGN_KEY_CHECKS = 1; -- 插入装册管理菜单 -SELECT * FROM system_menu WHERE name='档案管理'; -SET @menuId = LAST_INSERT_ID(); +SELECT `id` INTO @menuId FROM system_menu WHERE name='档案管理'; + INSERT INTO `lyr-one`.`system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('装册管理', '', 2, 0, @menuId, 'packages', '', 'archives/packages/index', 'Packages', 0, b'1', b'1', b'1', '', '2023-09-15 13:20:18', '', '2023-09-15 13:20:18', b'0'); SET @menuId2 = LAST_INSERT_ID(); INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '装册查询', 'archives:packages:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-15 13:20:18', '', '2023-09-15 13:20:18', b'0'); diff --git a/sql/contracts20230922zK.sql b/sql/contracts20230922zK.sql new file mode 100644 index 00000000..6dfd1719 --- /dev/null +++ b/sql/contracts20230922zK.sql @@ -0,0 +1,119 @@ + +SET FOREIGN_KEY_CHECKS=0; + +-- ---------------------------- +-- 合同档案 for ea_electronic_contracts +-- ---------------------------- +DROP TABLE IF EXISTS `ea_electronic_contracts`; +CREATE TABLE `ea_electronic_contracts` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', + `create_by` varchar(20) DEFAULT NULL COMMENT '制单人', + `creator` varchar(20) DEFAULT NULL COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建日期', + `company_id` bigint unsigned DEFAULT NULL COMMENT '业务实体id', + `company` varchar(30) DEFAULT NULL COMMENT '业务实体', + `update_time` datetime DEFAULT NULL COMMENT '更新日期', + `dept_id` bigint DEFAULT NULL COMMENT '所属部门id', + `dept_name` varchar(30) DEFAULT NULL COMMENT '所属部门', + `contract_code` varchar(64) DEFAULT NULL COMMENT '合同编号', + `contract_title` varchar(100) DEFAULT NULL COMMENT '合同名称', + `contract_type` varchar(50) DEFAULT NULL COMMENT '合同类型', + `signatory` varchar(50) DEFAULT NULL COMMENT '签署方', + `sign_date` date DEFAULT NULL COMMENT '签署日期', + `effective_date` date DEFAULT NULL COMMENT '生效日期', + `expiry_date` date DEFAULT NULL COMMENT '截止日期', + `contract_status` varchar(50) DEFAULT NULL COMMENT '状态', + `contract_amount` decimal(10,0) DEFAULT NULL COMMENT '金额', + `contract_attachment` varchar(200) DEFAULT NULL COMMENT '附件', + `handle_result` varchar(500) DEFAULT NULL COMMENT '处理结果', + `year` varchar(20) DEFAULT NULL COMMENT '年度', + `period` varchar(20) DEFAULT NULL COMMENT '月份', + `borrow_status` varchar(2) DEFAULT NULL COMMENT '借阅状态', + `record_time` varchar(20) DEFAULT NULL COMMENT '归档时间', + `position` varchar(255) DEFAULT NULL COMMENT '纸档位置', + `cherks` int DEFAULT NULL COMMENT '完整性', + `record_id` bigint DEFAULT NULL COMMENT '归档id,一个归档id对应多个合同档案', + `user_id` bigint DEFAULT NULL COMMENT '用户id', + `deleted` bit(1) DEFAULT b'0' COMMENT '是否删除', + `updater` varchar(20) DEFAULT NULL COMMENT '更新者', + `file_status` varchar(64) DEFAULT NULL COMMENT '归档状态', + `tenant_id` bigint NOT NULL COMMENT '租户编号,一个集团/总公司对应一个租户', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='合同档案'; + +-- ---------------------------- +-- 员工档案 for ea_electronic_employee +-- ---------------------------- +DROP TABLE IF EXISTS `ea_electronic_employee`; +CREATE TABLE `ea_electronic_employee` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', + `create_by` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '制单人', + `creator` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建日期', + `company_id` bigint DEFAULT NULL COMMENT '业务实体id', + `company` varchar(30) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '业务实体', + `update_time` datetime DEFAULT NULL COMMENT '更新日期', + `dept_id` bigint DEFAULT NULL COMMENT '所属部门id', + `dept_name` varchar(30) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属部门', + `name` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '员工姓名', + `gender` varchar(10) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '性别', + `birthdate` date DEFAULT NULL COMMENT '出生日期', + `nationality` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '国籍', + `address` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '地址', + `contact_number` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '联系方式', + `id_card_number` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '身份证号', + `passport_number` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '护照号码', + `graduation_school` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '毕业学校', + `major` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '专业', + `education` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '学历', + `education_experience` text COLLATE utf8mb4_general_ci COMMENT '教育经历', + `work_experience` text COLLATE utf8mb4_general_ci COMMENT '工作经历', + `job_title` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '职位', + `job_level` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '职位级别', + `job_description` text COLLATE utf8mb4_general_ci COMMENT '职位描述', + `salary` decimal(10,0) DEFAULT NULL COMMENT '薪酬', + `health_condition` text COLLATE utf8mb4_general_ci COMMENT '身体状况', + `medical_records` text COLLATE utf8mb4_general_ci COMMENT '体检记录', + `disease_history` text COLLATE utf8mb4_general_ci COMMENT '疾病史', + `social_insurance` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '养老保险', + `pension_insurance` decimal(10,0) DEFAULT NULL COMMENT '医疗保险', + `medical_insurance` decimal(10,0) DEFAULT NULL COMMENT '失业保险', + `unemployment_insurance` decimal(10,0) DEFAULT NULL COMMENT '失业保险', + `work_injury_insurance` decimal(10,0) DEFAULT NULL COMMENT '工伤保险', + `leave_records` text COLLATE utf8mb4_general_ci COMMENT '考核评价', + `overtime_records` text COLLATE utf8mb4_general_ci COMMENT '奖惩记录', + `welfare_benefits` text COLLATE utf8mb4_general_ci COMMENT '培训计划', + `performance_evaluation` text COLLATE utf8mb4_general_ci COMMENT '培训成果', + `rewards_punishments` text COLLATE utf8mb4_general_ci COMMENT '个人标签', + `training_records` text COLLATE utf8mb4_general_ci COMMENT '兴趣爱好', + `personal_description` text COLLATE utf8mb4_general_ci COMMENT '特长', + `year` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '年度', + `period` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '月份', + `borrow_status` varchar(2) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '借阅状态', + `record_time` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '归档时间', + `position` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '纸档位置', + `cherks` int DEFAULT NULL COMMENT '完整性', + `record_id` bigint DEFAULT NULL COMMENT '归档id', + `user_id` bigint DEFAULT NULL COMMENT '用户id', + `deleted` bit(1) DEFAULT b'0' COMMENT '是否删除', + `updater` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新者', + `file_status` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '归档状态', + `tenant_id` bigint NOT NULL COMMENT '租户编号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='员工档案'; + +-- 合同档案菜单权限 +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2415', '合同档案', '', '2', '0', '2383', 'electronic-contracts', 'clipboard', 'ea/electronicContracts/index', 'ElectronicContracts', '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 15:45:07', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2416', '合同档案查询', 'ea:electronic-contracts:query', '3', '1', '2415', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2417', '合同档案创建', 'ea:electronic-contracts:create', '3', '2', '2415', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2418', '合同档案更新', 'ea:electronic-contracts:update', '3', '3', '2415', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2419', '合同档案删除', 'ea:electronic-contracts:delete', '3', '4', '2415', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2420', '合同档案导出', 'ea:electronic-contracts:export', '3', '5', '2415', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-20 11:29:50', '', '2023-09-20 11:29:50', b'0'); + +-- 员工档案菜单权限 +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2439', '员工档案', '', '2', '0', '2383', 'electronic-employee', 'clipboard', 'ea/electronicEmployee/index', 'ElectronicEmployee', '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2440', '员工档案查询', 'ea:electronic-employee:query', '3', '1', '2439', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2441', '员工档案创建', 'ea:electronic-employee:create', '3', '2', '2439', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2442', '员工档案更新', 'ea:electronic-employee:update', '3', '3', '2439', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2443', '员工档案删除', 'ea:electronic-employee:delete', '3', '4', '2439', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); +INSERT INTO `lyr-one`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('2444', '员工档案导出', 'ea:electronic-employee:export', '3', '5', '2439', '', '', '', NULL, '0', b'1', b'1', b'1', '', '2023-09-22 14:53:59', '', '2023-09-22 14:53:59', b'0'); diff --git a/sql/setting20230918JilingLee.sql b/sql/setting20230918JilingLee.sql index ccea8467..697c1f24 100644 --- a/sql/setting20230918JilingLee.sql +++ b/sql/setting20230918JilingLee.sql @@ -29,8 +29,8 @@ CREATE TABLE `setting_password` ( SET FOREIGN_KEY_CHECKS = 1; -- 插入数据密码菜单 -SELECT * FROM system_menu WHERE name='档案设置'; -SET @menuId = LAST_INSERT_ID(); +SELECT `id` INTO @menuId FROM system_menu WHERE name='档案设置'; + INSERT INTO `lyr-one`.`system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('数据密码管理', '', 2, 0, @menuId, 'passwords', '', 'setting/passwords/index', 'Passwords', 0, b'1', b'1', b'1', '', '2023-09-18 13:52:08', '', '2023-09-18 13:52:08', b'0'); SET @menuId2 = LAST_INSERT_ID(); INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '数据密码查询', 'setting:passwords:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-18 13:52:08', '', '2023-09-18 13:52:08', b'0'); diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java index 25518037..fd3483fb 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/InvoicesController.java @@ -3,13 +3,18 @@ package cn.iocoder.yudao.module.accounting.controller.admin.invoices; import cn.hutool.core.io.IoUtil; import cn.iocoder.yudao.framework.common.util.FileUtils; import cn.iocoder.yudao.framework.common.util.barcode.BarcodeUtil; +import cn.iocoder.yudao.module.accounting.controller.admin.listener.DemoDataListener; +import cn.iocoder.yudao.module.accounting.controller.admin.listener.InvoicesImportListener; import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.BaiduInvoicesDO; import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.Converter; import cn.iocoder.yudao.module.accounting.enums.AccountingStatusEnum; import cn.iocoder.yudao.module.bs.utils.BaiduOcrHandler; import cn.iocoder.yudao.module.infra.service.file.FileService; +import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONObject; +import liquibase.pro.packaged.A; import me.zhyd.oauth.log.Log; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -23,12 +28,14 @@ import io.swagger.v3.oas.annotations.Operation; import javax.validation.*; import javax.servlet.http.*; import java.io.File; +import java.io.InputStream; 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.error; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; @@ -125,11 +132,23 @@ public class InvoicesController { String fileExtension = originalFileName.substring(lastDotIndex + 1); JSONObject ocrResult = null; //发票识别 - if (fileExtension.equalsIgnoreCase("ofd")) { - ocrResult = BaiduOcrHandler.invoiceOCR(imageBase64Param, "ofd"); - } - if (fileExtension.equalsIgnoreCase("pdf")) { - ocrResult = BaiduOcrHandler.invoiceOCR(imageBase64Param, "pdf"); + switch (fileExtension.toLowerCase()) { + case "ofd": + ocrResult = BaiduOcrHandler.invoiceOCR(imageBase64Param, "ofd"); + break; + case "pdf": + ocrResult = BaiduOcrHandler.invoiceOCR(imageBase64Param, "pdf"); + break; + default: + // 获取文件大小(以字节为单位) + long fileSize = multipartFile.getSize(); + // 判断文件大小是否小于6MB + if (fileSize < 6 * 1024 * 1024) { + ocrResult = BaiduOcrHandler.invoiceOCR(imageBase64Param, "image"); + } else { + return error("图像数据,base64编码后进行urlencode,要求base64编码和urlencode后大小不超过6M,最短边至少15px,最长边最大4096px,支持jpg/jpeg/png/bmp格式"); + } + } BaiduInvoicesDO parse = JSONObject.toJavaObject(ocrResult, BaiduInvoicesDO.class); InvoicesCreateReqVO invoicesDO = Converter.convertInvoiceToInvoicesDO(parse); @@ -159,19 +178,18 @@ public class InvoicesController { queryIn.setInvoiceCode(invoicesDO.getInvoiceCode()); queryIn.setInvoiceNum(invoicesDO.getInvoiceNum()); List invoicesList = invoicesService.getInvoicesList(queryIn); - if (invoicesList.size()>0){ + if (invoicesList.size() > 0) { invoicesDO.setDuplicateMark(Byte.valueOf(AccountingStatusEnum.DUPLICATE_INVOICE.getValue())); - }else { + } else { invoicesDO.setDuplicateMark(Byte.valueOf(AccountingStatusEnum.UN_DUPLICATE_INVOICE.getValue())); } - String url=""; + String url = ""; if (fileExtension.equalsIgnoreCase("ofd")) { - url = getUrl(multipartFile, UUID.randomUUID()+".ofd", "ofd"); - }else { + url = getUrl(multipartFile, UUID.randomUUID() + ".ofd", "ofd"); + } else { url = getUrl(multipartFile, "other", "other"); } invoicesDO.setFileUrl(url); - invoicesService.createInvoices(invoicesDO); return success(invoicesDO); } @@ -189,19 +207,57 @@ public class InvoicesController { return success(jsonObjectVer); } + @GetMapping("/outTemplate") + @Operation(summary = "导出发票 Excel模板") + @PreAuthorize("@ss.hasPermission('accounting:invoices:export')") + @OperateLog(type = EXPORT) + public void outTemplate(HttpServletResponse response) throws IOException { + // 导出 Excel + ExcelUtils.write(response, "发票.xls", "数据", InvoicesExcelVO.class, new ArrayList()); + } + + @GetMapping("/inTemplate") + @Operation(summary = "导入发票 Excel模板") + @PreAuthorize("@ss.hasPermission('accounting:invoices:export')") + @OperateLog(type = IMPORT) + @Transactional + public CommonResult inTemplate(@RequestParam("multipartFile") MultipartFile multipartFile) throws IOException { + // 导入 Excel + int i = 0; + InputStream inputStream = multipartFile.getInputStream(); + try { + List invoicesExcelVOList = EasyExcel.read(inputStream) + // 注册监听器,可以在这里校验字段 + .registerReadListener(new InvoicesImportListener()) + .head(InvoicesExcelVO.class) + // 设置sheet,默认读取第一个 + .sheet() + // 设置标题所在行数 + .headRowNumber(1) + .doReadSync(); + + i = invoicesService.batchInsert(invoicesExcelVOList); + } catch (Exception e) { + return error(e.getMessage()); + } + + return success(i); + } + /** * 获取发票地址 + * * @param file * @return */ - private String getUrl(MultipartFile file,String name, String path) throws Exception{ - String url=""; - if (path.equals("ofd")){ - url = fileService.createFile(name, path, IoUtil.readBytes(file.getInputStream())); - return url; - } - url = fileService.createFile(null, null, IoUtil.readBytes(file.getInputStream())); + private String getUrl(MultipartFile file, String name, String path) throws Exception { + String url = ""; + if (path.equals("ofd")) { + url = fileService.createFile(name, path, IoUtil.readBytes(file.getInputStream())); return url; + } + url = fileService.createFile(null, null, IoUtil.readBytes(file.getInputStream())); + return url; } } diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/vo/InvoicesExcelVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/vo/InvoicesExcelVO.java index 36ef3f7d..11a74b17 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/vo/InvoicesExcelVO.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/invoices/vo/InvoicesExcelVO.java @@ -9,205 +9,856 @@ import java.time.LocalDateTime; import java.time.LocalDateTime; import com.alibaba.excel.annotation.ExcelProperty; +import lombok.experimental.Accessors; /** * 发票 Excel VO * * @author 芋道源码 */ -@Data + public class InvoicesExcelVO { - @ExcelProperty("发票id") + @ExcelProperty(value = "发票id", index = 0) private Long id; - @ExcelProperty("凭证id,一个凭证对应多个电子发票") + @ExcelProperty(value = "凭证id,一个凭证对应多个电子发票",index = 1) private Long voucherId; - @ExcelProperty("发票代码") + @ExcelProperty(value = "发票代码",index = 2) private String invoiceCode; - @ExcelProperty("发票号码") + @ExcelProperty(value = "发票号码", index = 3) private String invoiceNum; - @ExcelProperty("大写金额") + @ExcelProperty(value = "大写金额", index = 4) private String amountinWords; - @ExcelProperty("单价") + @ExcelProperty(value = "单价", index = 5) private String price; - @ExcelProperty("合计税额") + @ExcelProperty(value = "合计税额", index = 6) private String totalTax; - @ExcelProperty("税率") + @ExcelProperty(value = "税率", index = 7) private String taxRate; - @ExcelProperty("金额") + @ExcelProperty(value = "金额", index = 8) private String totalAmount; - @ExcelProperty("税额") + @ExcelProperty(value = "税额", index = 9) private String commodityTax; - @ExcelProperty("价税合计") + @ExcelProperty(value = "价税合计", index = 10) private String commodityAmount; - @ExcelProperty("小写价税合计") + @ExcelProperty(value = "小写价税合计", index = 11) private String amountinFiguers; - @ExcelProperty("开票人") + @ExcelProperty(value = "开票人", index = 12) private String foteDrawer; - @ExcelProperty("销方地址电话") + @ExcelProperty(value = "销方地址电话", index = 13) private String sellerAddress; - @ExcelProperty("服务条数") + @ExcelProperty(value = "服务条数", index = 14) private String commodityNum; - @ExcelProperty("销方纳税识别号") + @ExcelProperty(value = "销方纳税识别号", index = 15) private String sellerRegisterNum; - @ExcelProperty("报送状态") + @ExcelProperty(value = "报送状态", index = 16) private String machineCode; - @ExcelProperty("备注") + @ExcelProperty(value = "备注", index = 17) private String remarks; - @ExcelProperty("销方开户行及账号") + @ExcelProperty(value = "销方开户行及账号", index = 18) private String sellerBank; - @ExcelProperty("校验码") + @ExcelProperty(value = "校验码", index = 19) private String checkCode; - @ExcelProperty("开票日期") + @ExcelProperty(value = "开票日期", index = 20) private LocalDateTime invoiceDate; - @ExcelProperty("购方税号") + @ExcelProperty(value = "购方税号", index = 21) private String purchaserRegisterNum; - @ExcelProperty("清单标志") + @ExcelProperty(value = "清单标志", index = 22) private String invoiceTypeOrg; - @ExcelProperty("密码区") + @ExcelProperty(value = "密码区", index = 23) private String password; - @ExcelProperty("打印标志") + @ExcelProperty(value = "打印标志", index = 24) private String agent; - @ExcelProperty("购方开户行及账号") + @ExcelProperty(value = "购方开户行及账号", index = 25) private String purchaserBank; - @ExcelProperty("复核人") + @ExcelProperty(value = "复核人", index = 26) private String checker; - @ExcelProperty("城市") + @ExcelProperty(value = "城市", index = 27) private String city; - @ExcelProperty("购方公司名") + @ExcelProperty(value = "购方公司名", index = 28) private String purchaserName; - @ExcelProperty("规格型号") + @ExcelProperty(value = "规格型号", index = 29) private String commodityType; - @ExcelProperty("报送日志") + @ExcelProperty(value = "报送日志", index = 30) private String province; - @ExcelProperty("发票种类") + @ExcelProperty(value = "发票种类", index = 31) private String invoiceType; - @ExcelProperty("发票联") + @ExcelProperty(value = "发票联", index = 32) private String sheetNum; - @ExcelProperty("购方地址电话") + @ExcelProperty(value = "购方地址电话", index = 33) private String purchaserAddress; - @ExcelProperty("部门") + @ExcelProperty(value = "部门", index = 34) private String commodityUnit; - @ExcelProperty("收款人") + @ExcelProperty(value = "收款人", index = 35) private String payee; - @ExcelProperty("主要商品名称") + @ExcelProperty(value = "主要商品名称", index = 36) private String commodityName; - @ExcelProperty("销方名称") + @ExcelProperty(value = "销方名称", index = 37) private String sellerName; - @ExcelProperty("审核状态0待审核1已审核2审核退回3未提交") + @ExcelProperty(value = "审核状态0待审核1已审核2审核退回3未提交", index = 38) private Byte invoiceCheck; - @ExcelProperty("是否印章0,1") + @ExcelProperty(value = "是否印章0,1", index = 39) private Byte invoiceSeal; - @ExcelProperty("发票综合代码") + @ExcelProperty(value = "发票综合代码", index = 40) private String invoiceQrcode; - @ExcelProperty("发票综合号码") + @ExcelProperty(value = "发票综合号码", index = 41) private String invoiceQrnum; - @ExcelProperty("二维码查验(1查询相符,0查验不符)") + @ExcelProperty(value = "二维码查验(1查询相符,0查验不符)", index = 42) private Byte qrCheckCode; - @ExcelProperty("发票状态1正常0作废") + @ExcelProperty(value = "发票状态1正常0作废", index = 43) private Byte invoiceState; - @ExcelProperty("作废日期") + @ExcelProperty(value = "作废日期", index = 44) private LocalDateTime printNum; - @ExcelProperty("进销项标识0进项1销项") + @ExcelProperty(value = "进销项标识0进项1销项", index = 45) private Byte inoutMark; - @ExcelProperty("作废标志0作废1启用") + @ExcelProperty(value = "作废标志0作废1启用", index = 46) private String invalidMark; - @ExcelProperty("重复标识0已查重1有重复") + @ExcelProperty(value = "重复标识0已查重1有重复", index = 47) private Byte duplicateMark; - @ExcelProperty("验真0未验真1已验证") + @ExcelProperty(value = "验真0未验真1已验证", index = 48) private Byte checkTrue; - @ExcelProperty("加密") + @ExcelProperty(value = "加密", index = 49) private String encrypt; - @ExcelProperty("制单人") + @ExcelProperty(value = "制单人", index = 50) private String createBy; - @ExcelProperty("创建时间") + @ExcelProperty(value = "创建时间", index = 51) private LocalDateTime createTime; - @ExcelProperty("归档id,一个归档id对应多个发票") + @ExcelProperty(value = "归档id,一个归档id对应多个发票", index = 52) private Long recordId; - @ExcelProperty("业务实体id") + @ExcelProperty(value = "业务实体id", index = 53) private Long companyId; - @ExcelProperty("业务实体") + @ExcelProperty(value = "业务实体", index = 54) private String company; - @ExcelProperty("所属部门id") + @ExcelProperty(value = "所属部门id", index = 55) private Long deptId; - @ExcelProperty("所属部门") + @ExcelProperty(value = "所属部门", index = 56) private String deptName; - @ExcelProperty("用户id") + @ExcelProperty(value = "用户id", index = 57) private Long userId; - @ExcelProperty("备注") + @ExcelProperty(value = "备注", index = 58) private String remark; - @ExcelProperty("预留字段1") + @ExcelProperty(value = "预留字段1", index = 59) private String attr1; - @ExcelProperty("预留字段2") + @ExcelProperty(value = "预留字段2", index = 60) private String attr2; - @ExcelProperty("预留字段3") + @ExcelProperty(value = "预留字段3", index = 61) private Integer attr3; - @ExcelProperty("预留字段4") + @ExcelProperty(value = "预留字段4", index = 62) private Integer attr4; - @ExcelProperty("归档状态") + @ExcelProperty(value = "归档状态", index = 63) private String archiveState; + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getVoucherId() { + return voucherId; + } + + public void setVoucherId(Long voucherId) { + this.voucherId = voucherId; + } + + public String getInvoiceCode() { + return invoiceCode; + } + + public void setInvoiceCode(String invoiceCode) { + this.invoiceCode = invoiceCode; + } + + public String getInvoiceNum() { + return invoiceNum; + } + + public void setInvoiceNum(String invoiceNum) { + this.invoiceNum = invoiceNum; + } + + public String getAmountinWords() { + return amountinWords; + } + + public void setAmountinWords(String amountinWords) { + this.amountinWords = amountinWords; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + + public String getTotalTax() { + return totalTax; + } + + public void setTotalTax(String totalTax) { + this.totalTax = totalTax; + } + + public String getTaxRate() { + return taxRate; + } + + public void setTaxRate(String taxRate) { + this.taxRate = taxRate; + } + + public String getTotalAmount() { + return totalAmount; + } + + public void setTotalAmount(String totalAmount) { + this.totalAmount = totalAmount; + } + + public String getCommodityTax() { + return commodityTax; + } + + public void setCommodityTax(String commodityTax) { + this.commodityTax = commodityTax; + } + + public String getCommodityAmount() { + return commodityAmount; + } + + public void setCommodityAmount(String commodityAmount) { + this.commodityAmount = commodityAmount; + } + + public String getAmountinFiguers() { + return amountinFiguers; + } + + public void setAmountinFiguers(String amountinFiguers) { + this.amountinFiguers = amountinFiguers; + } + + public String getFoteDrawer() { + return foteDrawer; + } + + public void setFoteDrawer(String foteDrawer) { + this.foteDrawer = foteDrawer; + } + + public String getSellerAddress() { + return sellerAddress; + } + + public void setSellerAddress(String sellerAddress) { + this.sellerAddress = sellerAddress; + } + + public String getCommodityNum() { + return commodityNum; + } + + public void setCommodityNum(String commodityNum) { + this.commodityNum = commodityNum; + } + + public String getSellerRegisterNum() { + return sellerRegisterNum; + } + + public void setSellerRegisterNum(String sellerRegisterNum) { + this.sellerRegisterNum = sellerRegisterNum; + } + + public String getMachineCode() { + return machineCode; + } + + public void setMachineCode(String machineCode) { + this.machineCode = machineCode; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getSellerBank() { + return sellerBank; + } + + public void setSellerBank(String sellerBank) { + this.sellerBank = sellerBank; + } + + public String getCheckCode() { + return checkCode; + } + + public void setCheckCode(String checkCode) { + this.checkCode = checkCode; + } + + public LocalDateTime getInvoiceDate() { + return invoiceDate; + } + + public void setInvoiceDate(LocalDateTime invoiceDate) { + this.invoiceDate = invoiceDate; + } + + public String getPurchaserRegisterNum() { + return purchaserRegisterNum; + } + + public void setPurchaserRegisterNum(String purchaserRegisterNum) { + this.purchaserRegisterNum = purchaserRegisterNum; + } + + public String getInvoiceTypeOrg() { + return invoiceTypeOrg; + } + + public void setInvoiceTypeOrg(String invoiceTypeOrg) { + this.invoiceTypeOrg = invoiceTypeOrg; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getAgent() { + return agent; + } + + public void setAgent(String agent) { + this.agent = agent; + } + + public String getPurchaserBank() { + return purchaserBank; + } + + public void setPurchaserBank(String purchaserBank) { + this.purchaserBank = purchaserBank; + } + + public String getChecker() { + return checker; + } + + public void setChecker(String checker) { + this.checker = checker; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getPurchaserName() { + return purchaserName; + } + + public void setPurchaserName(String purchaserName) { + this.purchaserName = purchaserName; + } + + public String getCommodityType() { + return commodityType; + } + + public void setCommodityType(String commodityType) { + this.commodityType = commodityType; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getInvoiceType() { + return invoiceType; + } + + public void setInvoiceType(String invoiceType) { + this.invoiceType = invoiceType; + } + + public String getSheetNum() { + return sheetNum; + } + + public void setSheetNum(String sheetNum) { + this.sheetNum = sheetNum; + } + + public String getPurchaserAddress() { + return purchaserAddress; + } + + public void setPurchaserAddress(String purchaserAddress) { + this.purchaserAddress = purchaserAddress; + } + + public String getCommodityUnit() { + return commodityUnit; + } + + public void setCommodityUnit(String commodityUnit) { + this.commodityUnit = commodityUnit; + } + + public String getPayee() { + return payee; + } + + public void setPayee(String payee) { + this.payee = payee; + } + + public String getCommodityName() { + return commodityName; + } + + public void setCommodityName(String commodityName) { + this.commodityName = commodityName; + } + + public String getSellerName() { + return sellerName; + } + + public void setSellerName(String sellerName) { + this.sellerName = sellerName; + } + + public Byte getInvoiceCheck() { + return invoiceCheck; + } + + public void setInvoiceCheck(Byte invoiceCheck) { + this.invoiceCheck = invoiceCheck; + } + + public Byte getInvoiceSeal() { + return invoiceSeal; + } + + public void setInvoiceSeal(Byte invoiceSeal) { + this.invoiceSeal = invoiceSeal; + } + + public String getInvoiceQrcode() { + return invoiceQrcode; + } + + public void setInvoiceQrcode(String invoiceQrcode) { + this.invoiceQrcode = invoiceQrcode; + } + + public String getInvoiceQrnum() { + return invoiceQrnum; + } + + public void setInvoiceQrnum(String invoiceQrnum) { + this.invoiceQrnum = invoiceQrnum; + } + + public Byte getQrCheckCode() { + return qrCheckCode; + } + + public void setQrCheckCode(Byte qrCheckCode) { + this.qrCheckCode = qrCheckCode; + } + + public Byte getInvoiceState() { + return invoiceState; + } + + public void setInvoiceState(Byte invoiceState) { + this.invoiceState = invoiceState; + } + + public LocalDateTime getPrintNum() { + return printNum; + } + + public void setPrintNum(LocalDateTime printNum) { + this.printNum = printNum; + } + + public Byte getInoutMark() { + return inoutMark; + } + + public void setInoutMark(Byte inoutMark) { + this.inoutMark = inoutMark; + } + + public String getInvalidMark() { + return invalidMark; + } + + public void setInvalidMark(String invalidMark) { + this.invalidMark = invalidMark; + } + + public Byte getDuplicateMark() { + return duplicateMark; + } + + public void setDuplicateMark(Byte duplicateMark) { + this.duplicateMark = duplicateMark; + } + + public Byte getCheckTrue() { + return checkTrue; + } + + public void setCheckTrue(Byte checkTrue) { + this.checkTrue = checkTrue; + } + + public String getEncrypt() { + return encrypt; + } + + public void setEncrypt(String encrypt) { + this.encrypt = encrypt; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public Long getRecordId() { + return recordId; + } + + public void setRecordId(Long recordId) { + this.recordId = recordId; + } + + public Long getCompanyId() { + return companyId; + } + + public void setCompanyId(Long companyId) { + this.companyId = companyId; + } + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company; + } + + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getAttr1() { + return attr1; + } + + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr2() { + return attr2; + } + + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public Integer getAttr3() { + return attr3; + } + + public void setAttr3(Integer attr3) { + this.attr3 = attr3; + } + + public Integer getAttr4() { + return attr4; + } + + public void setAttr4(Integer attr4) { + this.attr4 = attr4; + } + + public String getArchiveState() { + return archiveState; + } + + public void setArchiveState(String archiveState) { + this.archiveState = archiveState; + } + + public InvoicesExcelVO(){}; + + public InvoicesExcelVO(Long id, Long voucherId, String invoiceCode, String invoiceNum, String amountinWords, String price, String totalTax, String taxRate, String totalAmount, String commodityTax, String commodityAmount, String amountinFiguers, String foteDrawer, String sellerAddress, String commodityNum, String sellerRegisterNum, String machineCode, String remarks, String sellerBank, String checkCode, LocalDateTime invoiceDate, String purchaserRegisterNum, String invoiceTypeOrg, String password, String agent, String purchaserBank, String checker, String city, String purchaserName, String commodityType, String province, String invoiceType, String sheetNum, String purchaserAddress, String commodityUnit, String payee, String commodityName, String sellerName, Byte invoiceCheck, Byte invoiceSeal, String invoiceQrcode, String invoiceQrnum, Byte qrCheckCode, Byte invoiceState, LocalDateTime printNum, Byte inoutMark, String invalidMark, Byte duplicateMark, Byte checkTrue, String encrypt, String createBy, LocalDateTime createTime, Long recordId, Long companyId, String company, Long deptId, String deptName, Long userId, String remark, String attr1, String attr2, Integer attr3, Integer attr4, String archiveState) { + this.id = id; + this.voucherId = voucherId; + this.invoiceCode = invoiceCode; + this.invoiceNum = invoiceNum; + this.amountinWords = amountinWords; + this.price = price; + this.totalTax = totalTax; + this.taxRate = taxRate; + this.totalAmount = totalAmount; + this.commodityTax = commodityTax; + this.commodityAmount = commodityAmount; + this.amountinFiguers = amountinFiguers; + this.foteDrawer = foteDrawer; + this.sellerAddress = sellerAddress; + this.commodityNum = commodityNum; + this.sellerRegisterNum = sellerRegisterNum; + this.machineCode = machineCode; + this.remarks = remarks; + this.sellerBank = sellerBank; + this.checkCode = checkCode; + this.invoiceDate = invoiceDate; + this.purchaserRegisterNum = purchaserRegisterNum; + this.invoiceTypeOrg = invoiceTypeOrg; + this.password = password; + this.agent = agent; + this.purchaserBank = purchaserBank; + this.checker = checker; + this.city = city; + this.purchaserName = purchaserName; + this.commodityType = commodityType; + this.province = province; + this.invoiceType = invoiceType; + this.sheetNum = sheetNum; + this.purchaserAddress = purchaserAddress; + this.commodityUnit = commodityUnit; + this.payee = payee; + this.commodityName = commodityName; + this.sellerName = sellerName; + this.invoiceCheck = invoiceCheck; + this.invoiceSeal = invoiceSeal; + this.invoiceQrcode = invoiceQrcode; + this.invoiceQrnum = invoiceQrnum; + this.qrCheckCode = qrCheckCode; + this.invoiceState = invoiceState; + this.printNum = printNum; + this.inoutMark = inoutMark; + this.invalidMark = invalidMark; + this.duplicateMark = duplicateMark; + this.checkTrue = checkTrue; + this.encrypt = encrypt; + this.createBy = createBy; + this.createTime = createTime; + this.recordId = recordId; + this.companyId = companyId; + this.company = company; + this.deptId = deptId; + this.deptName = deptName; + this.userId = userId; + this.remark = remark; + this.attr1 = attr1; + this.attr2 = attr2; + this.attr3 = attr3; + this.attr4 = attr4; + this.archiveState = archiveState; + } + + @Override + public String toString() { + return "InvoicesExcelVO{" + + "id=" + id + + ", voucherId=" + voucherId + + ", invoiceCode='" + invoiceCode + '\'' + + ", invoiceNum='" + invoiceNum + '\'' + + ", amountinWords='" + amountinWords + '\'' + + ", price='" + price + '\'' + + ", totalTax='" + totalTax + '\'' + + ", taxRate='" + taxRate + '\'' + + ", totalAmount='" + totalAmount + '\'' + + ", commodityTax='" + commodityTax + '\'' + + ", commodityAmount='" + commodityAmount + '\'' + + ", amountinFiguers='" + amountinFiguers + '\'' + + ", foteDrawer='" + foteDrawer + '\'' + + ", sellerAddress='" + sellerAddress + '\'' + + ", commodityNum='" + commodityNum + '\'' + + ", sellerRegisterNum='" + sellerRegisterNum + '\'' + + ", machineCode='" + machineCode + '\'' + + ", remarks='" + remarks + '\'' + + ", sellerBank='" + sellerBank + '\'' + + ", checkCode='" + checkCode + '\'' + + ", invoiceDate=" + invoiceDate + + ", purchaserRegisterNum='" + purchaserRegisterNum + '\'' + + ", invoiceTypeOrg='" + invoiceTypeOrg + '\'' + + ", password='" + password + '\'' + + ", agent='" + agent + '\'' + + ", purchaserBank='" + purchaserBank + '\'' + + ", checker='" + checker + '\'' + + ", city='" + city + '\'' + + ", purchaserName='" + purchaserName + '\'' + + ", commodityType='" + commodityType + '\'' + + ", province='" + province + '\'' + + ", invoiceType='" + invoiceType + '\'' + + ", sheetNum='" + sheetNum + '\'' + + ", purchaserAddress='" + purchaserAddress + '\'' + + ", commodityUnit='" + commodityUnit + '\'' + + ", payee='" + payee + '\'' + + ", commodityName='" + commodityName + '\'' + + ", sellerName='" + sellerName + '\'' + + ", invoiceCheck=" + invoiceCheck + + ", invoiceSeal=" + invoiceSeal + + ", invoiceQrcode='" + invoiceQrcode + '\'' + + ", invoiceQrnum='" + invoiceQrnum + '\'' + + ", qrCheckCode=" + qrCheckCode + + ", invoiceState=" + invoiceState + + ", printNum=" + printNum + + ", inoutMark=" + inoutMark + + ", invalidMark='" + invalidMark + '\'' + + ", duplicateMark=" + duplicateMark + + ", checkTrue=" + checkTrue + + ", encrypt='" + encrypt + '\'' + + ", createBy='" + createBy + '\'' + + ", createTime=" + createTime + + ", recordId=" + recordId + + ", companyId=" + companyId + + ", company='" + company + '\'' + + ", deptId=" + deptId + + ", deptName='" + deptName + '\'' + + ", userId=" + userId + + ", remark='" + remark + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + ", archiveState='" + archiveState + '\'' + + '}'; + } } diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/listener/DemoDataListener.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/listener/DemoDataListener.java new file mode 100644 index 00000000..143936d1 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/listener/DemoDataListener.java @@ -0,0 +1,89 @@ +package cn.iocoder.yudao.module.accounting.controller.admin.listener; + +import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.InvoicesExcelVO; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.metadata.CellExtra; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.read.listener.ReadListener; +import com.alibaba.excel.util.ListUtils; +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; +import java.util.Map; + +// 有个很重要的点 DemoDataListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去 +@Slf4j +public class DemoDataListener implements ReadListener { + + /** + * 每隔5条存储数据库,实际使用中可以100条,然后清理list ,方便内存回收 + */ + private static final int BATCH_COUNT = 100; + /** + * 缓存的数据 + */ + private List cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); + /** + * 假设这个是一个DAO,当然有业务逻辑这个也可以是一个service。当然如果不用存储这个对象没用。 + */ + private InvoicesExcelVO demoDAO; + + public DemoDataListener() { + // 这里是demo,所以随便new一个。实际使用如果到了spring,请使用下面的有参构造函数 + demoDAO = new InvoicesExcelVO(); + } + + /** + * 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来 + * + * @param demoDAO + */ + public DemoDataListener(InvoicesExcelVO demoDAO) { + this.demoDAO = demoDAO; + } + + @Override + public void onException(Exception exception, AnalysisContext context) throws Exception { + ReadListener.super.onException(exception, context); + } + + @Override + public void invokeHead(Map> headMap, AnalysisContext context) { + ReadListener.super.invokeHead(headMap, context); + } + + /** + * 这个每一条数据解析都会来调用 + * + * @param data one row value. Is is same as {@link AnalysisContext#readRowHolder()} + * @param context + */ + @Override + public void invoke(InvoicesExcelVO data, AnalysisContext context) { + log.info("解析到一条数据:{}", JSON.toJSONString(data)); + cachedDataList.add(data); + // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM + if (cachedDataList.size() >= BATCH_COUNT) { + // 存储完成清理 list + cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); + } + } + + @Override + public void extra(CellExtra extra, AnalysisContext context) { + ReadListener.super.extra(extra, context); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + + } + + @Override + public boolean hasNext(AnalysisContext context) { + return ReadListener.super.hasNext(context); + } + + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/listener/InvoicesImportListener.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/listener/InvoicesImportListener.java new file mode 100644 index 00000000..86d344d0 --- /dev/null +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/listener/InvoicesImportListener.java @@ -0,0 +1,63 @@ +package cn.iocoder.yudao.module.accounting.controller.admin.listener; + +import cn.iocoder.yudao.framework.common.util.string.StringUtils; +import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.InvoicesExcelVO; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.alibaba.excel.exception.ExcelDataConvertException; +import com.google.common.collect.Lists; + +import java.util.List; + +public class InvoicesImportListener extends AnalysisEventListener { + List misCodes = Lists.newArrayList(); + + /** + * 每解析一行,回调该方法 + * @param data + * @param context + */ + @Override + public void invoke(Object data, AnalysisContext context) { + String misCode = ((InvoicesExcelVO) data).getInvoiceCode(); + if (StringUtils.isEmpty(misCode)) { + throw new RuntimeException(String.format("第%s行InvoiceCode为空,请核实", context.readRowHolder().getRowIndex() + 1)); + } + if (misCodes.contains(misCodes)) { + throw new RuntimeException(String.format("第%s行InvoiceCode已重复,请核实", context.readRowHolder().getRowIndex() + 1)); + } else { + misCodes.add(misCode); + } + } + + /** + * 出现异常回调 + * @param exception + * @param context + * @throws Exception + */ + @Override + public void onException(Exception exception, AnalysisContext context) throws Exception { + // ExcelDataConvertException:当数据转换异常的时候,会抛出该异常,此处可以得知第几行,第几列的数据 + if (exception instanceof ExcelDataConvertException) { + Integer columnIndex = ((ExcelDataConvertException) exception).getColumnIndex() + 1; + Integer rowIndex = ((ExcelDataConvertException) exception).getRowIndex() + 1; + String message = "第" + rowIndex + "行,第" + columnIndex + "列" + "数据格式有误,请核实"; + throw new RuntimeException(message); + } else if (exception instanceof RuntimeException) { + throw exception; + } else { + super.onException(exception, context); + } + } + + /** + * 解析完全部回调 + * @param context + */ + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + misCodes.clear(); + } + +} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/convert/invoices/InvoicesConvert.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/convert/invoices/InvoicesConvert.java index 209189e5..d1829aae 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/convert/invoices/InvoicesConvert.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/convert/invoices/InvoicesConvert.java @@ -25,6 +25,8 @@ public interface InvoicesConvert { InvoicesRespVO convert(InvoicesDO bean); + InvoicesDO convert(InvoicesExcelVO bean); + List convertList(List list); PageResult convertPage(PageResult page); diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesService.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesService.java index 02a7e266..70dd9ed7 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesService.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesService.java @@ -67,4 +67,6 @@ public interface InvoicesService { */ List getInvoicesList(InvoicesExportReqVO exportReqVO); + int batchInsert(List invoicesList); + } diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesServiceImpl.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesServiceImpl.java index c50209dc..493d0c78 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesServiceImpl.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/invoices/InvoicesServiceImpl.java @@ -79,4 +79,18 @@ public class InvoicesServiceImpl implements InvoicesService { return invoicesMapper.selectList(exportReqVO); } + @Override + public int batchInsert(List invoicesList) { + if ( invoicesList == null ) { + return 0; + } + + List list1 = new ArrayList( invoicesList.size() ); + for ( InvoicesExcelVO invoicesExcelVO : invoicesList ) { + list1.add( InvoicesConvert.INSTANCE.convert(invoicesExcelVO ) ); + } + invoicesMapper.insertBatch(list1); + return 1; + } + } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/utils/BaiduOcrHandler.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/utils/BaiduOcrHandler.java index bbd3d2d2..6b3e9c8d 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/utils/BaiduOcrHandler.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/utils/BaiduOcrHandler.java @@ -356,8 +356,8 @@ public class BaiduOcrHandler { String jsonStr = HttpUtil.post(BaiduOcrConstant.INVOICEURL_OFD, accessToken, param); JSONObject jsonObject = JSON.parseObject(jsonStr); if (!jsonObject.containsKey("words_result")) { - log.error(baseStr+",ofd发票识别失败"+jsonObject.toString()); - throw exception("ofd发票识别失败"); + log.error("发票识别失败"+jsonObject.toString()); + throw exception("发票识别失败"+jsonObject.toString()); } return jsonObject; 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 fa709ecc..2f31367c 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 @@ -2,7 +2,11 @@ package cn.iocoder.yudao.module.ea.enums; import cn.iocoder.yudao.framework.common.exception.ErrorCode; +/** + * @author HP + */ public interface ErrorCodeConstants { ErrorCode ELECTRONIC_ASSETS_NOT_EXISTS = new ErrorCode(300010, "资产档案不存在"); ErrorCode ELECTRONIC_CONTRACTS_NOT_EXISTS = new ErrorCode(300011, "合同档案不存在"); + ErrorCode ELECTRONIC_EMPLOYEE_NOT_EXISTS = new ErrorCode(300012, "员工档案不存在"); } 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 index c98f83f6..3a1b032e 100644 --- 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 @@ -1,36 +1,36 @@ 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.common.pojo.PageResult; 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.dal.dataobject.electroniccontracts.ElectronicContractsDO; import cn.iocoder.yudao.module.ea.service.electroniccontracts.ElectronicContractsService; +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 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; +/** + * @author HP + */ @Tag(name = "管理后台 - 合同档案") @RestController -@RequestMapping("/ea/electronic-contracts") +@RequestMapping("/ea/electronicContracts") @Validated public class ElectronicContractsController { diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/ElectronicEmployeeController.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/ElectronicEmployeeController.java new file mode 100644 index 00000000..3b86c99c --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/ElectronicEmployeeController.java @@ -0,0 +1,102 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicemployee; + +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.electronicemployee.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicemployee.ElectronicEmployeeDO; +import cn.iocoder.yudao.module.ea.convert.electronicemployee.ElectronicEmployeeConvert; +import cn.iocoder.yudao.module.ea.service.electronicemployee.ElectronicEmployeeService; + +@Tag(name = "管理后台 - 员工档案") +@RestController +@RequestMapping("/ea/electronic-employee") +@Validated +public class ElectronicEmployeeController { + + @Resource + private ElectronicEmployeeService electronicEmployeeService; + + @PostMapping("/create") + @Operation(summary = "创建员工档案") + @PreAuthorize("@ss.hasPermission('ea:electronic-employee:create')") + public CommonResult createElectronicEmployee(@Valid @RequestBody ElectronicEmployeeCreateReqVO createReqVO) { + return success(electronicEmployeeService.createElectronicEmployee(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新员工档案") + @PreAuthorize("@ss.hasPermission('ea:electronic-employee:update')") + public CommonResult updateElectronicEmployee(@Valid @RequestBody ElectronicEmployeeUpdateReqVO updateReqVO) { + electronicEmployeeService.updateElectronicEmployee(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除员工档案") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('ea:electronic-employee:delete')") + public CommonResult deleteElectronicEmployee(@RequestParam("id") Long id) { + electronicEmployeeService.deleteElectronicEmployee(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得员工档案") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('ea:electronic-employee:query')") + public CommonResult getElectronicEmployee(@RequestParam("id") Long id) { + ElectronicEmployeeDO electronicEmployee = electronicEmployeeService.getElectronicEmployee(id); + return success(ElectronicEmployeeConvert.INSTANCE.convert(electronicEmployee)); + } + + @GetMapping("/list") + @Operation(summary = "获得员工档案列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('ea:electronic-employee:query')") + public CommonResult> getElectronicEmployeeList(@RequestParam("ids") Collection ids) { + List list = electronicEmployeeService.getElectronicEmployeeList(ids); + return success(ElectronicEmployeeConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得员工档案分页") + @PreAuthorize("@ss.hasPermission('ea:electronic-employee:query')") + public CommonResult> getElectronicEmployeePage(@Valid ElectronicEmployeePageReqVO pageVO) { + PageResult pageResult = electronicEmployeeService.getElectronicEmployeePage(pageVO); + return success(ElectronicEmployeeConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出员工档案 Excel") + @PreAuthorize("@ss.hasPermission('ea:electronic-employee:export')") + @OperateLog(type = EXPORT) + public void exportElectronicEmployeeExcel(@Valid ElectronicEmployeeExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = electronicEmployeeService.getElectronicEmployeeList(exportReqVO); + // 导出 Excel + List datas = ElectronicEmployeeConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "员工档案.xls", "数据", ElectronicEmployeeExcelVO.class, datas); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeBaseVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeBaseVO.java new file mode 100644 index 00000000..d3cd5c48 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeBaseVO.java @@ -0,0 +1,65 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import javax.validation.constraints.*; + +/** + * 员工档案 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class ElectronicEmployeeBaseVO { + + @Schema(description = "id" ) + private Long id; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "所属部门", example = "王五") + private String deptName; + + @Schema(description = "员工姓名", example = "张三") + private String name; + + @Schema(description = "性别") + private String gender; + + @Schema(description = "国籍") + private String nationality; + + @Schema(description = "联系方式") + private String contactNumber; + + @Schema(description = "身份证号") + private String idCardNumber; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "借阅状态", example = "2") + private String borrowStatus; + + @Schema(description = "归档时间") + private String recordTime; + + @Schema(description = "纸档位置") + private String position; + + @Schema(description = "完整性") + private Integer cherks; + + @Schema(description = "归档状态", example = "2") + private String fileStatus; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeCreateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeCreateReqVO.java new file mode 100644 index 00000000..a1ee752b --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeCreateReqVO.java @@ -0,0 +1,100 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.vo; + +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.*; + +/** + * @author HP + */ +@Schema(description = "管理后台 - 员工档案创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ElectronicEmployeeCreateReqVO extends ElectronicEmployeeBaseVO { + + @Schema(description = "出生日期") + private LocalDate birthdate; + + @Schema(description = "地址") + private String address; + + @Schema(description = "护照号码") + private String passportNumber; + + @Schema(description = "毕业学校") + private String graduationSchool; + + @Schema(description = "专业") + private String major; + + @Schema(description = "学历") + private String education; + + @Schema(description = "教育经历") + private String educationExperience; + + @Schema(description = "工作经历") + private String workExperience; + + @Schema(description = "职位") + private String jobTitle; + + @Schema(description = "职位级别") + private String jobLevel; + + @Schema(description = "职位描述", example = "你说的对") + private String jobDescription; + + @Schema(description = "薪酬") + private Long salary; + + @Schema(description = "身体状况") + private String healthCondition; + + @Schema(description = "体检记录") + private String medicalRecords; + + @Schema(description = "疾病史") + private String diseaseHistory; + + @Schema(description = "养老保险") + private String socialInsurance; + + @Schema(description = "医疗保险") + private Long pensionInsurance; + + @Schema(description = "失业保险") + private Long medicalInsurance; + + @Schema(description = "失业保险") + private Long unemploymentInsurance; + + @Schema(description = "工伤保险") + private Long workInjuryInsurance; + + @Schema(description = "考核评价") + private String leaveRecords; + + @Schema(description = "奖惩记录") + private String overtimeRecords; + + @Schema(description = "培训计划") + private String welfareBenefits; + + @Schema(description = "培训成果") + private String performanceEvaluation; + + @Schema(description = "个人标签") + private String rewardsPunishments; + + @Schema(description = "兴趣爱好") + private String trainingRecords; + + @Schema(description = "特长", example = "你说的对") + private String personalDescription; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeExcelVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeExcelVO.java new file mode 100644 index 00000000..79e68b32 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeExcelVO.java @@ -0,0 +1,69 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.vo; + +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + + +/** + * 员工档案 Excel VO + * + * @author 芋道源码 + */ +@Data +public class ElectronicEmployeeExcelVO { + + @ExcelProperty("制单人") + private String createBy; + + @ExcelProperty("创建日期") + private LocalDateTime createTime; + + @ExcelProperty("业务实体") + private String company; + + @ExcelProperty("所属部门") + private String deptName; + + @ExcelProperty("员工姓名") + private String name; + + @ExcelProperty(value = "性别", converter = DictConvert.class) + @DictFormat("system_user_sex") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 + private String gender; + + @ExcelProperty("国籍") + private String nationality; + + @ExcelProperty("联系方式") + private String contactNumber; + + @ExcelProperty("身份证号") + private String idCardNumber; + + @ExcelProperty("年度") + private String year; + + @ExcelProperty("月份") + private String period; + + @ExcelProperty(value = "借阅状态", converter = DictConvert.class) + @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 + private String borrowStatus; + + @ExcelProperty("归档时间") + private String recordTime; + + @ExcelProperty("纸档位置") + private String position; + + @ExcelProperty("完整性") + private Integer cherks; + + @ExcelProperty("归档状态") + private String fileStatus; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeExportReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeExportReqVO.java new file mode 100644 index 00000000..326652e7 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeExportReqVO.java @@ -0,0 +1,66 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.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,参数和 ElectronicEmployeePageReqVO 是一致的") +@Data +public class ElectronicEmployeeExportReqVO { + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "创建日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "所属部门", example = "王五") + private String deptName; + + @Schema(description = "员工姓名", example = "张三") + private String name; + + @Schema(description = "性别") + private String gender; + + @Schema(description = "国籍") + private String nationality; + + @Schema(description = "联系方式") + private String contactNumber; + + @Schema(description = "身份证号") + private String idCardNumber; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "借阅状态", example = "2") + 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 = "归档状态", example = "2") + private String fileStatus; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeePageReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeePageReqVO.java new file mode 100644 index 00000000..78d44f95 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeePageReqVO.java @@ -0,0 +1,68 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.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 ElectronicEmployeePageReqVO extends PageParam { + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "创建日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "所属部门", example = "王五") + private String deptName; + + @Schema(description = "员工姓名", example = "张三") + private String name; + + @Schema(description = "性别") + private String gender; + + @Schema(description = "国籍") + private String nationality; + + @Schema(description = "联系方式") + private String contactNumber; + + @Schema(description = "身份证号") + private String idCardNumber; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "借阅状态", example = "2") + 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 = "归档状态", example = "2") + private String fileStatus; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeRespVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeRespVO.java new file mode 100644 index 00000000..631b6b96 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeRespVO.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.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 ElectronicEmployeeRespVO extends ElectronicEmployeeBaseVO { + + @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/electronicemployee/vo/ElectronicEmployeeUpdateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeUpdateReqVO.java new file mode 100644 index 00000000..339012fb --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeUpdateReqVO.java @@ -0,0 +1,97 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 员工档案更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ElectronicEmployeeUpdateReqVO extends ElectronicEmployeeBaseVO { + + @Schema(description = "出生日期") + private LocalDate birthdate; + + @Schema(description = "地址") + private String address; + + @Schema(description = "护照号码") + private String passportNumber; + + @Schema(description = "毕业学校") + private String graduationSchool; + + @Schema(description = "专业") + private String major; + + @Schema(description = "学历") + private String education; + + @Schema(description = "教育经历") + private String educationExperience; + + @Schema(description = "工作经历") + private String workExperience; + + @Schema(description = "职位") + private String jobTitle; + + @Schema(description = "职位级别") + private String jobLevel; + + @Schema(description = "职位描述", example = "你说的对") + private String jobDescription; + + @Schema(description = "薪酬") + private Long salary; + + @Schema(description = "身体状况") + private String healthCondition; + + @Schema(description = "体检记录") + private String medicalRecords; + + @Schema(description = "疾病史") + private String diseaseHistory; + + @Schema(description = "养老保险") + private String socialInsurance; + + @Schema(description = "医疗保险") + private Long pensionInsurance; + + @Schema(description = "失业保险") + private Long medicalInsurance; + + @Schema(description = "失业保险") + private Long unemploymentInsurance; + + @Schema(description = "工伤保险") + private Long workInjuryInsurance; + + @Schema(description = "考核评价") + private String leaveRecords; + + @Schema(description = "奖惩记录") + private String overtimeRecords; + + @Schema(description = "培训计划") + private String welfareBenefits; + + @Schema(description = "培训成果") + private String performanceEvaluation; + + @Schema(description = "个人标签") + private String rewardsPunishments; + + @Schema(description = "兴趣爱好") + private String trainingRecords; + + @Schema(description = "特长", example = "你说的对") + private String personalDescription; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicemployee/ElectronicEmployeeConvert.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicemployee/ElectronicEmployeeConvert.java new file mode 100644 index 00000000..5ba0205e --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicemployee/ElectronicEmployeeConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.ea.convert.electronicemployee; + +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.electronicemployee.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicemployee.ElectronicEmployeeDO; + +/** + * 员工档案 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ElectronicEmployeeConvert { + + ElectronicEmployeeConvert INSTANCE = Mappers.getMapper(ElectronicEmployeeConvert.class); + + ElectronicEmployeeDO convert(ElectronicEmployeeCreateReqVO bean); + + ElectronicEmployeeDO convert(ElectronicEmployeeUpdateReqVO bean); + + ElectronicEmployeeRespVO convert(ElectronicEmployeeDO 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/electronicemployee/ElectronicEmployeeDO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electronicemployee/ElectronicEmployeeDO.java new file mode 100644 index 00000000..c42d1b57 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electronicemployee/ElectronicEmployeeDO.java @@ -0,0 +1,225 @@ +package cn.iocoder.yudao.module.ea.dal.dataobject.electronicemployee; + +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_employee") +@KeySequence("ea_electronic_employee_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ElectronicEmployeeDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 制单人 + */ + private String createBy; + /** + * 业务实体id + */ + private Long companyId; + /** + * 业务实体 + */ + private String company; + /** + * 所属部门id + */ + private Long deptId; + /** + * 所属部门 + */ + private String deptName; + /** + * 员工姓名 + */ + private String name; + /** + * 性别 + * + * 枚举 + */ + private String gender; + /** + * 出生日期 + */ + private LocalDate birthdate; + /** + * 国籍 + */ + private String nationality; + /** + * 地址 + */ + private String address; + /** + * 联系方式 + */ + private String contactNumber; + /** + * 身份证号 + */ + private String idCardNumber; + /** + * 护照号码 + */ + private String passportNumber; + /** + * 毕业学校 + */ + private String graduationSchool; + /** + * 专业 + */ + private String major; + /** + * 学历 + */ + private String education; + /** + * 教育经历 + */ + private String educationExperience; + /** + * 工作经历 + */ + private String workExperience; + /** + * 职位 + */ + private String jobTitle; + /** + * 职位级别 + */ + private String jobLevel; + /** + * 职位描述 + */ + private String jobDescription; + /** + * 薪酬 + */ + private Long salary; + /** + * 身体状况 + */ + private String healthCondition; + /** + * 体检记录 + */ + private String medicalRecords; + /** + * 疾病史 + * + * 枚举 + */ + private String diseaseHistory; + /** + * 养老保险 + * + * 枚举 + */ + private String socialInsurance; + /** + * 医疗保险 + */ + private Long pensionInsurance; + /** + * 失业保险 + */ + private Long medicalInsurance; + /** + * 失业保险 + */ + private Long unemploymentInsurance; + /** + * 工伤保险 + */ + private Long workInjuryInsurance; + /** + * 考核评价 + */ + private String leaveRecords; + /** + * 奖惩记录 + */ + private String overtimeRecords; + /** + * 培训计划 + */ + private String welfareBenefits; + /** + * 培训成果 + */ + private String performanceEvaluation; + /** + * 个人标签 + */ + private String rewardsPunishments; + /** + * 兴趣爱好 + */ + private String trainingRecords; + /** + * 特长 + */ + private String personalDescription; + /** + * 年度 + */ + private String year; + /** + * 月份 + */ + private String period; + /** + * 借阅状态 + * + * 枚举 + */ + private String borrowStatus; + /** + * 归档时间 + */ + private String recordTime; + /** + * 纸档位置 + */ + private String position; + /** + * 完整性 + */ + private Integer cherks; + /** + * 归档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/electronicemployee/ElectronicEmployeeMapper.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicemployee/ElectronicEmployeeMapper.java new file mode 100644 index 00000000..4ec833be --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicemployee/ElectronicEmployeeMapper.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.ea.dal.mysql.electronicemployee; + +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.electronicemployee.ElectronicEmployeeDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.vo.*; + +/** + * 员工档案 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ElectronicEmployeeMapper extends BaseMapperX { + + default PageResult selectPage(ElectronicEmployeePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ElectronicEmployeeDO::getCreateBy, reqVO.getCreateBy()) + .betweenIfPresent(ElectronicEmployeeDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ElectronicEmployeeDO::getCompany, reqVO.getCompany()) + .likeIfPresent(ElectronicEmployeeDO::getDeptName, reqVO.getDeptName()) + .likeIfPresent(ElectronicEmployeeDO::getName, reqVO.getName()) + .eqIfPresent(ElectronicEmployeeDO::getGender, reqVO.getGender()) + .eqIfPresent(ElectronicEmployeeDO::getNationality, reqVO.getNationality()) + .eqIfPresent(ElectronicEmployeeDO::getContactNumber, reqVO.getContactNumber()) + .eqIfPresent(ElectronicEmployeeDO::getIdCardNumber, reqVO.getIdCardNumber()) + .eqIfPresent(ElectronicEmployeeDO::getYear, reqVO.getYear()) + .eqIfPresent(ElectronicEmployeeDO::getPeriod, reqVO.getPeriod()) + .eqIfPresent(ElectronicEmployeeDO::getBorrowStatus, reqVO.getBorrowStatus()) + .betweenIfPresent(ElectronicEmployeeDO::getRecordTime, reqVO.getRecordTime()) + .eqIfPresent(ElectronicEmployeeDO::getPosition, reqVO.getPosition()) + .eqIfPresent(ElectronicEmployeeDO::getCherks, reqVO.getCherks()) + .eqIfPresent(ElectronicEmployeeDO::getFileStatus, reqVO.getFileStatus()) + .orderByDesc(ElectronicEmployeeDO::getId)); + } + + default List selectList(ElectronicEmployeeExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(ElectronicEmployeeDO::getCreateBy, reqVO.getCreateBy()) + .betweenIfPresent(ElectronicEmployeeDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ElectronicEmployeeDO::getCompany, reqVO.getCompany()) + .likeIfPresent(ElectronicEmployeeDO::getDeptName, reqVO.getDeptName()) + .likeIfPresent(ElectronicEmployeeDO::getName, reqVO.getName()) + .eqIfPresent(ElectronicEmployeeDO::getGender, reqVO.getGender()) + .eqIfPresent(ElectronicEmployeeDO::getNationality, reqVO.getNationality()) + .eqIfPresent(ElectronicEmployeeDO::getContactNumber, reqVO.getContactNumber()) + .eqIfPresent(ElectronicEmployeeDO::getIdCardNumber, reqVO.getIdCardNumber()) + .eqIfPresent(ElectronicEmployeeDO::getYear, reqVO.getYear()) + .eqIfPresent(ElectronicEmployeeDO::getPeriod, reqVO.getPeriod()) + .eqIfPresent(ElectronicEmployeeDO::getBorrowStatus, reqVO.getBorrowStatus()) + .betweenIfPresent(ElectronicEmployeeDO::getRecordTime, reqVO.getRecordTime()) + .eqIfPresent(ElectronicEmployeeDO::getPosition, reqVO.getPosition()) + .eqIfPresent(ElectronicEmployeeDO::getCherks, reqVO.getCherks()) + .eqIfPresent(ElectronicEmployeeDO::getFileStatus, reqVO.getFileStatus()) + .orderByDesc(ElectronicEmployeeDO::getId)); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicemployee/ElectronicEmployeeService.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicemployee/ElectronicEmployeeService.java new file mode 100644 index 00000000..35fabf96 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicemployee/ElectronicEmployeeService.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.ea.service.electronicemployee; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicemployee.ElectronicEmployeeDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 员工档案 Service 接口 + * + * @author 芋道源码 + */ +public interface ElectronicEmployeeService { + + /** + * 创建员工档案 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createElectronicEmployee(@Valid ElectronicEmployeeCreateReqVO createReqVO); + + /** + * 更新员工档案 + * + * @param updateReqVO 更新信息 + */ + void updateElectronicEmployee(@Valid ElectronicEmployeeUpdateReqVO updateReqVO); + + /** + * 删除员工档案 + * + * @param id 编号 + */ + void deleteElectronicEmployee(Long id); + + /** + * 获得员工档案 + * + * @param id 编号 + * @return 员工档案 + */ + ElectronicEmployeeDO getElectronicEmployee(Long id); + + /** + * 获得员工档案列表 + * + * @param ids 编号 + * @return 员工档案列表 + */ + List getElectronicEmployeeList(Collection ids); + + /** + * 获得员工档案分页 + * + * @param pageReqVO 分页查询 + * @return 员工档案分页 + */ + PageResult getElectronicEmployeePage(ElectronicEmployeePageReqVO pageReqVO); + + /** + * 获得员工档案列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 员工档案列表 + */ + List getElectronicEmployeeList(ElectronicEmployeeExportReqVO exportReqVO); + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicemployee/ElectronicEmployeeServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicemployee/ElectronicEmployeeServiceImpl.java new file mode 100644 index 00000000..cb7ce91b --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicemployee/ElectronicEmployeeServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.ea.service.electronicemployee; + +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.electronicemployee.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicemployee.ElectronicEmployeeDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.ea.convert.electronicemployee.ElectronicEmployeeConvert; +import cn.iocoder.yudao.module.ea.dal.mysql.electronicemployee.ElectronicEmployeeMapper; + +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 ElectronicEmployeeServiceImpl implements ElectronicEmployeeService { + + @Resource + private ElectronicEmployeeMapper electronicEmployeeMapper; + + @Override + public Long createElectronicEmployee(ElectronicEmployeeCreateReqVO createReqVO) { + // 插入 + ElectronicEmployeeDO electronicEmployee = ElectronicEmployeeConvert.INSTANCE.convert(createReqVO); + electronicEmployeeMapper.insert(electronicEmployee); + // 返回 + return electronicEmployee.getId(); + } + + @Override + public void updateElectronicEmployee(ElectronicEmployeeUpdateReqVO updateReqVO) { + // 校验存在 + validateElectronicEmployeeExists(updateReqVO.getId()); + // 更新 + ElectronicEmployeeDO updateObj = ElectronicEmployeeConvert.INSTANCE.convert(updateReqVO); + electronicEmployeeMapper.updateById(updateObj); + } + + @Override + public void deleteElectronicEmployee(Long id) { + // 校验存在 + validateElectronicEmployeeExists(id); + // 删除 + electronicEmployeeMapper.deleteById(id); + } + + private void validateElectronicEmployeeExists(Long id) { + if (electronicEmployeeMapper.selectById(id) == null) { + throw exception(ELECTRONIC_EMPLOYEE_NOT_EXISTS); + } + } + + @Override + public ElectronicEmployeeDO getElectronicEmployee(Long id) { + return electronicEmployeeMapper.selectById(id); + } + + @Override + public List getElectronicEmployeeList(Collection ids) { + return electronicEmployeeMapper.selectBatchIds(ids); + } + + @Override + public PageResult getElectronicEmployeePage(ElectronicEmployeePageReqVO pageReqVO) { + return electronicEmployeeMapper.selectPage(pageReqVO); + } + + @Override + public List getElectronicEmployeeList(ElectronicEmployeeExportReqVO exportReqVO) { + return electronicEmployeeMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/enums/BorrowStatusEnum.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/enums/BorrowStatusEnum.java new file mode 100644 index 00000000..1fcfaf3a --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/enums/BorrowStatusEnum.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.ea.utils.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.Getter; + +/** + * author: zk + * date: 2023/9/22 + * description: 借阅状态枚举 + * @author HP + */ +@Getter +public enum BorrowStatusEnum { + /** + * 借阅状态枚举 + */ + BORROWSTATUS_TRUE("true", "1"), + BORROWSTATUS_FALSE("false", "0") + ; + + @JsonValue + private final String status; + + /** + * 获取转换后的状态 + */ + @EnumValue + private final String isStatus; + + BorrowStatusEnum(String status, String isStatus) { + this.status = status; + this.isStatus = isStatus; + } +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electronicemployee/ElectronicEmployeeMapper.xml b/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electronicemployee/ElectronicEmployeeMapper.xml new file mode 100644 index 00000000..b00652db --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electronicemployee/ElectronicEmployeeMapper.xml @@ -0,0 +1,12 @@ + + + + + + +