Merge remote-tracking branch 'origin/main'

new
commit 6ebf951a71

@ -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');

@ -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');

@ -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');

@ -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 'idid',
`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');

@ -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');

@ -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")) {
switch (fileExtension.toLowerCase()) {
case "ofd":
ocrResult = BaiduOcrHandler.invoiceOCR(imageBase64Param, "ofd");
}
if (fileExtension.equalsIgnoreCase("pdf")) {
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);
@ -171,7 +190,6 @@ public class InvoicesController {
url = getUrl(multipartFile, "other", "other");
}
invoicesDO.setFileUrl(url);
invoicesService.createInvoices(invoicesDO);
return success(invoicesDO);
}
@ -189,9 +207,47 @@ 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<InvoicesExcelVO>());
}
@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<InvoicesExcelVO> 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
*/

@ -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("是否印章01")
@ExcelProperty(value = "是否印章01", 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 + '\'' +
'}';
}
}

@ -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<InvoicesExcelVO> {
/**
* 5使100list 便
*/
private static final int BATCH_COUNT = 100;
/**
*
*/
private List<InvoicesExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
/**
* DAOservice
*/
private InvoicesExcelVO demoDAO;
public DemoDataListener() {
// 这里是demo所以随便new一个。实际使用如果到了spring,请使用下面的有参构造函数
demoDAO = new InvoicesExcelVO();
}
/**
* 使spring,使Listenerspring
*
* @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<Integer, ReadCellData<?>> 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);
}
}

@ -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();
}
}

@ -25,6 +25,8 @@ public interface InvoicesConvert {
InvoicesRespVO convert(InvoicesDO bean);
InvoicesDO convert(InvoicesExcelVO bean);
List<InvoicesRespVO> convertList(List<InvoicesDO> list);
PageResult<InvoicesRespVO> convertPage(PageResult<InvoicesDO> page);

@ -67,4 +67,6 @@ public interface InvoicesService {
*/
List<InvoicesDO> getInvoicesList(InvoicesExportReqVO exportReqVO);
int batchInsert(List<InvoicesExcelVO> invoicesList);
}

@ -79,4 +79,18 @@ public class InvoicesServiceImpl implements InvoicesService {
return invoicesMapper.selectList(exportReqVO);
}
@Override
public int batchInsert(List<InvoicesExcelVO> invoicesList) {
if ( invoicesList == null ) {
return 0;
}
List<InvoicesDO> list1 = new ArrayList<InvoicesDO>( invoicesList.size() );
for ( InvoicesExcelVO invoicesExcelVO : invoicesList ) {
list1.add( InvoicesConvert.INSTANCE.convert(invoicesExcelVO ) );
}
invoicesMapper.insertBatch(list1);
return 1;
}
}

@ -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;

@ -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, "员工档案不存在");
}

@ -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 {

@ -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<Long> createElectronicEmployee(@Valid @RequestBody ElectronicEmployeeCreateReqVO createReqVO) {
return success(electronicEmployeeService.createElectronicEmployee(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新员工档案")
@PreAuthorize("@ss.hasPermission('ea:electronic-employee:update')")
public CommonResult<Boolean> 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<Boolean> 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<ElectronicEmployeeRespVO> 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<List<ElectronicEmployeeRespVO>> getElectronicEmployeeList(@RequestParam("ids") Collection<Long> ids) {
List<ElectronicEmployeeDO> list = electronicEmployeeService.getElectronicEmployeeList(ids);
return success(ElectronicEmployeeConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得员工档案分页")
@PreAuthorize("@ss.hasPermission('ea:electronic-employee:query')")
public CommonResult<PageResult<ElectronicEmployeeRespVO>> getElectronicEmployeePage(@Valid ElectronicEmployeePageReqVO pageVO) {
PageResult<ElectronicEmployeeDO> 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<ElectronicEmployeeDO> list = electronicEmployeeService.getElectronicEmployeeList(exportReqVO);
// 导出 Excel
List<ElectronicEmployeeExcelVO> datas = ElectronicEmployeeConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "员工档案.xls", "数据", ElectronicEmployeeExcelVO.class, datas);
}
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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<ElectronicEmployeeRespVO> convertList(List<ElectronicEmployeeDO> list);
PageResult<ElectronicEmployeeRespVO> convertPage(PageResult<ElectronicEmployeeDO> page);
List<ElectronicEmployeeExcelVO> convertList02(List<ElectronicEmployeeDO> list);
}

@ -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;
}

@ -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<ElectronicEmployeeDO> {
default PageResult<ElectronicEmployeeDO> selectPage(ElectronicEmployeePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ElectronicEmployeeDO>()
.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<ElectronicEmployeeDO> selectList(ElectronicEmployeeExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ElectronicEmployeeDO>()
.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));
}
}

@ -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<ElectronicEmployeeDO> getElectronicEmployeeList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<ElectronicEmployeeDO> getElectronicEmployeePage(ElectronicEmployeePageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<ElectronicEmployeeDO> getElectronicEmployeeList(ElectronicEmployeeExportReqVO exportReqVO);
}

@ -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<ElectronicEmployeeDO> getElectronicEmployeeList(Collection<Long> ids) {
return electronicEmployeeMapper.selectBatchIds(ids);
}
@Override
public PageResult<ElectronicEmployeeDO> getElectronicEmployeePage(ElectronicEmployeePageReqVO pageReqVO) {
return electronicEmployeeMapper.selectPage(pageReqVO);
}
@Override
public List<ElectronicEmployeeDO> getElectronicEmployeeList(ElectronicEmployeeExportReqVO exportReqVO) {
return electronicEmployeeMapper.selectList(exportReqVO);
}
}

@ -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;
}
}

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.ea.dal.mysql.electronicemployee.ElectronicEmployeeMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
Loading…
Cancel
Save