diff --git a/sql/electronic_consultation20231010.sql b/sql/electronic_consultation20231010.sql new file mode 100644 index 00000000..0f807163 --- /dev/null +++ b/sql/electronic_consultation20231010.sql @@ -0,0 +1,303 @@ +/* + Navicat MySQL Data Transfer + + Source Server : mysql5.7 + Source Server Type : MySQL + Source Server Version : 50724 + Source Host : localhost:3307 + Source Schema : lyr-one + + Target Server Type : MySQL + Target Server Version : 50724 + File Encoding : 65001 + + Date: 10/10/2023 09:43:15 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for electronic_consultation +-- ---------------------------- +DROP TABLE IF EXISTS `electronic_consultation`; +CREATE TABLE `electronic_consultation` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键\r\n', + `create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '制单人\r\n', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期\r\n', + `company_id` bigint(20) NULL DEFAULT NULL COMMENT '业务实体id\r\n', + `company` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '业务实体\r\n', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新日期\r\n', + `system_dept_id` bigint(20) NULL DEFAULT NULL COMMENT '所属部门id\r\n', + `system_dept` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属部门\r\n', + `consultation_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '咨询编号\r\n', + `consultation_type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '咨询类型\r\n', + `consultation_title` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '咨询标题\r\n', + `consultation_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '咨询内容\r\n', + `consultor_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '咨询者姓名\r\n', + `consultor_phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '咨询者电话\r\n', + `consultor_email` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '咨询者邮箱\r\n', + `consultation_time` datetime(0) NULL DEFAULT NULL COMMENT '咨询时间\r\n', + `handler` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '处理人员\r\n', + `handle_time` datetime(0) NULL DEFAULT NULL COMMENT '处理日期\r\n', + `handle_result` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '处理结果\r\n', + `year` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '年度\r\n', + `period` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '月份\r\n', + `borrow_status` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '借阅状态\r\n', + `record_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '归档时间\r\n', + `position` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '纸档位置\r\n', + `cherks` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '完整性\r\n', + `record_id` bigint(20) NULL DEFAULT NULL COMMENT '归档id\r\n', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', + `deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除', + `updater` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者', + `file_status` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '归档状态', + `tenant_id` bigint(20) NOT NULL COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '咨询档案表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for electronic_customer_complaint +-- ---------------------------- +DROP TABLE IF EXISTS `electronic_customer_complaint`; +CREATE TABLE `electronic_customer_complaint` ( + `id` bigint(255) NOT NULL AUTO_INCREMENT COMMENT '主键', + `create_by` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ' 制单人', + `creator` varchar(255) CHARACTER SET utf8 COLLATE utf8_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 utf8 COLLATE utf8_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 utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属部门', + `complaint_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客诉编号', + `customer_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户名称', + `customer_phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户电话', + `customer_email` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户邮箱', + `complaint_time` datetime(0) NULL DEFAULT NULL COMMENT '客诉时间', + `complaint_type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客诉类型', + `complaint_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客诉内容', + `handler` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '处理人', + `handle_time` datetime(0) NULL DEFAULT NULL COMMENT '处理时间', + `handle_result` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '处理结果', + `year` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '年度', + `period` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '月份', + `borrow_status` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '借阅状态', + `record_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '归档时间', + `position` varchar(255) CHARACTER SET utf8 COLLATE utf8_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 utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者', + `record_id` bigint(20) NULL DEFAULT NULL COMMENT '归档id', + `file_status` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '归档状态', + `tenant_id` bigint(20) NOT NULL COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客诉档案' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for electronic_other +-- ---------------------------- +DROP TABLE IF EXISTS `electronic_other`; +CREATE TABLE `electronic_other` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '表名', + `flow_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'OA/ERP流程编号\r\n', + `source` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件来源', + `year` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '年度', + `period` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '月份', + `business_type` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '业务类型', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `create_by` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '制单人', + `creator` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者', + `company_id` bigint(20) NULL DEFAULT NULL COMMENT '业务实体id', + `company` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '业务实体', + `del_status` varbinary(2) NULL DEFAULT NULL COMMENT '删除状态', + `suffix` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件后缀', + `file_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件地址', + `file_ap` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '绝对路径', + `flow_id` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程号', + `note` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '摘要', + `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '所属部门id', + `dept_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属部门', + `record_id` bigint(20) NULL DEFAULT NULL COMMENT '归档id', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', + `deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除', + `archive_state` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '归档状态', + `tenant_id` bigint(20) NOT NULL COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '其他档案' ROW_FORMAT = Dynamic; + +-- 菜单 SQL +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status, component_name +) +VALUES ( + '其他档案管理', '', 2, 0, 2382, + 'electronic-other', '', 'ea/electronicOther/index', 0, 'ElectronicOther' +); + +-- 按钮父菜单ID +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '其他档案查询', 'ea:electronic-other:query', 3, 1, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '其他档案创建', 'ea:electronic-other:create', 3, 2, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '其他档案更新', 'ea:electronic-other:update', 3, 3, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '其他档案删除', 'ea:electronic-other:delete', 3, 4, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '其他档案导出', 'ea:electronic-other:export', 3, 5, @parentId, + '', '', '', 0 +); + +-- 菜单 SQL +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status, component_name +) +VALUES ( + '客诉档案管理', '', 2, 0, 2382, + 'electronic-customer-complaint', '', 'ea/electronicCustomerComplaint/index', 0, 'ElectronicCustomerComplaint' +); + +-- 按钮父菜单ID +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '客诉档案查询', 'ea:electronic-customer-complaint:query', 3, 1, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '客诉档案创建', 'ea:electronic-customer-complaint:create', 3, 2, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '客诉档案更新', 'ea:electronic-customer-complaint:update', 3, 3, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '客诉档案删除', 'ea:electronic-customer-complaint:delete', 3, 4, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '客诉档案导出', 'ea:electronic-customer-complaint:export', 3, 5, @parentId, + '', '', '', 0 +); + +-- 菜单 SQL +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status, component_name +) +VALUES ( + '咨询档案管理', '', 2, 0, 2382, + 'electronic-consultation', '', 'ea/electronicConsultation/index', 0, 'ElectronicConsultation' +); + +-- 按钮父菜单ID +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '咨询档案查询', 'ea:electronic-consultation:query', 3, 1, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '咨询档案创建', 'ea:electronic-consultation:create', 3, 2, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '咨询档案更新', 'ea:electronic-consultation:update', 3, 3, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '咨询档案删除', 'ea:electronic-consultation:delete', 3, 4, @parentId, + '', '', '', 0 +); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '咨询档案导出', 'ea:electronic-consultation:export', 3, 5, @parentId, + '', '', '', 0 +); + + + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/attachment/AttachmentServiceImplTest.java b/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/attachment/AttachmentServiceImplTest.java index 0c9e511a..e69de29b 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/attachment/AttachmentServiceImplTest.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/attachment/AttachmentServiceImplTest.java @@ -1,263 +0,0 @@ -package cn.iocoder.yudao.module.accounting.service.attachment; - -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.attachment.vo.*; -import cn.iocoder.yudao.module.accounting.dal.dataobject.attachment.AttachmentDO; -import cn.iocoder.yudao.module.accounting.dal.mysql.attachment.AttachmentMapper; -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 AttachmentServiceImpl} 的单元测试类 - * - * @author 芋道源码 - */ -@Import(AttachmentServiceImpl.class) -public class AttachmentServiceImplTest extends BaseDbUnitTest { - - @Resource - private AttachmentServiceImpl attachmentService; - - @Resource - private AttachmentMapper attachmentMapper; - - @Test - public void testCreateAttachment_success() { - // 准备参数 - AttachmentCreateReqVO reqVO = randomPojo(AttachmentCreateReqVO.class); - - // 调用 - Long attachmentId = attachmentService.createAttachment(reqVO); - // 断言 - assertNotNull(attachmentId); - // 校验记录的属性是否正确 - AttachmentDO attachment = attachmentMapper.selectById(attachmentId); - assertPojoEquals(reqVO, attachment); - } - - @Test - public void testUpdateAttachment_success() { - // mock 数据 - AttachmentDO dbAttachment = randomPojo(AttachmentDO.class); - attachmentMapper.insert(dbAttachment);// @Sql: 先插入出一条存在的数据 - // 准备参数 - AttachmentUpdateReqVO reqVO = randomPojo(AttachmentUpdateReqVO.class, o -> { - o.setId(dbAttachment.getId()); // 设置更新的 ID - }); - - // 调用 - attachmentService.updateAttachment(reqVO); - // 校验是否更新正确 - AttachmentDO attachment = attachmentMapper.selectById(reqVO.getId()); // 获取最新的 - assertPojoEquals(reqVO, attachment); - } - - @Test - public void testUpdateAttachment_notExists() { - // 准备参数 - AttachmentUpdateReqVO reqVO = randomPojo(AttachmentUpdateReqVO.class); - - // 调用, 并断言异常 - assertServiceException(() -> attachmentService.updateAttachment(reqVO), ATTACHMENT_NOT_EXISTS); - } - - @Test - public void testDeleteAttachment_success() { - // mock 数据 - AttachmentDO dbAttachment = randomPojo(AttachmentDO.class); - attachmentMapper.insert(dbAttachment);// @Sql: 先插入出一条存在的数据 - // 准备参数 - Long id = dbAttachment.getId(); - - // 调用 - attachmentService.deleteAttachment(id); - // 校验数据不存在了 - assertNull(attachmentMapper.selectById(id)); - } - - @Test - public void testDeleteAttachment_notExists() { - // 准备参数 - Long id = randomLongId(); - - // 调用, 并断言异常 - assertServiceException(() -> attachmentService.deleteAttachment(id), ATTACHMENT_NOT_EXISTS); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetAttachmentPage() { - // mock 数据 - AttachmentDO dbAttachment = randomPojo(AttachmentDO.class, o -> { // 等会查询到 - o.setVoucherId(null); - o.setVoucherNum(null); - o.setCreateTime(null); - o.setCreateBy(null); - o.setCompanyId(null); - o.setCompany(null); - o.setSuffix(null); - o.setFileUrl(null); - o.setFileAp(null); - o.setFlowId(null); - o.setUserId(null); - o.setRemark(null); - o.setFlowCode(null); - o.setFileName(null); - o.setFileSize(null); - }); - attachmentMapper.insert(dbAttachment); - // 测试 voucherId 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setVoucherId(null))); - // 测试 voucherNum 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setVoucherNum(null))); - // 测试 createTime 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCreateTime(null))); - // 测试 createBy 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCreateBy(null))); - // 测试 companyId 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCompanyId(null))); - // 测试 company 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCompany(null))); - // 测试 suffix 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setSuffix(null))); - // 测试 fileUrl 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileUrl(null))); - // 测试 fileAp 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileAp(null))); - // 测试 flowId 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFlowId(null))); - // 测试 userId 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setUserId(null))); - // 测试 remark 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setRemark(null))); - // 测试 flowCode 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFlowCode(null))); - // 测试 fileName 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileName(null))); - // 测试 fileSize 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileSize(null))); - // 准备参数 - AttachmentPageReqVO reqVO = new AttachmentPageReqVO(); - reqVO.setVoucherId(null); - reqVO.setVoucherNum(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setCreateBy(null); - reqVO.setCompanyId(null); - reqVO.setCompany(null); - reqVO.setSuffix(null); - reqVO.setFileUrl(null); - reqVO.setFileAp(null); - reqVO.setFlowId(null); - reqVO.setUserId(null); - reqVO.setRemark(null); - reqVO.setFlowCode(null); - reqVO.setFileName(null); - reqVO.setFileSize(null); - - // 调用 - PageResult pageResult = attachmentService.getAttachmentPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbAttachment, pageResult.getList().get(0)); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetAttachmentList() { - // mock 数据 - AttachmentDO dbAttachment = randomPojo(AttachmentDO.class, o -> { // 等会查询到 - o.setVoucherId(null); - o.setVoucherNum(null); - o.setCreateTime(null); - o.setCreateBy(null); - o.setCompanyId(null); - o.setCompany(null); - o.setSuffix(null); - o.setFileUrl(null); - o.setFileAp(null); - o.setFlowId(null); - o.setUserId(null); - o.setRemark(null); - o.setFlowCode(null); - o.setFileName(null); - o.setFileSize(null); - }); - attachmentMapper.insert(dbAttachment); - // 测试 voucherId 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setVoucherId(null))); - // 测试 voucherNum 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setVoucherNum(null))); - // 测试 createTime 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCreateTime(null))); - // 测试 createBy 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCreateBy(null))); - // 测试 companyId 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCompanyId(null))); - // 测试 company 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCompany(null))); - // 测试 suffix 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setSuffix(null))); - // 测试 fileUrl 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileUrl(null))); - // 测试 fileAp 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileAp(null))); - // 测试 flowId 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFlowId(null))); - // 测试 userId 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setUserId(null))); - // 测试 remark 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setRemark(null))); - // 测试 flowCode 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFlowCode(null))); - // 测试 fileName 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileName(null))); - // 测试 fileSize 不匹配 - attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileSize(null))); - // 准备参数 - AttachmentExportReqVO reqVO = new AttachmentExportReqVO(); - reqVO.setVoucherId(null); - reqVO.setVoucherNum(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setCreateBy(null); - reqVO.setCompanyId(null); - reqVO.setCompany(null); - reqVO.setSuffix(null); - reqVO.setFileUrl(null); - reqVO.setFileAp(null); - reqVO.setFlowId(null); - reqVO.setUserId(null); - reqVO.setRemark(null); - reqVO.setFlowCode(null); - reqVO.setFileName(null); - reqVO.setFileSize(null); - - // 调用 - List list = attachmentService.getAttachmentList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbAttachment, list.get(0)); - } - -} diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImplTest.java b/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImplTest.java index 9a980b82..e69de29b 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImplTest.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/test/java/cn/iocoder/yudao/module/accounting/service/other/OtherServiceImplTest.java @@ -1,311 +0,0 @@ -package cn.iocoder.yudao.module.accounting.service.other; - -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.other.vo.*; -import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO; -import cn.iocoder.yudao.module.accounting.dal.mysql.other.OtherMapper; -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 OtherServiceImpl} 的单元测试类 - * - * @author 芋道源码 - */ -@Import(OtherServiceImpl.class) -public class OtherServiceImplTest extends BaseDbUnitTest { - - @Resource - private OtherServiceImpl otherService; - - @Resource - private OtherMapper otherMapper; - - @Test - public void testCreateOther_success() { - // 准备参数 - OtherCreateReqVO reqVO = randomPojo(OtherCreateReqVO.class); - - // 调用 - Long otherId = otherService.createOther(reqVO); - // 断言 - assertNotNull(otherId); - // 校验记录的属性是否正确 - OtherDO other = otherMapper.selectById(otherId); - assertPojoEquals(reqVO, other); - } - - @Test - public void testUpdateOther_success() { - // mock 数据 - OtherDO dbOther = randomPojo(OtherDO.class); - otherMapper.insert(dbOther);// @Sql: 先插入出一条存在的数据 - // 准备参数 - OtherUpdateReqVO reqVO = randomPojo(OtherUpdateReqVO.class, o -> { - o.setId(dbOther.getId()); // 设置更新的 ID - }); - - // 调用 - otherService.updateOther(reqVO); - // 校验是否更新正确 - OtherDO other = otherMapper.selectById(reqVO.getId()); // 获取最新的 - assertPojoEquals(reqVO, other); - } - - @Test - public void testUpdateOther_notExists() { - // 准备参数 - OtherUpdateReqVO reqVO = randomPojo(OtherUpdateReqVO.class); - - // 调用, 并断言异常 - assertServiceException(() -> otherService.updateOther(reqVO), OTHER_NOT_EXISTS); - } - - @Test - public void testDeleteOther_success() { - // mock 数据 - OtherDO dbOther = randomPojo(OtherDO.class); - otherMapper.insert(dbOther);// @Sql: 先插入出一条存在的数据 - // 准备参数 - Long id = dbOther.getId(); - - // 调用 - otherService.deleteOther(id); - // 校验数据不存在了 - assertNull(otherMapper.selectById(id)); - } - - @Test - public void testDeleteOther_notExists() { - // 准备参数 - Long id = randomLongId(); - - // 调用, 并断言异常 - assertServiceException(() -> otherService.deleteOther(id), OTHER_NOT_EXISTS); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetOtherPage() { - // mock 数据 - OtherDO dbOther = randomPojo(OtherDO.class, o -> { // 等会查询到 - o.setName(null); - o.setFlowCode(null); - o.setSource(null); - o.setYear(null); - o.setPeriod(null); - o.setBusinessType(null); - o.setCreateTime(null); - o.setCreateBy(null); - o.setCompanyId(null); - o.setCompany(null); - o.setSuffix(null); - o.setFileUrl(null); - o.setFileAp(null); - o.setFlowId(null); - o.setNote(null); - o.setDeptId(null); - o.setDeptName(null); - o.setRecordId(null); - o.setUserId(null); - o.setArchiveState(null); - o.setRemark(null); - }); - otherMapper.insert(dbOther); - // 测试 name 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setName(null))); - // 测试 flowCode 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowCode(null))); - // 测试 source 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSource(null))); - // 测试 year 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setYear(null))); - // 测试 period 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setPeriod(null))); - // 测试 businessType 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setBusinessType(null))); - // 测试 createTime 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateTime(null))); - // 测试 createBy 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateBy(null))); - // 测试 companyId 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompanyId(null))); - // 测试 company 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompany(null))); - // 测试 suffix 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSuffix(null))); - // 测试 fileUrl 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileUrl(null))); - // 测试 fileAp 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileAp(null))); - // 测试 flowId 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowId(null))); - // 测试 note 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setNote(null))); - // 测试 deptId 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptId(null))); - // 测试 deptName 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptName(null))); - // 测试 recordId 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRecordId(null))); - // 测试 userId 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setUserId(null))); - // 测试 archiveState 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setArchiveState(null))); - // 测试 remark 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRemark(null))); - // 准备参数 - OtherPageReqVO reqVO = new OtherPageReqVO(); - reqVO.setName(null); - reqVO.setFlowCode(null); - reqVO.setSource(null); - reqVO.setYear(null); - reqVO.setPeriod(null); - reqVO.setBusinessType(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setCreateBy(null); - reqVO.setCompanyId(null); - reqVO.setCompany(null); - reqVO.setSuffix(null); - reqVO.setFileUrl(null); - reqVO.setFileAp(null); - reqVO.setFlowId(null); - reqVO.setNote(null); - reqVO.setDeptId(null); - reqVO.setDeptName(null); - reqVO.setRecordId(null); - reqVO.setUserId(null); - reqVO.setArchiveState(null); - reqVO.setRemark(null); - - // 调用 - PageResult pageResult = otherService.getOtherPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbOther, pageResult.getList().get(0)); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetOtherList() { - // mock 数据 - OtherDO dbOther = randomPojo(OtherDO.class, o -> { // 等会查询到 - o.setName(null); - o.setFlowCode(null); - o.setSource(null); - o.setYear(null); - o.setPeriod(null); - o.setBusinessType(null); - o.setCreateTime(null); - o.setCreateBy(null); - o.setCompanyId(null); - o.setCompany(null); - o.setSuffix(null); - o.setFileUrl(null); - o.setFileAp(null); - o.setFlowId(null); - o.setNote(null); - o.setDeptId(null); - o.setDeptName(null); - o.setRecordId(null); - o.setUserId(null); - o.setArchiveState(null); - o.setRemark(null); - }); - otherMapper.insert(dbOther); - // 测试 name 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setName(null))); - // 测试 flowCode 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowCode(null))); - // 测试 source 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSource(null))); - // 测试 year 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setYear(null))); - // 测试 period 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setPeriod(null))); - // 测试 businessType 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setBusinessType(null))); - // 测试 createTime 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateTime(null))); - // 测试 createBy 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateBy(null))); - // 测试 companyId 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompanyId(null))); - // 测试 company 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompany(null))); - // 测试 suffix 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSuffix(null))); - // 测试 fileUrl 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileUrl(null))); - // 测试 fileAp 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileAp(null))); - // 测试 flowId 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowId(null))); - // 测试 note 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setNote(null))); - // 测试 deptId 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptId(null))); - // 测试 deptName 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptName(null))); - // 测试 recordId 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRecordId(null))); - // 测试 userId 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setUserId(null))); - // 测试 archiveState 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setArchiveState(null))); - // 测试 remark 不匹配 - otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRemark(null))); - // 准备参数 - OtherExportReqVO reqVO = new OtherExportReqVO(); - reqVO.setName(null); - reqVO.setFlowCode(null); - reqVO.setSource(null); - reqVO.setYear(null); - reqVO.setPeriod(null); - reqVO.setBusinessType(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setCreateBy(null); - reqVO.setCompanyId(null); - reqVO.setCompany(null); - reqVO.setSuffix(null); - reqVO.setFileUrl(null); - reqVO.setFileAp(null); - reqVO.setFlowId(null); - reqVO.setNote(null); - reqVO.setDeptId(null); - reqVO.setDeptName(null); - reqVO.setRecordId(null); - reqVO.setUserId(null); - reqVO.setArchiveState(null); - reqVO.setRemark(null); - - // 调用 - List list = otherService.getOtherList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbOther, list.get(0)); - } - -} diff --git a/yudao-module-electronic/yudao-module-ea-api/src/main/java/cn/iocoder/yudao/module/ea/enums/ErrorCodeConstants.java b/yudao-module-electronic/yudao-module-ea-api/src/main/java/cn/iocoder/yudao/module/ea/enums/ErrorCodeConstants.java index fbf45da7..673247a2 100644 --- a/yudao-module-electronic/yudao-module-ea-api/src/main/java/cn/iocoder/yudao/module/ea/enums/ErrorCodeConstants.java +++ b/yudao-module-electronic/yudao-module-ea-api/src/main/java/cn/iocoder/yudao/module/ea/enums/ErrorCodeConstants.java @@ -11,4 +11,5 @@ public interface ErrorCodeConstants { ErrorCode ELECTRONIC_EMPLOYEE_NOT_EXISTS = new ErrorCode(300012, "员工档案不存在"); ErrorCode ELECTRONIC_CONSULTATION_NOT_EXISTS = new ErrorCode(300013, "咨询档案不存在"); ErrorCode ELECTRONIC_CUSTOMER_COMPLAINT_NOT_EXISTS = new ErrorCode(300014, "客诉档案不存在"); + ErrorCode ELECTRONIC_OTHER_NOT_EXISTS = new ErrorCode(300015, "其他档案不存在"); } diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/ElectronicOtherController.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/ElectronicOtherController.java new file mode 100644 index 00000000..7571c695 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/ElectronicOtherController.java @@ -0,0 +1,102 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicother; + +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.electronicother.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicother.ElectronicOtherDO; +import cn.iocoder.yudao.module.ea.convert.electronicother.ElectronicOtherConvert; +import cn.iocoder.yudao.module.ea.service.electronicother.ElectronicOtherService; + +@Tag(name = "管理后台 - 其他档案") +@RestController +@RequestMapping("/ea/electronic-other") +@Validated +public class ElectronicOtherController { + + @Resource + private ElectronicOtherService electronicOtherService; + + @PostMapping("/create") + @Operation(summary = "创建其他档案") + @PreAuthorize("@ss.hasPermission('ea:electronic-other:create')") + public CommonResult createElectronicOther(@Valid @RequestBody ElectronicOtherCreateReqVO createReqVO) { + return success(electronicOtherService.createElectronicOther(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新其他档案") + @PreAuthorize("@ss.hasPermission('ea:electronic-other:update')") + public CommonResult updateElectronicOther(@Valid @RequestBody ElectronicOtherUpdateReqVO updateReqVO) { + electronicOtherService.updateElectronicOther(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除其他档案") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('ea:electronic-other:delete')") + public CommonResult deleteElectronicOther(@RequestParam("id") Long id) { + electronicOtherService.deleteElectronicOther(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得其他档案") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('ea:electronic-other:query')") + public CommonResult getElectronicOther(@RequestParam("id") Long id) { + ElectronicOtherDO electronicOther = electronicOtherService.getElectronicOther(id); + return success(ElectronicOtherConvert.INSTANCE.convert(electronicOther)); + } + + @GetMapping("/list") + @Operation(summary = "获得其他档案列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('ea:electronic-other:query')") + public CommonResult> getElectronicOtherList(@RequestParam("ids") Collection ids) { + List list = electronicOtherService.getElectronicOtherList(ids); + return success(ElectronicOtherConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得其他档案分页") + @PreAuthorize("@ss.hasPermission('ea:electronic-other:query')") + public CommonResult> getElectronicOtherPage(@Valid ElectronicOtherPageReqVO pageVO) { + PageResult pageResult = electronicOtherService.getElectronicOtherPage(pageVO); + return success(ElectronicOtherConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出其他档案 Excel") + @PreAuthorize("@ss.hasPermission('ea:electronic-other:export')") + @OperateLog(type = EXPORT) + public void exportElectronicOtherExcel(@Valid ElectronicOtherExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = electronicOtherService.getElectronicOtherList(exportReqVO); + // 导出 Excel + List datas = ElectronicOtherConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "其他档案.xls", "数据", ElectronicOtherExcelVO.class, datas); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherBaseVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherBaseVO.java new file mode 100644 index 00000000..91f9ef42 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherBaseVO.java @@ -0,0 +1,59 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicother.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 ElectronicOtherBaseVO { + + @Schema(description = "表名", example = "李四") + private String name; + + @Schema(description = "文件来源") + private String source; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "业务类型", example = "2") + private String businessType; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "删除状态", example = "2") + private byte[] delStatus; + + @Schema(description = "文件后缀") + private String suffix; + + @Schema(description = "文件地址", example = "https://www.iocoder.cn") + private String fileUrl; + + @Schema(description = "绝对路径") + private String fileAp; + + @Schema(description = "摘要") + private String note; + + @Schema(description = "所属部门", example = "张三") + private String deptName; + + @Schema(description = "归档状态") + private String archiveState; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherCreateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherCreateReqVO.java new file mode 100644 index 00000000..370f190b --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicother.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 ElectronicOtherCreateReqVO extends ElectronicOtherBaseVO { + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherExcelVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherExcelVO.java new file mode 100644 index 00000000..a1d39866 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherExcelVO.java @@ -0,0 +1,67 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicother.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 ElectronicOtherExcelVO { + + @ExcelProperty("主键") + private Long id; + + @ExcelProperty("表名") + private String name; + + @ExcelProperty("文件来源") + private String source; + + @ExcelProperty("年度") + private String year; + + @ExcelProperty("月份") + private String period; + + @ExcelProperty("业务类型") + private String businessType; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @ExcelProperty("制单人") + private String createBy; + + @ExcelProperty("业务实体") + private String company; + + @ExcelProperty("删除状态") + private byte[] delStatus; + + @ExcelProperty("文件后缀") + private String suffix; + + @ExcelProperty("文件地址") + private String fileUrl; + + @ExcelProperty("绝对路径") + private String fileAp; + + @ExcelProperty("摘要") + private String note; + + @ExcelProperty("所属部门") + private String deptName; + + @ExcelProperty("归档状态") + private String archiveState; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherExportReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherExportReqVO.java new file mode 100644 index 00000000..2df50cfc --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherExportReqVO.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicother.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,参数和 ElectronicOtherPageReqVO 是一致的") +@Data +public class ElectronicOtherExportReqVO { + + @Schema(description = "表名", example = "李四") + private String name; + + @Schema(description = "文件来源") + private String source; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "业务类型", example = "2") + private String businessType; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "删除状态", example = "2") + private byte[] delStatus; + + @Schema(description = "文件后缀") + private String suffix; + + @Schema(description = "文件地址", example = "https://www.iocoder.cn") + private String fileUrl; + + @Schema(description = "绝对路径") + private String fileAp; + + @Schema(description = "摘要") + private String note; + + @Schema(description = "所属部门", example = "张三") + private String deptName; + + @Schema(description = "归档状态") + private String archiveState; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherPageReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherPageReqVO.java new file mode 100644 index 00000000..210df0d2 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherPageReqVO.java @@ -0,0 +1,64 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicother.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 ElectronicOtherPageReqVO extends PageParam { + + @Schema(description = "表名", example = "李四") + private String name; + + @Schema(description = "文件来源") + private String source; + + @Schema(description = "年度") + private String year; + + @Schema(description = "月份") + private String period; + + @Schema(description = "业务类型", example = "2") + private String businessType; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "删除状态", example = "2") + private byte[] delStatus; + + @Schema(description = "文件后缀") + private String suffix; + + @Schema(description = "文件地址", example = "https://www.iocoder.cn") + private String fileUrl; + + @Schema(description = "绝对路径") + private String fileAp; + + @Schema(description = "摘要") + private String note; + + @Schema(description = "所属部门", example = "张三") + private String deptName; + + @Schema(description = "归档状态") + private String archiveState; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherRespVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherRespVO.java new file mode 100644 index 00000000..423e4d04 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicother.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 ElectronicOtherRespVO extends ElectronicOtherBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "29291") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherUpdateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherUpdateReqVO.java new file mode 100644 index 00000000..294344fe --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicother/vo/ElectronicOtherUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.ea.controller.admin.electronicother.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 ElectronicOtherUpdateReqVO extends ElectronicOtherBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "29291") + @NotNull(message = "主键不能为空") + private Long id; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicother/ElectronicOtherConvert.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicother/ElectronicOtherConvert.java new file mode 100644 index 00000000..5775822d --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/convert/electronicother/ElectronicOtherConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.ea.convert.electronicother; + +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.electronicother.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicother.ElectronicOtherDO; + +/** + * 其他档案 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ElectronicOtherConvert { + + ElectronicOtherConvert INSTANCE = Mappers.getMapper(ElectronicOtherConvert.class); + + ElectronicOtherDO convert(ElectronicOtherCreateReqVO bean); + + ElectronicOtherDO convert(ElectronicOtherUpdateReqVO bean); + + ElectronicOtherRespVO convert(ElectronicOtherDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electronicother/ElectronicOtherDO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electronicother/ElectronicOtherDO.java new file mode 100644 index 00000000..c450131a --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/dataobject/electronicother/ElectronicOtherDO.java @@ -0,0 +1,111 @@ +package cn.iocoder.yudao.module.ea.dal.dataobject.electronicother; + +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("electronic_other") +@KeySequence("electronic_other_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ElectronicOtherDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 表名 + */ + private String name; + /** + * OA/ERP流程编号 + */ + private String flowCode; + /** + * 文件来源 + */ + private String source; + /** + * 年度 + */ + private String year; + /** + * 月份 + */ + private String period; + /** + * 业务类型 + */ + private String businessType; + /** + * 制单人 + */ + private String createBy; + /** + * 业务实体id + */ + private Long companyId; + /** + * 业务实体 + */ + private String company; + /** + * 删除状态 + */ + private byte[] delStatus; + /** + * 文件后缀 + */ + private String suffix; + /** + * 文件地址 + */ + private String fileUrl; + /** + * 绝对路径 + */ + private String fileAp; + /** + * 流程号 + */ + private String flowId; + /** + * 摘要 + */ + private String note; + /** + * 所属部门id + */ + private Long deptId; + /** + * 所属部门 + */ + private String deptName; + /** + * 归档id + */ + private Long recordId; + /** + * 用户id + */ + private Long userId; + /** + * 归档状态 + */ + private String archiveState; + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicother/ElectronicOtherMapper.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicother/ElectronicOtherMapper.java new file mode 100644 index 00000000..c2d9b541 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/dal/mysql/electronicother/ElectronicOtherMapper.java @@ -0,0 +1,60 @@ +package cn.iocoder.yudao.module.ea.dal.mysql.electronicother; + +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.electronicother.ElectronicOtherDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo.*; + +/** + * 其他档案 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ElectronicOtherMapper extends BaseMapperX { + + default PageResult selectPage(ElectronicOtherPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(ElectronicOtherDO::getName, reqVO.getName()) + .eqIfPresent(ElectronicOtherDO::getSource, reqVO.getSource()) + .eqIfPresent(ElectronicOtherDO::getYear, reqVO.getYear()) + .eqIfPresent(ElectronicOtherDO::getPeriod, reqVO.getPeriod()) + .eqIfPresent(ElectronicOtherDO::getBusinessType, reqVO.getBusinessType()) + .betweenIfPresent(ElectronicOtherDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ElectronicOtherDO::getCreateBy, reqVO.getCreateBy()) + .eqIfPresent(ElectronicOtherDO::getCompany, reqVO.getCompany()) + .eqIfPresent(ElectronicOtherDO::getDelStatus, reqVO.getDelStatus()) + .eqIfPresent(ElectronicOtherDO::getSuffix, reqVO.getSuffix()) + .eqIfPresent(ElectronicOtherDO::getFileUrl, reqVO.getFileUrl()) + .eqIfPresent(ElectronicOtherDO::getFileAp, reqVO.getFileAp()) + .eqIfPresent(ElectronicOtherDO::getNote, reqVO.getNote()) + .likeIfPresent(ElectronicOtherDO::getDeptName, reqVO.getDeptName()) + .eqIfPresent(ElectronicOtherDO::getArchiveState, reqVO.getArchiveState()) + .orderByDesc(ElectronicOtherDO::getId)); + } + + default List selectList(ElectronicOtherExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(ElectronicOtherDO::getName, reqVO.getName()) + .eqIfPresent(ElectronicOtherDO::getSource, reqVO.getSource()) + .eqIfPresent(ElectronicOtherDO::getYear, reqVO.getYear()) + .eqIfPresent(ElectronicOtherDO::getPeriod, reqVO.getPeriod()) + .eqIfPresent(ElectronicOtherDO::getBusinessType, reqVO.getBusinessType()) + .betweenIfPresent(ElectronicOtherDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ElectronicOtherDO::getCreateBy, reqVO.getCreateBy()) + .eqIfPresent(ElectronicOtherDO::getCompany, reqVO.getCompany()) + .eqIfPresent(ElectronicOtherDO::getDelStatus, reqVO.getDelStatus()) + .eqIfPresent(ElectronicOtherDO::getSuffix, reqVO.getSuffix()) + .eqIfPresent(ElectronicOtherDO::getFileUrl, reqVO.getFileUrl()) + .eqIfPresent(ElectronicOtherDO::getFileAp, reqVO.getFileAp()) + .eqIfPresent(ElectronicOtherDO::getNote, reqVO.getNote()) + .likeIfPresent(ElectronicOtherDO::getDeptName, reqVO.getDeptName()) + .eqIfPresent(ElectronicOtherDO::getArchiveState, reqVO.getArchiveState()) + .orderByDesc(ElectronicOtherDO::getId)); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicother/ElectronicOtherService.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicother/ElectronicOtherService.java new file mode 100644 index 00000000..3d6d76a7 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicother/ElectronicOtherService.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.ea.service.electronicother; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicother.ElectronicOtherDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 其他档案 Service 接口 + * + * @author 芋道源码 + */ +public interface ElectronicOtherService { + + /** + * 创建其他档案 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createElectronicOther(@Valid ElectronicOtherCreateReqVO createReqVO); + + /** + * 更新其他档案 + * + * @param updateReqVO 更新信息 + */ + void updateElectronicOther(@Valid ElectronicOtherUpdateReqVO updateReqVO); + + /** + * 删除其他档案 + * + * @param id 编号 + */ + void deleteElectronicOther(Long id); + + /** + * 获得其他档案 + * + * @param id 编号 + * @return 其他档案 + */ + ElectronicOtherDO getElectronicOther(Long id); + + /** + * 获得其他档案列表 + * + * @param ids 编号 + * @return 其他档案列表 + */ + List getElectronicOtherList(Collection ids); + + /** + * 获得其他档案分页 + * + * @param pageReqVO 分页查询 + * @return 其他档案分页 + */ + PageResult getElectronicOtherPage(ElectronicOtherPageReqVO pageReqVO); + + /** + * 获得其他档案列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 其他档案列表 + */ + List getElectronicOtherList(ElectronicOtherExportReqVO exportReqVO); + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicother/ElectronicOtherServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicother/ElectronicOtherServiceImpl.java new file mode 100644 index 00000000..ae9ff53a --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicother/ElectronicOtherServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.ea.service.electronicother; + +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.electronicother.vo.*; +import cn.iocoder.yudao.module.ea.dal.dataobject.electronicother.ElectronicOtherDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.ea.convert.electronicother.ElectronicOtherConvert; +import cn.iocoder.yudao.module.ea.dal.mysql.electronicother.ElectronicOtherMapper; + +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 ElectronicOtherServiceImpl implements ElectronicOtherService { + + @Resource + private ElectronicOtherMapper electronicOtherMapper; + + @Override + public Long createElectronicOther(ElectronicOtherCreateReqVO createReqVO) { + // 插入 + ElectronicOtherDO electronicOther = ElectronicOtherConvert.INSTANCE.convert(createReqVO); + electronicOtherMapper.insert(electronicOther); + // 返回 + return electronicOther.getId(); + } + + @Override + public void updateElectronicOther(ElectronicOtherUpdateReqVO updateReqVO) { + // 校验存在 + validateElectronicOtherExists(updateReqVO.getId()); + // 更新 + ElectronicOtherDO updateObj = ElectronicOtherConvert.INSTANCE.convert(updateReqVO); + electronicOtherMapper.updateById(updateObj); + } + + @Override + public void deleteElectronicOther(Long id) { + // 校验存在 + validateElectronicOtherExists(id); + // 删除 + electronicOtherMapper.deleteById(id); + } + + private void validateElectronicOtherExists(Long id) { + if (electronicOtherMapper.selectById(id) == null) { + throw exception(ELECTRONIC_OTHER_NOT_EXISTS); + } + } + + @Override + public ElectronicOtherDO getElectronicOther(Long id) { + return electronicOtherMapper.selectById(id); + } + + @Override + public List getElectronicOtherList(Collection ids) { + return electronicOtherMapper.selectBatchIds(ids); + } + + @Override + public PageResult getElectronicOtherPage(ElectronicOtherPageReqVO pageReqVO) { + return electronicOtherMapper.selectPage(pageReqVO); + } + + @Override + public List getElectronicOtherList(ElectronicOtherExportReqVO exportReqVO) { + return electronicOtherMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electroniccustomercomplaint/ElectronicCustomerComplaintMapper.xml b/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electroniccustomercomplaint/ElectronicCustomerComplaintMapper.xml new file mode 100644 index 00000000..3f87d9ea --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electroniccustomercomplaint/ElectronicCustomerComplaintMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electronicother/ElectronicOtherMapper.xml b/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electronicother/ElectronicOtherMapper.xml new file mode 100644 index 00000000..d54cdcc9 --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/resources/mapper/electronicother/ElectronicOtherMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-setting/yudao-module-setting-biz/src/test/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImplTest.java b/yudao-module-setting/yudao-module-setting-biz/src/test/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImplTest.java index d44a380a..e69de29b 100644 --- a/yudao-module-setting/yudao-module-setting-biz/src/test/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImplTest.java +++ b/yudao-module-setting/yudao-module-setting-biz/src/test/java/cn/iocoder/yudao/module/setting/service/detection/DetectionServiceImplTest.java @@ -1,231 +0,0 @@ -package cn.iocoder.yudao.module.setting.service.detection; - -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.setting.controller.admin.detection.vo.*; -import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO; -import cn.iocoder.yudao.module.setting.dal.mysql.detection.DetectionMapper; -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.setting.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 DetectionServiceImpl} 的单元测试类 - * - * @author devin1 - */ -@Import(DetectionServiceImpl.class) -public class DetectionServiceImplTest extends BaseDbUnitTest { - - @Resource - private DetectionServiceImpl detectionService; - - @Resource - private DetectionMapper detectionMapper; - - @Test - public void testCreateDetection_success() { - // 准备参数 - DetectionCreateReqVO reqVO = randomPojo(DetectionCreateReqVO.class); - - // 调用 - Long detectionId = detectionService.createDetection(reqVO); - // 断言 - assertNotNull(detectionId); - // 校验记录的属性是否正确 - DetectionDO detection = detectionMapper.selectById(detectionId); - assertPojoEquals(reqVO, detection); - } - - @Test - public void testUpdateDetection_success() { - // mock 数据 - DetectionDO dbDetection = randomPojo(DetectionDO.class); - detectionMapper.insert(dbDetection);// @Sql: 先插入出一条存在的数据 - // 准备参数 - DetectionUpdateReqVO reqVO = randomPojo(DetectionUpdateReqVO.class, o -> { - o.setId(dbDetection.getId()); // 设置更新的 ID - }); - - // 调用 - detectionService.updateDetection(reqVO); - // 校验是否更新正确 - DetectionDO detection = detectionMapper.selectById(reqVO.getId()); // 获取最新的 - assertPojoEquals(reqVO, detection); - } - - @Test - public void testUpdateDetection_notExists() { - // 准备参数 - DetectionUpdateReqVO reqVO = randomPojo(DetectionUpdateReqVO.class); - - // 调用, 并断言异常 - assertServiceException(() -> detectionService.updateDetection(reqVO), DETECTION_NOT_EXISTS); - } - - @Test - public void testDeleteDetection_success() { - // mock 数据 - DetectionDO dbDetection = randomPojo(DetectionDO.class); - detectionMapper.insert(dbDetection);// @Sql: 先插入出一条存在的数据 - // 准备参数 - Long id = dbDetection.getId(); - - // 调用 - detectionService.deleteDetection(id); - // 校验数据不存在了 - assertNull(detectionMapper.selectById(id)); - } - - @Test - public void testDeleteDetection_notExists() { - // 准备参数 - Long id = randomLongId(); - - // 调用, 并断言异常 - assertServiceException(() -> detectionService.deleteDetection(id), DETECTION_NOT_EXISTS); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetDetectionPage() { - // mock 数据 - DetectionDO dbDetection = randomPojo(DetectionDO.class, o -> { // 等会查询到 - o.setOneType(null); - o.setTwoType(null); - o.setCode(null); - o.setName(null); - o.setPurpose(null); - o.setObjects(null); - o.setMethods(null); - o.setEnableFlag(null); - o.setRemark(null); - o.setCreateTime(null); - o.setCreateBy(null); - }); - detectionMapper.insert(dbDetection); - // 测试 oneType 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setOneType(null))); - // 测试 twoType 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setTwoType(null))); - // 测试 code 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCode(null))); - // 测试 name 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setName(null))); - // 测试 purpose 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setPurpose(null))); - // 测试 objects 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setObjects(null))); - // 测试 methods 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setMethods(null))); - // 测试 enableFlag 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setEnableFlag(null))); - // 测试 remark 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setRemark(null))); - // 测试 createTime 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateTime(null))); - // 测试 createBy 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateBy(null))); - // 准备参数 - DetectionPageReqVO reqVO = new DetectionPageReqVO(); - reqVO.setOneType(null); - reqVO.setTwoType(null); - reqVO.setCode(null); - reqVO.setName(null); - reqVO.setPurpose(null); - reqVO.setObjects(null); - reqVO.setMethods(null); - reqVO.setEnableFlag(null); - reqVO.setRemark(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setCreateBy(null); - - // 调用 - PageResult pageResult = detectionService.getDetectionPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbDetection, pageResult.getList().get(0)); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetDetectionList() { - // mock 数据 - DetectionDO dbDetection = randomPojo(DetectionDO.class, o -> { // 等会查询到 - o.setOneType(null); - o.setTwoType(null); - o.setCode(null); - o.setName(null); - o.setPurpose(null); - o.setObjects(null); - o.setMethods(null); - o.setEnableFlag(null); - o.setRemark(null); - o.setCreateTime(null); - o.setCreateBy(null); - }); - detectionMapper.insert(dbDetection); - // 测试 oneType 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setOneType(null))); - // 测试 twoType 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setTwoType(null))); - // 测试 code 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCode(null))); - // 测试 name 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setName(null))); - // 测试 purpose 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setPurpose(null))); - // 测试 objects 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setObjects(null))); - // 测试 methods 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setMethods(null))); - // 测试 enableFlag 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setEnableFlag(null))); - // 测试 remark 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setRemark(null))); - // 测试 createTime 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateTime(null))); - // 测试 createBy 不匹配 - detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateBy(null))); - // 准备参数 - DetectionExportReqVO reqVO = new DetectionExportReqVO(); - reqVO.setOneType(null); - reqVO.setTwoType(null); - reqVO.setCode(null); - reqVO.setName(null); - reqVO.setPurpose(null); - reqVO.setObjects(null); - reqVO.setMethods(null); - reqVO.setEnableFlag(null); - reqVO.setRemark(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setCreateBy(null); - - // 调用 - List list = detectionService.getDetectionList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbDetection, list.get(0)); - } - -}