会计档案

new
JilingLee 1 year ago
parent e353b0bdc9
commit f9062b177d

@ -25,6 +25,7 @@
<!-- <module>yudao-example</module>--> <!-- <module>yudao-example</module>-->
<module>yudao-module-bs</module> <module>yudao-module-bs</module>
<module>yudao-module-archives</module> <module>yudao-module-archives</module>
<module>yudao-module-accounting</module>
<module>yudao-module-electronic</module> <module>yudao-module-electronic</module>
<module>yudao-module-setting</module> <module>yudao-module-setting</module>
</modules> </modules>

@ -0,0 +1,114 @@
--
INSERT INTO `lyr-one`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (NULL, '', 'archives_file_status', 0, NULL, '1', '2023-09-08 11:16:23', '1', '2023-09-08 11:16:23', b'0', '1970-01-01 00:00:00');
INSERT INTO `lyr-one`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (NULL, '', 'accounting_file_status', 0, NULL, '1', '2023-09-19 15:17:27', '1', '2023-09-19 15:41:11', b'0', '1970-01-01 00:00:00');
INSERT INTO `lyr-one`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (NULL, '', 'accounting_borrow_stauts', 0, NULL, '1', '2023-09-19 15:21:18', '1', '2023-09-19 15:41:12', b'0', '1970-01-01 00:00:00');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '', '0', 'accounting_file_status', 0, 'warning', '', NULL, '', '2023-09-19 15:18:27', '', '2023-09-19 15:18:39', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '', '1', 'accounting_file_status', 0, 'success', '', NULL, '', '2023-09-19 15:18:56', '', '2023-09-19 15:18:56', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '', '0', 'accounting_borrow_stauts', 0, 'info', '', NULL, '', '2023-09-19 15:22:06', '', '2023-09-19 15:22:06', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '', '1', 'accounting_borrow_stauts', 0, 'danger', '', NULL, '', '2023-09-19 15:22:29', '', '2023-09-19 15:22:29', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '', '0', 'archives_file_status', 0, 'warning', '', NULL, '1', '2023-09-08 11:18:38', '1', '2023-09-08 11:18:38', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '', '1', 'archives_file_status', 0, 'success', '', NULL, '1', '2023-09-08 11:18:53', '1', '2023-09-08 11:18:53', b'0');
INSERT INTO `lyr-one`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (NULL, '', 'archives_file_type', 0, NULL, '1', '2023-09-08 11:13:18', '1', '2023-09-08 11:13:18', b'0', '1970-01-01 00:00:00');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '', 'electronic_assets', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 15:35:38', '136', '2023-09-08 16:05:31', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 1, '', 'electronic_consultation', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:05:42', '136', '2023-09-08 16:06:24', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 2, '', 'electronic_contracts', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:06:06', '136', '2023-09-08 16:06:48', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 3, '', 'electronic_customer_complaint', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:06:20', '136', '2023-09-08 16:06:58', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 4, '', 'electronic_employee', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:07:12', '136', '2023-09-08 16:07:17', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 5, '', 'electronic_other', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:07:35', '136', '2023-09-08 16:10:18', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 6, '', 'accounting_voucher', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:08:02', '136', '2023-09-08 16:09:34', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 7, '簿', 'accounting_book', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:08:30', '136', '2023-09-08 16:09:27', b'0');
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 8, '', 'archives_other', 'archives_file_type', 0, 'default', '', NULL, '136', '2023-09-08 16:10:01', '136', '2023-09-08 16:10:01', b'0');
-- ----------------------------
-- for accounting_voucher
-- ----------------------------
DROP TABLE IF EXISTS `accounting_voucher`;
CREATE TABLE `accounting_voucher` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '',
`create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`creator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`company_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`company` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`dept_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`dept_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`voucher_time` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`voucher_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`digest` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`audit` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`checker` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`handle` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`service_id` bigint(20) NULL DEFAULT NULL COMMENT '',
`service_explain` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`flow_id` bigint(20) NULL DEFAULT NULL COMMENT '/',
`source` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`year` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`period` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`borrow_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '',
`record_time` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`position` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`cherks` int(10) NULL DEFAULT NULL COMMENT '',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`deleted` bit(1) NULL DEFAULT b'0' COMMENT '',
`updater` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`record_id` bigint(20) NULL DEFAULT NULL COMMENT 'idid',
`file_status` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '',
`tenant_id` bigint(20) NOT NULL COMMENT '/',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '1',
`attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '2',
`attr3` int(11) NULL DEFAULT NULL COMMENT '3',
`attr4` int(11) NULL DEFAULT NULL COMMENT '4',
`organization_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`depot_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`cabinet_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- accounting_voucher_details
-- ----------------------------
DROP TABLE IF EXISTS `accounting_voucher_details`;
CREATE TABLE `accounting_voucher_details` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '',
`line_num` int(11) NULL DEFAULT NULL COMMENT '',
`create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`creator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`digest` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`voucher_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`subject_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`subject_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`assist_check` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`debit_money` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`creditor_money` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`flow_id` bigint(20) NULL DEFAULT NULL COMMENT '',
`voucher_id` bigint(20) NOT NULL COMMENT 'id',
`voucher_num` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`deleted` bit(1) NULL DEFAULT b'0' COMMENT '',
`updater` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`file_status` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`tenant_id` bigint(20) NOT NULL COMMENT '/',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '1',
`attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '2',
`attr3` int(11) NULL DEFAULT NULL COMMENT '3',
`attr4` int(11) NULL DEFAULT NULL COMMENT '4',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '' ROW_FORMAT = Dynamic;
--
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 ('', '', 1, 1, 0, '/accounting', 'pay', NULL, NULL, 0, b'1', b'1', b'1', '1', '2023-09-06 16:14:44', '126', '2023-09-19 14:26:20', b'0');
SET @menuId = LAST_INSERT_ID();
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, 'voucher', '', 'accounting/voucher/index', 'Voucher', 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', 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:voucher:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', 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 (NULL, '', 'accounting:voucher:create', 3, 2, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', 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 (NULL, '', 'accounting:voucher:update', 3, 3, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', 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 (NULL, '', 'accounting:voucher:delete', 3, 4, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', 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 (NULL, '', 'accounting:voucher:export', 3, 5, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-19 14:33:30', '', '2023-09-19 14:33:30', b'0');

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<modules>
<module>yudao-module-accounting-api</module>
<module>yudao-module-accounting-biz</module>
</modules>
<artifactId>yudao-module-accounting</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<description>
会计档案模块
</description>
<dependencies>
<dependency>
<groupId>com.baidu.aip</groupId>
<artifactId>java-sdk</artifactId>
<version>4.8.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.80</version>
</dependency>
</dependencies>
</project>

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-accounting</artifactId>
<version>${revision}</version>
</parent>
<artifactId>yudao-module-accounting-api</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>
accounting 模块 API暴露给其它模块调用
</description>
<dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-common</artifactId>
</dependency>
<!-- 参数校验 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.accounting.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
*/
@AllArgsConstructor
@Getter
public enum AccountingStatusEnum {
INCOMPLETE("0", "不完整"),
COMPLETE("1", "完整"),
UNLOGFILE("0", "未归档"),
LOGFILE("1", "已归档"),
UNBORROWED("0", "未借阅"),
BORROWED("1", "已借阅");
/**
*
*/
private final String value;
/**
*
*/
private final String name;
}

@ -0,0 +1,7 @@
package cn.iocoder.yudao.module.accounting.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
ErrorCode VOUCHER_NOT_EXISTS = new ErrorCode(200100, "会计凭证不存在");
ErrorCode VOUCHER_DETAILS_NOT_EXISTS = new ErrorCode(300100, "凭证详情不存在");
}

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-accounting</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-module-accounting-biz</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>
accounting 模块,主要实现商品相关功能
例如品牌、商品分类、spu、sku等功能。
</description>
<dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-accounting-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-test</artifactId>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-bpm-api</artifactId>
<version>1.7.3-snapshot</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-system-biz</artifactId>
<version>1.7.3-snapshot</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-bpm-biz</artifactId>
<version>1.7.3-snapshot</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-infra-biz</artifactId>
<version>1.7.3-snapshot</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucher;
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.accounting.controller.admin.voucher.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucher.VoucherDO;
import cn.iocoder.yudao.module.accounting.convert.voucher.VoucherConvert;
import cn.iocoder.yudao.module.accounting.service.voucher.VoucherService;
@Tag(name = "管理后台 - 会计凭证")
@RestController
@RequestMapping("/accounting/voucher")
@Validated
public class VoucherController {
@Resource
private VoucherService voucherService;
@PostMapping("/create")
@Operation(summary = "创建会计凭证")
@PreAuthorize("@ss.hasPermission('accounting:voucher:create')")
public CommonResult<Long> createVoucher(@Valid @RequestBody VoucherCreateReqVO createReqVO) {
return success(voucherService.createVoucher(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新会计凭证")
@PreAuthorize("@ss.hasPermission('accounting:voucher:update')")
public CommonResult<Boolean> updateVoucher(@Valid @RequestBody VoucherUpdateReqVO updateReqVO) {
voucherService.updateVoucher(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除会计凭证")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('accounting:voucher:delete')")
public CommonResult<Boolean> deleteVoucher(@RequestParam("id") Long id) {
voucherService.deleteVoucher(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得会计凭证")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('accounting:voucher:query')")
public CommonResult<VoucherRespVO> getVoucher(@RequestParam("id") Long id) {
VoucherDO voucher = voucherService.getVoucher(id);
return success(VoucherConvert.INSTANCE.convert(voucher));
}
@GetMapping("/list")
@Operation(summary = "获得会计凭证列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('accounting:voucher:query')")
public CommonResult<List<VoucherRespVO>> getVoucherList(@RequestParam("ids") Collection<Long> ids) {
List<VoucherDO> list = voucherService.getVoucherList(ids);
return success(VoucherConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得会计凭证分页")
@PreAuthorize("@ss.hasPermission('accounting:voucher:query')")
public CommonResult<PageResult<VoucherRespVO>> getVoucherPage(@Valid VoucherPageReqVO pageVO) {
PageResult<VoucherDO> pageResult = voucherService.getVoucherPage(pageVO);
return success(VoucherConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出会计凭证 Excel")
@PreAuthorize("@ss.hasPermission('accounting:voucher:export')")
@OperateLog(type = EXPORT)
public void exportVoucherExcel(@Valid VoucherExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<VoucherDO> list = voucherService.getVoucherList(exportReqVO);
// 导出 Excel
List<VoucherExcelVO> datas = VoucherConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "会计凭证.xls", "数据", VoucherExcelVO.class, datas);
}
}

@ -0,0 +1,104 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucher.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 VoucherBaseVO {
@Schema(description = "制单人")
private String createBy;
@Schema(description = "业务实体id", example = "3855")
private Long companyId;
@Schema(description = "业务实体")
private String company;
@Schema(description = "所属部门id", example = "2006")
private Long deptId;
@Schema(description = "所属部门", example = "张三")
private String deptName;
@Schema(description = "凭证日期")
private String voucherTime;
@Schema(description = "凭证号")
private String voucherNum;
@Schema(description = "摘要")
private String digest;
@Schema(description = "审核人")
private String audit;
@Schema(description = "核准人")
private String checker;
@Schema(description = "经办人")
private String handle;
@Schema(description = "业务标识", example = "5041")
private Long serviceId;
@Schema(description = "业务说明")
private String serviceExplain;
@Schema(description = "凭证类型", example = "1")
private String type;
@Schema(description = "流程号/文件号", example = "32123")
private Long flowId;
@Schema(description = "文件来源")
private String source;
@Schema(description = "年度")
private String year;
@Schema(description = "会计期间")
private String period;
@Schema(description = "借阅状态", example = "1")
private String borrowStatus;
@Schema(description = "归档时间")
private String recordTime;
@Schema(description = "纸档位置")
private String position;
@Schema(description = "完整性")
private Integer cherks;
@Schema(description = "用户id", example = "10915")
private Long userId;
@Schema(description = "归档id一个归档id对应多个凭证号", example = "14667")
private Long recordId;
@Schema(description = "归档状态", example = "2")
private String fileStatus;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "立档单位ID", example = "24728")
private Long organizationId;
@Schema(description = "库房ID", example = "24050")
private Long depotId;
@Schema(description = "档案柜ID", example = "1586")
private Long cabinetId;
}

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 会计凭证创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class VoucherCreateReqVO extends VoucherBaseVO {
}

@ -0,0 +1,112 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* Excel VO
*
* @author
*/
@Data
public class VoucherExcelVO {
@ExcelProperty("主键")
private Long id;
@ExcelProperty("制单人")
private String createBy;
@ExcelProperty("创建日期")
private LocalDateTime createTime;
@ExcelProperty("业务实体id")
private Long companyId;
@ExcelProperty("业务实体")
private String company;
@ExcelProperty("所属部门id")
private Long deptId;
@ExcelProperty("所属部门")
private String deptName;
@ExcelProperty("凭证日期")
private String voucherTime;
@ExcelProperty("凭证号")
private String voucherNum;
@ExcelProperty("摘要")
private String digest;
@ExcelProperty("审核人")
private String audit;
@ExcelProperty("核准人")
private String checker;
@ExcelProperty("经办人")
private String handle;
@ExcelProperty("业务标识")
private Long serviceId;
@ExcelProperty("业务说明")
private String serviceExplain;
@ExcelProperty("凭证类型")
private String type;
@ExcelProperty("流程号/文件号")
private Long flowId;
@ExcelProperty("文件来源")
private String source;
@ExcelProperty("年度")
private String year;
@ExcelProperty("会计期间")
private String period;
@ExcelProperty("借阅状态")
private String borrowStatus;
@ExcelProperty("归档时间")
private String recordTime;
@ExcelProperty("纸档位置")
private String position;
@ExcelProperty("完整性")
private Integer cherks;
@ExcelProperty("用户id")
private Long userId;
@ExcelProperty("归档id一个归档id对应多个凭证号")
private Long recordId;
@ExcelProperty("归档状态")
private String fileStatus;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("立档单位ID")
private Long organizationId;
@ExcelProperty("库房ID")
private Long depotId;
@ExcelProperty("档案柜ID")
private Long cabinetId;
}

@ -0,0 +1,109 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucher.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参数和 VoucherPageReqVO 是一致的")
@Data
public class VoucherExportReqVO {
@Schema(description = "制单人")
private String createBy;
@Schema(description = "创建日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "业务实体id", example = "3855")
private Long companyId;
@Schema(description = "业务实体")
private String company;
@Schema(description = "所属部门id", example = "2006")
private Long deptId;
@Schema(description = "所属部门", example = "张三")
private String deptName;
@Schema(description = "凭证日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] voucherTime;
@Schema(description = "凭证号")
private String voucherNum;
@Schema(description = "摘要")
private String digest;
@Schema(description = "审核人")
private String audit;
@Schema(description = "核准人")
private String checker;
@Schema(description = "经办人")
private String handle;
@Schema(description = "业务标识", example = "5041")
private Long serviceId;
@Schema(description = "业务说明")
private String serviceExplain;
@Schema(description = "凭证类型", example = "1")
private String type;
@Schema(description = "流程号/文件号", example = "32123")
private Long flowId;
@Schema(description = "文件来源")
private String source;
@Schema(description = "年度")
private String year;
@Schema(description = "会计期间")
private String period;
@Schema(description = "借阅状态", example = "1")
private String borrowStatus;
@Schema(description = "归档时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] recordTime;
@Schema(description = "纸档位置")
private String position;
@Schema(description = "完整性")
private Integer cherks;
@Schema(description = "用户id", example = "10915")
private Long userId;
@Schema(description = "归档id一个归档id对应多个凭证号", example = "14667")
private Long recordId;
@Schema(description = "归档状态", example = "2")
private String fileStatus;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "立档单位ID", example = "24728")
private Long organizationId;
@Schema(description = "库房ID", example = "24050")
private Long depotId;
@Schema(description = "档案柜ID", example = "1586")
private Long cabinetId;
}

@ -0,0 +1,111 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucher.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 VoucherPageReqVO extends PageParam {
@Schema(description = "制单人")
private String createBy;
@Schema(description = "创建日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "业务实体id", example = "3855")
private Long companyId;
@Schema(description = "业务实体")
private String company;
@Schema(description = "所属部门id", example = "2006")
private Long deptId;
@Schema(description = "所属部门", example = "张三")
private String deptName;
@Schema(description = "凭证日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] voucherTime;
@Schema(description = "凭证号")
private String voucherNum;
@Schema(description = "摘要")
private String digest;
@Schema(description = "审核人")
private String audit;
@Schema(description = "核准人")
private String checker;
@Schema(description = "经办人")
private String handle;
@Schema(description = "业务标识", example = "5041")
private Long serviceId;
@Schema(description = "业务说明")
private String serviceExplain;
@Schema(description = "凭证类型", example = "1")
private String type;
@Schema(description = "流程号/文件号", example = "32123")
private Long flowId;
@Schema(description = "文件来源")
private String source;
@Schema(description = "年度")
private String year;
@Schema(description = "会计期间")
private String period;
@Schema(description = "借阅状态", example = "1")
private String borrowStatus;
@Schema(description = "归档时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] recordTime;
@Schema(description = "纸档位置")
private String position;
@Schema(description = "完整性")
private Integer cherks;
@Schema(description = "用户id", example = "10915")
private Long userId;
@Schema(description = "归档id一个归档id对应多个凭证号", example = "14667")
private Long recordId;
@Schema(description = "归档状态", example = "2")
private String fileStatus;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "立档单位ID", example = "24728")
private Long organizationId;
@Schema(description = "库房ID", example = "24050")
private Long depotId;
@Schema(description = "档案柜ID", example = "1586")
private Long cabinetId;
}

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucher.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 VoucherRespVO extends VoucherBaseVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6174")
private Long id;
@Schema(description = "创建日期")
private LocalDateTime createTime;
}

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 会计凭证更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class VoucherUpdateReqVO extends VoucherBaseVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6174")
@NotNull(message = "主键不能为空")
private Long id;
}

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails;
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.accounting.controller.admin.voucherdetails.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucherdetails.VoucherDetailsDO;
import cn.iocoder.yudao.module.accounting.convert.voucherdetails.VoucherDetailsConvert;
import cn.iocoder.yudao.module.accounting.service.voucherdetails.VoucherDetailsService;
@Tag(name = "管理后台 - 凭证详情")
@RestController
@RequestMapping("/accounting/voucher-details")
@Validated
public class VoucherDetailsController {
@Resource
private VoucherDetailsService voucherDetailsService;
@PostMapping("/create")
@Operation(summary = "创建凭证详情")
@PreAuthorize("@ss.hasPermission('accounting:voucher-details:create')")
public CommonResult<Long> createVoucherDetails(@Valid @RequestBody VoucherDetailsCreateReqVO createReqVO) {
return success(voucherDetailsService.createVoucherDetails(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新凭证详情")
@PreAuthorize("@ss.hasPermission('accounting:voucher-details:update')")
public CommonResult<Boolean> updateVoucherDetails(@Valid @RequestBody VoucherDetailsUpdateReqVO updateReqVO) {
voucherDetailsService.updateVoucherDetails(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除凭证详情")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('accounting:voucher-details:delete')")
public CommonResult<Boolean> deleteVoucherDetails(@RequestParam("id") Long id) {
voucherDetailsService.deleteVoucherDetails(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得凭证详情")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('accounting:voucher-details:query')")
public CommonResult<VoucherDetailsRespVO> getVoucherDetails(@RequestParam("id") Long id) {
VoucherDetailsDO voucherDetails = voucherDetailsService.getVoucherDetails(id);
return success(VoucherDetailsConvert.INSTANCE.convert(voucherDetails));
}
@GetMapping("/list")
@Operation(summary = "获得凭证详情列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('accounting:voucher-details:query')")
public CommonResult<List<VoucherDetailsRespVO>> getVoucherDetailsList(@RequestParam("ids") Collection<Long> ids) {
List<VoucherDetailsDO> list = voucherDetailsService.getVoucherDetailsList(ids);
return success(VoucherDetailsConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得凭证详情分页")
@PreAuthorize("@ss.hasPermission('accounting:voucher-details:query')")
public CommonResult<PageResult<VoucherDetailsRespVO>> getVoucherDetailsPage(@Valid VoucherDetailsPageReqVO pageVO) {
PageResult<VoucherDetailsDO> pageResult = voucherDetailsService.getVoucherDetailsPage(pageVO);
return success(VoucherDetailsConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出凭证详情 Excel")
@PreAuthorize("@ss.hasPermission('accounting:voucher-details:export')")
@OperateLog(type = EXPORT)
public void exportVoucherDetailsExcel(@Valid VoucherDetailsExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<VoucherDetailsDO> list = voucherDetailsService.getVoucherDetailsList(exportReqVO);
// 导出 Excel
List<VoucherDetailsExcelVO> datas = VoucherDetailsConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "凭证详情.xls", "数据", VoucherDetailsExcelVO.class, datas);
}
}

@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.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 VoucherDetailsBaseVO {
@Schema(description = "条目顺序号")
private Integer lineNum;
@Schema(description = "制单人")
private String createBy;
@Schema(description = "摘要")
private String digest;
@Schema(description = "凭证类型", example = "1")
private String voucherType;
@Schema(description = "科目编码")
private String subjectCode;
@Schema(description = "科目名称", example = "李四")
private String subjectName;
@Schema(description = "辅助核算")
private String assistCheck;
@Schema(description = "借方金额")
private String debitMoney;
@Schema(description = "贷方金额")
private String creditorMoney;
@Schema(description = "相关单据关联号", example = "17322")
private Long flowId;
@Schema(description = "凭证id一个凭证对应多个凭证详情", requiredMode = Schema.RequiredMode.REQUIRED, example = "31093")
@NotNull(message = "凭证id一个凭证对应多个凭证详情不能为空")
private Long voucherId;
@Schema(description = "凭证号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "凭证号不能为空")
private String voucherNum;
@Schema(description = "用户id", example = "11976")
private Long userId;
@Schema(description = "归档状态", example = "2")
private String fileStatus;
}

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 凭证详情创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class VoucherDetailsCreateReqVO extends VoucherDetailsBaseVO {
}

@ -0,0 +1,71 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
/**
* Excel VO
*
* @author
*/
@Data
public class VoucherDetailsExcelVO {
@ExcelProperty("主键")
private Long id;
@ExcelProperty("条目顺序号")
private Integer lineNum;
@ExcelProperty("制单人")
private String createBy;
@ExcelProperty("创建日期")
private LocalDateTime createTime;
@ExcelProperty("摘要")
private String digest;
@ExcelProperty("凭证类型")
private String voucherType;
@ExcelProperty("科目编码")
private String subjectCode;
@ExcelProperty("科目名称")
private String subjectName;
@ExcelProperty("辅助核算")
private String assistCheck;
@ExcelProperty("借方金额")
private String debitMoney;
@ExcelProperty("贷方金额")
private String creditorMoney;
@ExcelProperty("相关单据关联号")
private Long flowId;
@ExcelProperty("凭证id一个凭证对应多个凭证详情")
private Long voucherId;
@ExcelProperty("凭证号")
private String voucherNum;
@ExcelProperty("用户id")
private Long userId;
@ExcelProperty(value = "归档状态", converter = DictConvert.class)
@DictFormat("archives_file_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
private String fileStatus;
}

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.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参数和 VoucherDetailsPageReqVO 是一致的")
@Data
public class VoucherDetailsExportReqVO {
@Schema(description = "条目顺序号")
private Integer lineNum;
@Schema(description = "制单人")
private String createBy;
@Schema(description = "创建日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "摘要")
private String digest;
@Schema(description = "凭证类型", example = "1")
private String voucherType;
@Schema(description = "科目编码")
private String subjectCode;
@Schema(description = "科目名称", example = "李四")
private String subjectName;
@Schema(description = "辅助核算")
private String assistCheck;
@Schema(description = "借方金额")
private String debitMoney;
@Schema(description = "贷方金额")
private String creditorMoney;
@Schema(description = "相关单据关联号", example = "17322")
private Long flowId;
@Schema(description = "凭证id一个凭证对应多个凭证详情", example = "31093")
private Long voucherId;
@Schema(description = "凭证号")
private String voucherNum;
@Schema(description = "用户id", example = "11976")
private Long userId;
@Schema(description = "归档状态", example = "2")
private String fileStatus;
}

@ -0,0 +1,64 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.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 VoucherDetailsPageReqVO extends PageParam {
@Schema(description = "条目顺序号")
private Integer lineNum;
@Schema(description = "制单人")
private String createBy;
@Schema(description = "创建日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "摘要")
private String digest;
@Schema(description = "凭证类型", example = "1")
private String voucherType;
@Schema(description = "科目编码")
private String subjectCode;
@Schema(description = "科目名称", example = "李四")
private String subjectName;
@Schema(description = "辅助核算")
private String assistCheck;
@Schema(description = "借方金额")
private String debitMoney;
@Schema(description = "贷方金额")
private String creditorMoney;
@Schema(description = "相关单据关联号", example = "17322")
private Long flowId;
@Schema(description = "凭证id一个凭证对应多个凭证详情", example = "31093")
private Long voucherId;
@Schema(description = "凭证号")
private String voucherNum;
@Schema(description = "用户id", example = "11976")
private Long userId;
@Schema(description = "归档状态", example = "2")
private String fileStatus;
}

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.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 VoucherDetailsRespVO extends VoucherDetailsBaseVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31664")
private Long id;
@Schema(description = "创建日期")
private LocalDateTime createTime;
}

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 凭证详情更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class VoucherDetailsUpdateReqVO extends VoucherDetailsBaseVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31664")
@NotNull(message = "主键不能为空")
private Long id;
}

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.accounting.convert.voucher;
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.accounting.controller.admin.voucher.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucher.VoucherDO;
/**
* Convert
*
* @author
*/
@Mapper
public interface VoucherConvert {
VoucherConvert INSTANCE = Mappers.getMapper(VoucherConvert.class);
VoucherDO convert(VoucherCreateReqVO bean);
VoucherDO convert(VoucherUpdateReqVO bean);
VoucherRespVO convert(VoucherDO bean);
List<VoucherRespVO> convertList(List<VoucherDO> list);
PageResult<VoucherRespVO> convertPage(PageResult<VoucherDO> page);
List<VoucherExcelVO> convertList02(List<VoucherDO> list);
}

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.accounting.convert.voucherdetails;
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.accounting.controller.admin.voucherdetails.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucherdetails.VoucherDetailsDO;
/**
* Convert
*
* @author
*/
@Mapper
public interface VoucherDetailsConvert {
VoucherDetailsConvert INSTANCE = Mappers.getMapper(VoucherDetailsConvert.class);
VoucherDetailsDO convert(VoucherDetailsCreateReqVO bean);
VoucherDetailsDO convert(VoucherDetailsUpdateReqVO bean);
VoucherDetailsRespVO convert(VoucherDetailsDO bean);
List<VoucherDetailsRespVO> convertList(List<VoucherDetailsDO> list);
PageResult<VoucherDetailsRespVO> convertPage(PageResult<VoucherDetailsDO> page);
List<VoucherDetailsExcelVO> convertList02(List<VoucherDetailsDO> list);
}

@ -0,0 +1,163 @@
package cn.iocoder.yudao.module.accounting.dal.dataobject.voucher;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("accounting_voucher")
@KeySequence("accounting_voucher_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VoucherDO 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 voucherTime;
/**
*
*/
private String voucherNum;
/**
*
*/
private String digest;
/**
*
*/
private String audit;
/**
*
*/
private String checker;
/**
*
*/
private String handle;
/**
*
*/
private Long serviceId;
/**
*
*/
private String serviceExplain;
/**
*
*/
private String type;
/**
* /
*/
private Long flowId;
/**
*
*/
private String source;
/**
*
*/
private String year;
/**
*
*/
private String period;
/**
*
*/
private String borrowStatus;
/**
*
*/
private String recordTime;
/**
*
*/
private String position;
/**
*
*/
private Integer cherks;
/**
* id
*/
private Long userId;
/**
* idid
*/
private Long recordId;
/**
*
*/
private String fileStatus;
/**
*
*/
private String remark;
/**
* 1
*/
private String attr1;
/**
* 2
*/
private String attr2;
/**
* 3
*/
private Integer attr3;
/**
* 4
*/
private Integer attr4;
/**
* ID
*/
private Long organizationId;
/**
* ID
*/
private Long depotId;
/**
* ID
*/
private Long cabinetId;
}

@ -0,0 +1,109 @@
package cn.iocoder.yudao.module.accounting.dal.dataobject.voucherdetails;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("accounting_voucher_details")
@KeySequence("accounting_voucher_details_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VoucherDetailsDO extends BaseDO {
/**
*
*/
@TableId
private Long id;
/**
*
*/
private Integer lineNum;
/**
*
*/
private String createBy;
/**
*
*/
private String digest;
/**
*
*/
private String voucherType;
/**
*
*/
private String subjectCode;
/**
*
*/
private String subjectName;
/**
*
*/
private String assistCheck;
/**
*
*/
private String debitMoney;
/**
*
*/
private String creditorMoney;
/**
*
*/
private Long flowId;
/**
* id
*/
private Long voucherId;
/**
*
*/
private String voucherNum;
/**
* id
*/
private Long userId;
/**
*
*
* {@link TODO archives_file_status }
*/
private String fileStatus;
/**
*
*/
private String remark;
/**
* 1
*/
private String attr1;
/**
* 2
*/
private String attr2;
/**
* 3
*/
private Integer attr3;
/**
* 4
*/
private Integer attr4;
}

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.accounting.dal.mysql.voucher;
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.accounting.dal.dataobject.voucher.VoucherDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface VoucherMapper extends BaseMapperX<VoucherDO> {
default PageResult<VoucherDO> selectPage(VoucherPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<VoucherDO>()
.eqIfPresent(VoucherDO::getCreateBy, reqVO.getCreateBy())
.betweenIfPresent(VoucherDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(VoucherDO::getCompanyId, reqVO.getCompanyId())
.eqIfPresent(VoucherDO::getCompany, reqVO.getCompany())
.eqIfPresent(VoucherDO::getDeptId, reqVO.getDeptId())
.likeIfPresent(VoucherDO::getDeptName, reqVO.getDeptName())
.betweenIfPresent(VoucherDO::getVoucherTime, reqVO.getVoucherTime())
.eqIfPresent(VoucherDO::getVoucherNum, reqVO.getVoucherNum())
.eqIfPresent(VoucherDO::getDigest, reqVO.getDigest())
.eqIfPresent(VoucherDO::getAudit, reqVO.getAudit())
.eqIfPresent(VoucherDO::getChecker, reqVO.getChecker())
.eqIfPresent(VoucherDO::getHandle, reqVO.getHandle())
.eqIfPresent(VoucherDO::getServiceId, reqVO.getServiceId())
.eqIfPresent(VoucherDO::getServiceExplain, reqVO.getServiceExplain())
.eqIfPresent(VoucherDO::getType, reqVO.getType())
.eqIfPresent(VoucherDO::getFlowId, reqVO.getFlowId())
.eqIfPresent(VoucherDO::getSource, reqVO.getSource())
.eqIfPresent(VoucherDO::getYear, reqVO.getYear())
.eqIfPresent(VoucherDO::getPeriod, reqVO.getPeriod())
.eqIfPresent(VoucherDO::getBorrowStatus, reqVO.getBorrowStatus())
.betweenIfPresent(VoucherDO::getRecordTime, reqVO.getRecordTime())
.eqIfPresent(VoucherDO::getPosition, reqVO.getPosition())
.eqIfPresent(VoucherDO::getCherks, reqVO.getCherks())
.eqIfPresent(VoucherDO::getUserId, reqVO.getUserId())
.eqIfPresent(VoucherDO::getRecordId, reqVO.getRecordId())
.eqIfPresent(VoucherDO::getFileStatus, reqVO.getFileStatus())
.eqIfPresent(VoucherDO::getRemark, reqVO.getRemark())
.eqIfPresent(VoucherDO::getOrganizationId, reqVO.getOrganizationId())
.eqIfPresent(VoucherDO::getDepotId, reqVO.getDepotId())
.eqIfPresent(VoucherDO::getCabinetId, reqVO.getCabinetId())
.orderByDesc(VoucherDO::getId));
}
default List<VoucherDO> selectList(VoucherExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<VoucherDO>()
.eqIfPresent(VoucherDO::getCreateBy, reqVO.getCreateBy())
.betweenIfPresent(VoucherDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(VoucherDO::getCompanyId, reqVO.getCompanyId())
.eqIfPresent(VoucherDO::getCompany, reqVO.getCompany())
.eqIfPresent(VoucherDO::getDeptId, reqVO.getDeptId())
.likeIfPresent(VoucherDO::getDeptName, reqVO.getDeptName())
.betweenIfPresent(VoucherDO::getVoucherTime, reqVO.getVoucherTime())
.eqIfPresent(VoucherDO::getVoucherNum, reqVO.getVoucherNum())
.eqIfPresent(VoucherDO::getDigest, reqVO.getDigest())
.eqIfPresent(VoucherDO::getAudit, reqVO.getAudit())
.eqIfPresent(VoucherDO::getChecker, reqVO.getChecker())
.eqIfPresent(VoucherDO::getHandle, reqVO.getHandle())
.eqIfPresent(VoucherDO::getServiceId, reqVO.getServiceId())
.eqIfPresent(VoucherDO::getServiceExplain, reqVO.getServiceExplain())
.eqIfPresent(VoucherDO::getType, reqVO.getType())
.eqIfPresent(VoucherDO::getFlowId, reqVO.getFlowId())
.eqIfPresent(VoucherDO::getSource, reqVO.getSource())
.eqIfPresent(VoucherDO::getYear, reqVO.getYear())
.eqIfPresent(VoucherDO::getPeriod, reqVO.getPeriod())
.eqIfPresent(VoucherDO::getBorrowStatus, reqVO.getBorrowStatus())
.betweenIfPresent(VoucherDO::getRecordTime, reqVO.getRecordTime())
.eqIfPresent(VoucherDO::getPosition, reqVO.getPosition())
.eqIfPresent(VoucherDO::getCherks, reqVO.getCherks())
.eqIfPresent(VoucherDO::getUserId, reqVO.getUserId())
.eqIfPresent(VoucherDO::getRecordId, reqVO.getRecordId())
.eqIfPresent(VoucherDO::getFileStatus, reqVO.getFileStatus())
.eqIfPresent(VoucherDO::getRemark, reqVO.getRemark())
.eqIfPresent(VoucherDO::getOrganizationId, reqVO.getOrganizationId())
.eqIfPresent(VoucherDO::getDepotId, reqVO.getDepotId())
.eqIfPresent(VoucherDO::getCabinetId, reqVO.getCabinetId())
.orderByDesc(VoucherDO::getId));
}
}

@ -0,0 +1,60 @@
package cn.iocoder.yudao.module.accounting.dal.mysql.voucherdetails;
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.accounting.dal.dataobject.voucherdetails.VoucherDetailsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface VoucherDetailsMapper extends BaseMapperX<VoucherDetailsDO> {
default PageResult<VoucherDetailsDO> selectPage(VoucherDetailsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<VoucherDetailsDO>()
.eqIfPresent(VoucherDetailsDO::getLineNum, reqVO.getLineNum())
.eqIfPresent(VoucherDetailsDO::getCreateBy, reqVO.getCreateBy())
.betweenIfPresent(VoucherDetailsDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(VoucherDetailsDO::getDigest, reqVO.getDigest())
.eqIfPresent(VoucherDetailsDO::getVoucherType, reqVO.getVoucherType())
.eqIfPresent(VoucherDetailsDO::getSubjectCode, reqVO.getSubjectCode())
.likeIfPresent(VoucherDetailsDO::getSubjectName, reqVO.getSubjectName())
.eqIfPresent(VoucherDetailsDO::getAssistCheck, reqVO.getAssistCheck())
.eqIfPresent(VoucherDetailsDO::getDebitMoney, reqVO.getDebitMoney())
.eqIfPresent(VoucherDetailsDO::getCreditorMoney, reqVO.getCreditorMoney())
.eqIfPresent(VoucherDetailsDO::getFlowId, reqVO.getFlowId())
.eqIfPresent(VoucherDetailsDO::getVoucherId, reqVO.getVoucherId())
.eqIfPresent(VoucherDetailsDO::getVoucherNum, reqVO.getVoucherNum())
.eqIfPresent(VoucherDetailsDO::getUserId, reqVO.getUserId())
.eqIfPresent(VoucherDetailsDO::getFileStatus, reqVO.getFileStatus())
.orderByDesc(VoucherDetailsDO::getId));
}
default List<VoucherDetailsDO> selectList(VoucherDetailsExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<VoucherDetailsDO>()
.eqIfPresent(VoucherDetailsDO::getLineNum, reqVO.getLineNum())
.eqIfPresent(VoucherDetailsDO::getCreateBy, reqVO.getCreateBy())
.betweenIfPresent(VoucherDetailsDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(VoucherDetailsDO::getDigest, reqVO.getDigest())
.eqIfPresent(VoucherDetailsDO::getVoucherType, reqVO.getVoucherType())
.eqIfPresent(VoucherDetailsDO::getSubjectCode, reqVO.getSubjectCode())
.likeIfPresent(VoucherDetailsDO::getSubjectName, reqVO.getSubjectName())
.eqIfPresent(VoucherDetailsDO::getAssistCheck, reqVO.getAssistCheck())
.eqIfPresent(VoucherDetailsDO::getDebitMoney, reqVO.getDebitMoney())
.eqIfPresent(VoucherDetailsDO::getCreditorMoney, reqVO.getCreditorMoney())
.eqIfPresent(VoucherDetailsDO::getFlowId, reqVO.getFlowId())
.eqIfPresent(VoucherDetailsDO::getVoucherId, reqVO.getVoucherId())
.eqIfPresent(VoucherDetailsDO::getVoucherNum, reqVO.getVoucherNum())
.eqIfPresent(VoucherDetailsDO::getUserId, reqVO.getUserId())
.eqIfPresent(VoucherDetailsDO::getFileStatus, reqVO.getFileStatus())
.orderByDesc(VoucherDetailsDO::getId));
}
}

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.accounting.service.voucher;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucher.VoucherDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* Service
*
* @author
*/
public interface VoucherService {
/**
*
*
* @param createReqVO
* @return
*/
Long createVoucher(@Valid VoucherCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateVoucher(@Valid VoucherUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteVoucher(Long id);
/**
*
*
* @param id
* @return
*/
VoucherDO getVoucher(Long id);
/**
*
*
* @param ids
* @return
*/
List<VoucherDO> getVoucherList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<VoucherDO> getVoucherPage(VoucherPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<VoucherDO> getVoucherList(VoucherExportReqVO exportReqVO);
}

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.accounting.service.voucher;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucher.VoucherDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.accounting.convert.voucher.VoucherConvert;
import cn.iocoder.yudao.module.accounting.dal.mysql.voucher.VoucherMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class VoucherServiceImpl implements VoucherService {
@Resource
private VoucherMapper voucherMapper;
@Override
public Long createVoucher(VoucherCreateReqVO createReqVO) {
// 插入
VoucherDO voucher = VoucherConvert.INSTANCE.convert(createReqVO);
voucherMapper.insert(voucher);
// 返回
return voucher.getId();
}
@Override
public void updateVoucher(VoucherUpdateReqVO updateReqVO) {
// 校验存在
validateVoucherExists(updateReqVO.getId());
// 更新
VoucherDO updateObj = VoucherConvert.INSTANCE.convert(updateReqVO);
voucherMapper.updateById(updateObj);
}
@Override
public void deleteVoucher(Long id) {
// 校验存在
validateVoucherExists(id);
// 删除
voucherMapper.deleteById(id);
}
private void validateVoucherExists(Long id) {
if (voucherMapper.selectById(id) == null) {
throw exception(VOUCHER_NOT_EXISTS);
}
}
@Override
public VoucherDO getVoucher(Long id) {
return voucherMapper.selectById(id);
}
@Override
public List<VoucherDO> getVoucherList(Collection<Long> ids) {
return voucherMapper.selectBatchIds(ids);
}
@Override
public PageResult<VoucherDO> getVoucherPage(VoucherPageReqVO pageReqVO) {
return voucherMapper.selectPage(pageReqVO);
}
@Override
public List<VoucherDO> getVoucherList(VoucherExportReqVO exportReqVO) {
return voucherMapper.selectList(exportReqVO);
}
}

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.accounting.service.voucherdetails;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucherdetails.VoucherDetailsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* Service
*
* @author
*/
public interface VoucherDetailsService {
/**
*
*
* @param createReqVO
* @return
*/
Long createVoucherDetails(@Valid VoucherDetailsCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateVoucherDetails(@Valid VoucherDetailsUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteVoucherDetails(Long id);
/**
*
*
* @param id
* @return
*/
VoucherDetailsDO getVoucherDetails(Long id);
/**
*
*
* @param ids
* @return
*/
List<VoucherDetailsDO> getVoucherDetailsList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<VoucherDetailsDO> getVoucherDetailsPage(VoucherDetailsPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<VoucherDetailsDO> getVoucherDetailsList(VoucherDetailsExportReqVO exportReqVO);
}

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.accounting.service.voucherdetails;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucherdetails.VoucherDetailsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.accounting.convert.voucherdetails.VoucherDetailsConvert;
import cn.iocoder.yudao.module.accounting.dal.mysql.voucherdetails.VoucherDetailsMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class VoucherDetailsServiceImpl implements VoucherDetailsService {
@Resource
private VoucherDetailsMapper voucherDetailsMapper;
@Override
public Long createVoucherDetails(VoucherDetailsCreateReqVO createReqVO) {
// 插入
VoucherDetailsDO voucherDetails = VoucherDetailsConvert.INSTANCE.convert(createReqVO);
voucherDetailsMapper.insert(voucherDetails);
// 返回
return voucherDetails.getId();
}
@Override
public void updateVoucherDetails(VoucherDetailsUpdateReqVO updateReqVO) {
// 校验存在
validateVoucherDetailsExists(updateReqVO.getId());
// 更新
VoucherDetailsDO updateObj = VoucherDetailsConvert.INSTANCE.convert(updateReqVO);
voucherDetailsMapper.updateById(updateObj);
}
@Override
public void deleteVoucherDetails(Long id) {
// 校验存在
validateVoucherDetailsExists(id);
// 删除
voucherDetailsMapper.deleteById(id);
}
private void validateVoucherDetailsExists(Long id) {
if (voucherDetailsMapper.selectById(id) == null) {
throw exception(VOUCHER_DETAILS_NOT_EXISTS);
}
}
@Override
public VoucherDetailsDO getVoucherDetails(Long id) {
return voucherDetailsMapper.selectById(id);
}
@Override
public List<VoucherDetailsDO> getVoucherDetailsList(Collection<Long> ids) {
return voucherDetailsMapper.selectBatchIds(ids);
}
@Override
public PageResult<VoucherDetailsDO> getVoucherDetailsPage(VoucherDetailsPageReqVO pageReqVO) {
return voucherDetailsMapper.selectPage(pageReqVO);
}
@Override
public List<VoucherDetailsDO> getVoucherDetailsList(VoucherDetailsExportReqVO exportReqVO) {
return voucherDetailsMapper.selectList(exportReqVO);
}
}

@ -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.accounting.dal.mysql.voucher.VoucherMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -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.accounting.dal.mysql.voucherdetails.VoucherDetailsMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -0,0 +1,383 @@
package cn.iocoder.yudao.module.accounting.service.voucher;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import javax.annotation.Resource;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucher.VoucherDO;
import cn.iocoder.yudao.module.accounting.dal.mysql.voucher.VoucherMapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import javax.annotation.Resource;
import org.springframework.context.annotation.Import;
import java.util.*;
import java.time.LocalDateTime;
import static cn.hutool.core.util.RandomUtil.*;
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
/**
* {@link VoucherServiceImpl}
*
* @author
*/
@Import(VoucherServiceImpl.class)
public class VoucherServiceImplTest extends BaseDbUnitTest {
@Resource
private VoucherServiceImpl voucherService;
@Resource
private VoucherMapper voucherMapper;
@Test
public void testCreateVoucher_success() {
// 准备参数
VoucherCreateReqVO reqVO = randomPojo(VoucherCreateReqVO.class);
// 调用
Long voucherId = voucherService.createVoucher(reqVO);
// 断言
assertNotNull(voucherId);
// 校验记录的属性是否正确
VoucherDO voucher = voucherMapper.selectById(voucherId);
assertPojoEquals(reqVO, voucher);
}
@Test
public void testUpdateVoucher_success() {
// mock 数据
VoucherDO dbVoucher = randomPojo(VoucherDO.class);
voucherMapper.insert(dbVoucher);// @Sql: 先插入出一条存在的数据
// 准备参数
VoucherUpdateReqVO reqVO = randomPojo(VoucherUpdateReqVO.class, o -> {
o.setId(dbVoucher.getId()); // 设置更新的 ID
});
// 调用
voucherService.updateVoucher(reqVO);
// 校验是否更新正确
VoucherDO voucher = voucherMapper.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, voucher);
}
@Test
public void testUpdateVoucher_notExists() {
// 准备参数
VoucherUpdateReqVO reqVO = randomPojo(VoucherUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> voucherService.updateVoucher(reqVO), VOUCHER_NOT_EXISTS);
}
@Test
public void testDeleteVoucher_success() {
// mock 数据
VoucherDO dbVoucher = randomPojo(VoucherDO.class);
voucherMapper.insert(dbVoucher);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbVoucher.getId();
// 调用
voucherService.deleteVoucher(id);
// 校验数据不存在了
assertNull(voucherMapper.selectById(id));
}
@Test
public void testDeleteVoucher_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> voucherService.deleteVoucher(id), VOUCHER_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetVoucherPage() {
// mock 数据
VoucherDO dbVoucher = randomPojo(VoucherDO.class, o -> { // 等会查询到
o.setCreateBy(null);
o.setCreateTime(null);
o.setCompanyId(null);
o.setCompany(null);
o.setDeptId(null);
o.setDeptName(null);
o.setVoucherTime(null);
o.setVoucherNum(null);
o.setDigest(null);
o.setAudit(null);
o.setChecker(null);
o.setHandle(null);
o.setServiceId(null);
o.setServiceExplain(null);
o.setType(null);
o.setFlowId(null);
o.setSource(null);
o.setYear(null);
o.setPeriod(null);
o.setBorrowStatus(null);
o.setRecordTime(null);
o.setPosition(null);
o.setCherks(null);
o.setUserId(null);
o.setRecordId(null);
o.setFileStatus(null);
o.setRemark(null);
o.setOrganizationId(null);
o.setDepotId(null);
o.setCabinetId(null);
});
voucherMapper.insert(dbVoucher);
// 测试 createBy 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCreateBy(null)));
// 测试 createTime 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCreateTime(null)));
// 测试 companyId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCompanyId(null)));
// 测试 company 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCompany(null)));
// 测试 deptId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setDeptId(null)));
// 测试 deptName 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setDeptName(null)));
// 测试 voucherTime 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setVoucherTime(null)));
// 测试 voucherNum 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setVoucherNum(null)));
// 测试 digest 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setDigest(null)));
// 测试 audit 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setAudit(null)));
// 测试 checker 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setChecker(null)));
// 测试 handle 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setHandle(null)));
// 测试 serviceId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setServiceId(null)));
// 测试 serviceExplain 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setServiceExplain(null)));
// 测试 type 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setType(null)));
// 测试 flowId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setFlowId(null)));
// 测试 source 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setSource(null)));
// 测试 year 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setYear(null)));
// 测试 period 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setPeriod(null)));
// 测试 borrowStatus 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setBorrowStatus(null)));
// 测试 recordTime 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setRecordTime(null)));
// 测试 position 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setPosition(null)));
// 测试 cherks 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCherks(null)));
// 测试 userId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setUserId(null)));
// 测试 recordId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setRecordId(null)));
// 测试 fileStatus 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setFileStatus(null)));
// 测试 remark 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setRemark(null)));
// 测试 organizationId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setOrganizationId(null)));
// 测试 depotId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setDepotId(null)));
// 测试 cabinetId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCabinetId(null)));
// 准备参数
VoucherPageReqVO reqVO = new VoucherPageReqVO();
reqVO.setCreateBy(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setCompanyId(null);
reqVO.setCompany(null);
reqVO.setDeptId(null);
reqVO.setDeptName(null);
reqVO.setVoucherTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setVoucherNum(null);
reqVO.setDigest(null);
reqVO.setAudit(null);
reqVO.setChecker(null);
reqVO.setHandle(null);
reqVO.setServiceId(null);
reqVO.setServiceExplain(null);
reqVO.setType(null);
reqVO.setFlowId(null);
reqVO.setSource(null);
reqVO.setYear(null);
reqVO.setPeriod(null);
reqVO.setBorrowStatus(null);
reqVO.setRecordTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setPosition(null);
reqVO.setCherks(null);
reqVO.setUserId(null);
reqVO.setRecordId(null);
reqVO.setFileStatus(null);
reqVO.setRemark(null);
reqVO.setOrganizationId(null);
reqVO.setDepotId(null);
reqVO.setCabinetId(null);
// 调用
PageResult<VoucherDO> pageResult = voucherService.getVoucherPage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbVoucher, pageResult.getList().get(0));
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetVoucherList() {
// mock 数据
VoucherDO dbVoucher = randomPojo(VoucherDO.class, o -> { // 等会查询到
o.setCreateBy(null);
o.setCreateTime(null);
o.setCompanyId(null);
o.setCompany(null);
o.setDeptId(null);
o.setDeptName(null);
o.setVoucherTime(null);
o.setVoucherNum(null);
o.setDigest(null);
o.setAudit(null);
o.setChecker(null);
o.setHandle(null);
o.setServiceId(null);
o.setServiceExplain(null);
o.setType(null);
o.setFlowId(null);
o.setSource(null);
o.setYear(null);
o.setPeriod(null);
o.setBorrowStatus(null);
o.setRecordTime(null);
o.setPosition(null);
o.setCherks(null);
o.setUserId(null);
o.setRecordId(null);
o.setFileStatus(null);
o.setRemark(null);
o.setOrganizationId(null);
o.setDepotId(null);
o.setCabinetId(null);
});
voucherMapper.insert(dbVoucher);
// 测试 createBy 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCreateBy(null)));
// 测试 createTime 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCreateTime(null)));
// 测试 companyId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCompanyId(null)));
// 测试 company 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCompany(null)));
// 测试 deptId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setDeptId(null)));
// 测试 deptName 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setDeptName(null)));
// 测试 voucherTime 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setVoucherTime(null)));
// 测试 voucherNum 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setVoucherNum(null)));
// 测试 digest 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setDigest(null)));
// 测试 audit 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setAudit(null)));
// 测试 checker 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setChecker(null)));
// 测试 handle 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setHandle(null)));
// 测试 serviceId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setServiceId(null)));
// 测试 serviceExplain 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setServiceExplain(null)));
// 测试 type 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setType(null)));
// 测试 flowId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setFlowId(null)));
// 测试 source 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setSource(null)));
// 测试 year 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setYear(null)));
// 测试 period 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setPeriod(null)));
// 测试 borrowStatus 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setBorrowStatus(null)));
// 测试 recordTime 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setRecordTime(null)));
// 测试 position 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setPosition(null)));
// 测试 cherks 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCherks(null)));
// 测试 userId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setUserId(null)));
// 测试 recordId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setRecordId(null)));
// 测试 fileStatus 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setFileStatus(null)));
// 测试 remark 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setRemark(null)));
// 测试 organizationId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setOrganizationId(null)));
// 测试 depotId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setDepotId(null)));
// 测试 cabinetId 不匹配
voucherMapper.insert(cloneIgnoreId(dbVoucher, o -> o.setCabinetId(null)));
// 准备参数
VoucherExportReqVO reqVO = new VoucherExportReqVO();
reqVO.setCreateBy(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setCompanyId(null);
reqVO.setCompany(null);
reqVO.setDeptId(null);
reqVO.setDeptName(null);
reqVO.setVoucherTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setVoucherNum(null);
reqVO.setDigest(null);
reqVO.setAudit(null);
reqVO.setChecker(null);
reqVO.setHandle(null);
reqVO.setServiceId(null);
reqVO.setServiceExplain(null);
reqVO.setType(null);
reqVO.setFlowId(null);
reqVO.setSource(null);
reqVO.setYear(null);
reqVO.setPeriod(null);
reqVO.setBorrowStatus(null);
reqVO.setRecordTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setPosition(null);
reqVO.setCherks(null);
reqVO.setUserId(null);
reqVO.setRecordId(null);
reqVO.setFileStatus(null);
reqVO.setRemark(null);
reqVO.setOrganizationId(null);
reqVO.setDepotId(null);
reqVO.setCabinetId(null);
// 调用
List<VoucherDO> list = voucherService.getVoucherList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbVoucher, list.get(0));
}
}

@ -0,0 +1,263 @@
package cn.iocoder.yudao.module.accounting.service.voucherdetails;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import javax.annotation.Resource;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.accounting.controller.admin.voucherdetails.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucherdetails.VoucherDetailsDO;
import cn.iocoder.yudao.module.accounting.dal.mysql.voucherdetails.VoucherDetailsMapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import javax.annotation.Resource;
import org.springframework.context.annotation.Import;
import java.util.*;
import java.time.LocalDateTime;
import static cn.hutool.core.util.RandomUtil.*;
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
/**
* {@link VoucherDetailsServiceImpl}
*
* @author
*/
@Import(VoucherDetailsServiceImpl.class)
public class VoucherDetailsServiceImplTest extends BaseDbUnitTest {
@Resource
private VoucherDetailsServiceImpl voucherDetailsService;
@Resource
private VoucherDetailsMapper voucherDetailsMapper;
@Test
public void testCreateVoucherDetails_success() {
// 准备参数
VoucherDetailsCreateReqVO reqVO = randomPojo(VoucherDetailsCreateReqVO.class);
// 调用
Long voucherDetailsId = voucherDetailsService.createVoucherDetails(reqVO);
// 断言
assertNotNull(voucherDetailsId);
// 校验记录的属性是否正确
VoucherDetailsDO voucherDetails = voucherDetailsMapper.selectById(voucherDetailsId);
assertPojoEquals(reqVO, voucherDetails);
}
@Test
public void testUpdateVoucherDetails_success() {
// mock 数据
VoucherDetailsDO dbVoucherDetails = randomPojo(VoucherDetailsDO.class);
voucherDetailsMapper.insert(dbVoucherDetails);// @Sql: 先插入出一条存在的数据
// 准备参数
VoucherDetailsUpdateReqVO reqVO = randomPojo(VoucherDetailsUpdateReqVO.class, o -> {
o.setId(dbVoucherDetails.getId()); // 设置更新的 ID
});
// 调用
voucherDetailsService.updateVoucherDetails(reqVO);
// 校验是否更新正确
VoucherDetailsDO voucherDetails = voucherDetailsMapper.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, voucherDetails);
}
@Test
public void testUpdateVoucherDetails_notExists() {
// 准备参数
VoucherDetailsUpdateReqVO reqVO = randomPojo(VoucherDetailsUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> voucherDetailsService.updateVoucherDetails(reqVO), VOUCHER_DETAILS_NOT_EXISTS);
}
@Test
public void testDeleteVoucherDetails_success() {
// mock 数据
VoucherDetailsDO dbVoucherDetails = randomPojo(VoucherDetailsDO.class);
voucherDetailsMapper.insert(dbVoucherDetails);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbVoucherDetails.getId();
// 调用
voucherDetailsService.deleteVoucherDetails(id);
// 校验数据不存在了
assertNull(voucherDetailsMapper.selectById(id));
}
@Test
public void testDeleteVoucherDetails_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> voucherDetailsService.deleteVoucherDetails(id), VOUCHER_DETAILS_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetVoucherDetailsPage() {
// mock 数据
VoucherDetailsDO dbVoucherDetails = randomPojo(VoucherDetailsDO.class, o -> { // 等会查询到
o.setLineNum(null);
o.setCreateBy(null);
o.setCreateTime(null);
o.setDigest(null);
o.setVoucherType(null);
o.setSubjectCode(null);
o.setSubjectName(null);
o.setAssistCheck(null);
o.setDebitMoney(null);
o.setCreditorMoney(null);
o.setFlowId(null);
o.setVoucherId(null);
o.setVoucherNum(null);
o.setUserId(null);
o.setFileStatus(null);
});
voucherDetailsMapper.insert(dbVoucherDetails);
// 测试 lineNum 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setLineNum(null)));
// 测试 createBy 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setCreateBy(null)));
// 测试 createTime 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setCreateTime(null)));
// 测试 digest 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setDigest(null)));
// 测试 voucherType 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setVoucherType(null)));
// 测试 subjectCode 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setSubjectCode(null)));
// 测试 subjectName 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setSubjectName(null)));
// 测试 assistCheck 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setAssistCheck(null)));
// 测试 debitMoney 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setDebitMoney(null)));
// 测试 creditorMoney 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setCreditorMoney(null)));
// 测试 flowId 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setFlowId(null)));
// 测试 voucherId 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setVoucherId(null)));
// 测试 voucherNum 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setVoucherNum(null)));
// 测试 userId 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setUserId(null)));
// 测试 fileStatus 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setFileStatus(null)));
// 准备参数
VoucherDetailsPageReqVO reqVO = new VoucherDetailsPageReqVO();
reqVO.setLineNum(null);
reqVO.setCreateBy(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setDigest(null);
reqVO.setVoucherType(null);
reqVO.setSubjectCode(null);
reqVO.setSubjectName(null);
reqVO.setAssistCheck(null);
reqVO.setDebitMoney(null);
reqVO.setCreditorMoney(null);
reqVO.setFlowId(null);
reqVO.setVoucherId(null);
reqVO.setVoucherNum(null);
reqVO.setUserId(null);
reqVO.setFileStatus(null);
// 调用
PageResult<VoucherDetailsDO> pageResult = voucherDetailsService.getVoucherDetailsPage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbVoucherDetails, pageResult.getList().get(0));
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetVoucherDetailsList() {
// mock 数据
VoucherDetailsDO dbVoucherDetails = randomPojo(VoucherDetailsDO.class, o -> { // 等会查询到
o.setLineNum(null);
o.setCreateBy(null);
o.setCreateTime(null);
o.setDigest(null);
o.setVoucherType(null);
o.setSubjectCode(null);
o.setSubjectName(null);
o.setAssistCheck(null);
o.setDebitMoney(null);
o.setCreditorMoney(null);
o.setFlowId(null);
o.setVoucherId(null);
o.setVoucherNum(null);
o.setUserId(null);
o.setFileStatus(null);
});
voucherDetailsMapper.insert(dbVoucherDetails);
// 测试 lineNum 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setLineNum(null)));
// 测试 createBy 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setCreateBy(null)));
// 测试 createTime 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setCreateTime(null)));
// 测试 digest 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setDigest(null)));
// 测试 voucherType 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setVoucherType(null)));
// 测试 subjectCode 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setSubjectCode(null)));
// 测试 subjectName 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setSubjectName(null)));
// 测试 assistCheck 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setAssistCheck(null)));
// 测试 debitMoney 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setDebitMoney(null)));
// 测试 creditorMoney 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setCreditorMoney(null)));
// 测试 flowId 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setFlowId(null)));
// 测试 voucherId 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setVoucherId(null)));
// 测试 voucherNum 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setVoucherNum(null)));
// 测试 userId 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setUserId(null)));
// 测试 fileStatus 不匹配
voucherDetailsMapper.insert(cloneIgnoreId(dbVoucherDetails, o -> o.setFileStatus(null)));
// 准备参数
VoucherDetailsExportReqVO reqVO = new VoucherDetailsExportReqVO();
reqVO.setLineNum(null);
reqVO.setCreateBy(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setDigest(null);
reqVO.setVoucherType(null);
reqVO.setSubjectCode(null);
reqVO.setSubjectName(null);
reqVO.setAssistCheck(null);
reqVO.setDebitMoney(null);
reqVO.setCreditorMoney(null);
reqVO.setFlowId(null);
reqVO.setVoucherId(null);
reqVO.setVoucherNum(null);
reqVO.setUserId(null);
reqVO.setFileStatus(null);
// 调用
List<VoucherDetailsDO> list = voucherDetailsService.getVoucherDetailsList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbVoucherDetails, list.get(0));
}
}

@ -27,6 +27,12 @@
<artifactId>yudao-module-bs-biz</artifactId> <artifactId>yudao-module-bs-biz</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- 会计档案 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-accounting-biz</artifactId>
<version>${revision}</version>
</dependency>
<!-- 档案管理 --> <!-- 档案管理 -->
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>

Loading…
Cancel
Save