From 70006d235a57433f05b7b83928aa5475a91f9af4 Mon Sep 17 00:00:00 2001 From: JilingLee <18850011309@139.com> Date: Thu, 14 Sep 2023 17:39:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=A7=BB=E4=BA=A4=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/archives20230914JilingLee.sql | 71 ++++ .../archives/enums/ArchivesStatusEnum.java | 30 ++ .../module/archives/enums/BillTypeEnum.java | 33 ++ .../archives/enums/ErrorCodeConstants.java | 1 + .../yudao-module-archives-biz/pom.xml | 13 + .../admin/turnover/TurnOverController.java | 133 +++++++ .../admin/turnover/vo/TurnOverBaseVO.java | 97 +++++ .../turnover/vo/TurnOverCreateReqVO.java | 21 ++ .../admin/turnover/vo/TurnOverExcelVO.java | 101 +++++ .../turnover/vo/TurnOverExportReqVO.java | 96 +++++ .../admin/turnover/vo/TurnOverPageReqVO.java | 98 +++++ .../admin/turnover/vo/TurnOverRespVO.java | 19 + .../turnover/vo/TurnOverUpdateReqVO.java | 20 + .../convert/turnover/TurnOverConvert.java | 34 ++ .../dal/dataobject/turnover/TurnOverDO.java | 148 ++++++++ .../dal/mysql/turnover/TurnOverMapper.java | 82 ++++ .../service/turnover/TurnOverService.java | 72 ++++ .../service/turnover/TurnOverServiceImpl.java | 124 ++++++ .../mapper/turnover/TurnOverMapper.xml | 12 + .../turnover/TurnOverServiceImplTest.java | 352 ++++++++++++++++++ 20 files changed, 1557 insertions(+) create mode 100644 sql/archives20230914JilingLee.sql create mode 100644 yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ArchivesStatusEnum.java create mode 100644 yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/BillTypeEnum.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/TurnOverController.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverBaseVO.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverCreateReqVO.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverExcelVO.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverExportReqVO.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverPageReqVO.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverRespVO.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverUpdateReqVO.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/convert/turnover/TurnOverConvert.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/turnover/TurnOverDO.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/mysql/turnover/TurnOverMapper.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverService.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverServiceImpl.java create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/main/resources/mapper/turnover/TurnOverMapper.xml create mode 100644 yudao-module-archives/yudao-module-archives-biz/src/test/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverServiceImplTest.java diff --git a/sql/archives20230914JilingLee.sql b/sql/archives20230914JilingLee.sql new file mode 100644 index 00000000..c6bad429 --- /dev/null +++ b/sql/archives20230914JilingLee.sql @@ -0,0 +1,71 @@ +-- 移交档案流程相关表插入 +INSERT INTO `bpm_process_definition_ext`(`id`, `process_definition_id`, `model_id`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (146, 'archives_turn_over:1:5616e48d-520c-11ee-a1f0-00a6230850b9', '00380358-520c-11ee-a1f0-00a6230850b9', NULL, 10, 1, '{\"formRef\":\"elForm\",\"formModel\":\"formData\",\"size\":\"medium\",\"labelPosition\":\"right\",\"labelWidth\":100,\"formRules\":\"rules\",\"gutter\":15,\"disabled\":false,\"span\":24,\"formBtns\":true}', '[\"{\\\"__config__\\\":{\\\"label\\\":\\\"单行文本\\\",\\\"labelWidth\\\":null,\\\"showLabel\\\":true,\\\"changeTag\\\":true,\\\"tag\\\":\\\"el-input\\\",\\\"tagIcon\\\":\\\"input\\\",\\\"required\\\":true,\\\"layout\\\":\\\"colFormItem\\\",\\\"span\\\":24,\\\"document\\\":\\\"https://element.eleme.cn/#/zh-CN/component/input\\\",\\\"regList\\\":[],\\\"formId\\\":101,\\\"renderKey\\\":\\\"1011694592250766\\\"},\\\"__slot__\\\":{\\\"prepend\\\":\\\"\\\",\\\"append\\\":\\\"\\\"},\\\"placeholder\\\":\\\"请输入单行文本\\\",\\\"style\\\":{\\\"width\\\":\\\"100%\\\"},\\\"clearable\\\":true,\\\"prefix-icon\\\":\\\"\\\",\\\"suffix-icon\\\":\\\"\\\",\\\"maxlength\\\":null,\\\"show-word-limit\\\":false,\\\"readonly\\\":false,\\\"disabled\\\":false,\\\"__vModel__\\\":\\\"field101\\\"}\"]', NULL, NULL, '', '2023-09-13 16:05:43', '', '2023-09-13 16:05:43', b'0', 1); +INSERT INTO `bpm_process_definition_ext`(`id`, `process_definition_id`, `model_id`, `description`, `form_type`, `form_id`, `form_conf`, `form_fields`, `form_custom_create_path`, `form_custom_view_path`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (147, 'archives_turn_over:2:010b6e11-520e-11ee-a1f0-00a6230850b9', '00380358-520c-11ee-a1f0-00a6230850b9', NULL, 10, 1, '{\"formRef\":\"elForm\",\"formModel\":\"formData\",\"size\":\"medium\",\"labelPosition\":\"right\",\"labelWidth\":100,\"formRules\":\"rules\",\"gutter\":15,\"disabled\":false,\"span\":24,\"formBtns\":true}', '[\"{\\\"__config__\\\":{\\\"label\\\":\\\"单行文本\\\",\\\"labelWidth\\\":null,\\\"showLabel\\\":true,\\\"changeTag\\\":true,\\\"tag\\\":\\\"el-input\\\",\\\"tagIcon\\\":\\\"input\\\",\\\"required\\\":true,\\\"layout\\\":\\\"colFormItem\\\",\\\"span\\\":24,\\\"document\\\":\\\"https://element.eleme.cn/#/zh-CN/component/input\\\",\\\"regList\\\":[],\\\"formId\\\":101,\\\"renderKey\\\":\\\"1011694592250766\\\"},\\\"__slot__\\\":{\\\"prepend\\\":\\\"\\\",\\\"append\\\":\\\"\\\"},\\\"placeholder\\\":\\\"请输入单行文本\\\",\\\"style\\\":{\\\"width\\\":\\\"100%\\\"},\\\"clearable\\\":true,\\\"prefix-icon\\\":\\\"\\\",\\\"suffix-icon\\\":\\\"\\\",\\\"maxlength\\\":null,\\\"show-word-limit\\\":false,\\\"readonly\\\":false,\\\"disabled\\\":false,\\\"__vModel__\\\":\\\"field101\\\"}\"]', NULL, NULL, '', '2023-09-13 16:17:40', '', '2023-09-13 16:17:40', b'0', 1); +INSERT INTO `bpm_task_assign_rule`(`id`, `model_id`, `process_definition_id`, `task_definition_key`, `type`, `options`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (293, '00380358-520c-11ee-a1f0-00a6230850b9', '', 'Activity_1du9v0u', 30, '[1]', '', '2023-09-13 16:05:36', '', '2023-09-13 16:05:36', b'0', 1); +INSERT INTO `bpm_task_assign_rule`(`id`, `model_id`, `process_definition_id`, `task_definition_key`, `type`, `options`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (294, '00380358-520c-11ee-a1f0-00a6230850b9', 'archives_turn_over:1:5616e48d-520c-11ee-a1f0-00a6230850b9', 'Activity_1du9v0u', 30, '[1]', '', '2023-09-13 16:05:43', '', '2023-09-13 16:05:43', b'0', 1); +INSERT INTO `bpm_task_assign_rule`(`id`, `model_id`, `process_definition_id`, `task_definition_key`, `type`, `options`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (295, '00380358-520c-11ee-a1f0-00a6230850b9', '', 'audit1', 30, '[1]', '', '2023-09-13 16:17:33', '', '2023-09-13 16:17:33', b'0', 1); +INSERT INTO `bpm_task_assign_rule`(`id`, `model_id`, `process_definition_id`, `task_definition_key`, `type`, `options`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (296, '00380358-520c-11ee-a1f0-00a6230850b9', 'archives_turn_over:2:010b6e11-520e-11ee-a1f0-00a6230850b9', 'audit1', 30, '[1]', '', '2023-09-13 16:17:40', '', '2023-09-13 16:17:40', b'0', 1); +INSERT INTO `act_re_deployment`(`ID_`, `NAME_`, `CATEGORY_`, `KEY_`, `TENANT_ID_`, `DEPLOY_TIME_`, `DERIVED_FROM_`, `DERIVED_FROM_ROOT_`, `PARENT_DEPLOYMENT_ID_`, `ENGINE_VERSION_`) VALUES ('00fe75be-520e-11ee-a1f0-00a6230850b9', '档案移交申请单', '1', 'archives_turn_over', '1', '2023-09-13 16:17:39.476', NULL, NULL, '00fe75be-520e-11ee-a1f0-00a6230850b9', NULL); +INSERT INTO `act_ge_bytearray`(`ID_`, `REV_`, `NAME_`, `DEPLOYMENT_ID_`, `BYTES_`, `GENERATED_`) VALUES ('4306ac99-520c-11ee-a1f0-00a6230850b9', 3, 'source', NULL, 0x3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D225554462D38223F3E0A3C62706D6E323A646566696E6974696F6E7320786D6C6E733A7873693D22687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D612D696E7374616E63652220786D6C6E733A62706D6E323D22687474703A2F2F7777772E6F6D672E6F72672F737065632F42504D4E2F32303130303532342F4D4F44454C2220786D6C6E733A62706D6E64693D22687474703A2F2F7777772E6F6D672E6F72672F737065632F42504D4E2F32303130303532342F44492220786D6C6E733A64633D22687474703A2F2F7777772E6F6D672E6F72672F737065632F44442F32303130303532342F44432220786D6C6E733A64693D22687474703A2F2F7777772E6F6D672E6F72672F737065632F44442F32303130303532342F4449222069643D226469616772616D5F50726F636573735F3136393435393232393336373722207461726765744E616D6573706163653D22687474703A2F2F666C6F7761626C652E6F72672F62706D6E223E3C62706D6E323A70726F636573732069643D2261726368697665735F7475726E5F6F76657222206E616D653D22E6A1A3E6A188E7A7BBE4BAA4E794B3E8AFB7E58D952220697345786563757461626C653D2274727565223E3C62706D6E323A73746172744576656E742069643D224576656E745F30746C62383763223E3C62706D6E323A6F7574676F696E673E466C6F775F3173756A6579793C2F62706D6E323A6F7574676F696E673E3C2F62706D6E323A73746172744576656E743E3C62706D6E323A757365725461736B2069643D2261756469743122206E616D653D22E88A8BE98193223E3C62706D6E323A696E636F6D696E673E466C6F775F3173756A6579793C2F62706D6E323A696E636F6D696E673E3C62706D6E323A6F7574676F696E673E466C6F775F303665367636793C2F62706D6E323A6F7574676F696E673E3C2F62706D6E323A757365725461736B3E3C62706D6E323A73657175656E6365466C6F772069643D22466C6F775F3173756A6579792220736F757263655265663D224576656E745F30746C6238376322207461726765745265663D2261756469743122202F3E3C62706D6E323A656E644576656E742069643D224576656E745F3076616465646E223E3C62706D6E323A696E636F6D696E673E466C6F775F303665367636793C2F62706D6E323A696E636F6D696E673E3C2F62706D6E323A656E644576656E743E3C62706D6E323A73657175656E6365466C6F772069643D22466C6F775F303665367636792220736F757263655265663D2261756469743122207461726765745265663D224576656E745F3076616465646E22202F3E3C2F62706D6E323A70726F636573733E3C62706D6E64693A42504D4E4469616772616D2069643D2242504D4E4469616772616D5F31223E3C62706D6E64693A42504D4E506C616E652069643D2261726368697665735F7475726E5F6F7665725F6469222062706D6E456C656D656E743D2261726368697665735F7475726E5F6F766572223E3C62706D6E64693A42504D4E456467652069643D22466C6F775F303665367636795F6469222062706D6E456C656D656E743D22466C6F775F30366536763679223E3C64693A776179706F696E7420783D223533302220793D2232373022202F3E3C64693A776179706F696E7420783D223630322220793D2232373022202F3E3C2F62706D6E64693A42504D4E456467653E3C62706D6E64693A42504D4E456467652069643D22466C6F775F3173756A6579795F6469222062706D6E456C656D656E743D22466C6F775F3173756A657979223E3C64693A776179706F696E7420783D223335382220793D2232373022202F3E3C64693A776179706F696E7420783D223433302220793D2232373022202F3E3C2F62706D6E64693A42504D4E456467653E3C62706D6E64693A42504D4E53686170652069643D224576656E745F30746C623837635F6469222062706D6E456C656D656E743D224576656E745F30746C62383763223E3C64633A426F756E647320783D223332322220793D22323532222077696474683D22333622206865696768743D22333622202F3E3C2F62706D6E64693A42504D4E53686170653E3C62706D6E64693A42504D4E53686170652069643D226175646974315F6469222062706D6E456C656D656E743D22617564697431223E3C64633A426F756E647320783D223433302220793D22323330222077696474683D2231303022206865696768743D22383022202F3E3C2F62706D6E64693A42504D4E53686170653E3C62706D6E64693A42504D4E53686170652069643D224576656E745F3076616465646E5F6469222062706D6E456C656D656E743D224576656E745F3076616465646E223E3C64633A426F756E647320783D223630322220793D22323532222077696474683D22333622206865696768743D22333622202F3E3C2F62706D6E64693A42504D4E53686170653E3C2F62706D6E64693A42504D4E506C616E653E3C2F62706D6E64693A42504D4E4469616772616D3E3C2F62706D6E323A646566696E6974696F6E733E, NULL); +INSERT INTO `act_re_deployment`(`ID_`, `NAME_`, `CATEGORY_`, `KEY_`, `TENANT_ID_`, `DEPLOY_TIME_`, `DERIVED_FROM_`, `DERIVED_FROM_ROOT_`, `PARENT_DEPLOYMENT_ID_`, `ENGINE_VERSION_`) VALUES ('560187ca-520c-11ee-a1f0-00a6230850b9', '档案移交申请单', '1', 'archives_turn_over', '1', '2023-09-13 16:05:43.109', NULL, NULL, '560187ca-520c-11ee-a1f0-00a6230850b9', NULL); +INSERT INTO `act_re_model`(`ID_`, `REV_`, `NAME_`, `KEY_`, `CATEGORY_`, `CREATE_TIME_`, `LAST_UPDATE_TIME_`, `VERSION_`, `META_INFO_`, `DEPLOYMENT_ID_`, `EDITOR_SOURCE_VALUE_ID_`, `EDITOR_SOURCE_EXTRA_VALUE_ID_`, `TENANT_ID_`) VALUES ('00380358-520c-11ee-a1f0-00a6230850b9', 8, '档案移交申请单', 'archives_turn_over', '1', '2023-09-13 16:03:19.182', '2023-09-13 16:17:39.588', 1, '{\"description\":null,\"formType\":10,\"formId\":1,\"formCustomCreatePath\":null,\"formCustomViewPath\":null}', '00fe75be-520e-11ee-a1f0-00a6230850b9', '4306ac99-520c-11ee-a1f0-00a6230850b9', NULL, '1'); +INSERT INTO `bpm_form`(`id`, `name`, `status`, `conf`, `fields`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'ddx', 0, '{\"formRef\":\"elForm\",\"formModel\":\"formData\",\"size\":\"medium\",\"labelPosition\":\"right\",\"labelWidth\":100,\"formRules\":\"rules\",\"gutter\":15,\"disabled\":false,\"span\":24,\"formBtns\":true}', '[\"{\\\"__config__\\\":{\\\"label\\\":\\\"单行文本\\\",\\\"labelWidth\\\":null,\\\"showLabel\\\":true,\\\"changeTag\\\":true,\\\"tag\\\":\\\"el-input\\\",\\\"tagIcon\\\":\\\"input\\\",\\\"required\\\":true,\\\"layout\\\":\\\"colFormItem\\\",\\\"span\\\":24,\\\"document\\\":\\\"https://element.eleme.cn/#/zh-CN/component/input\\\",\\\"regList\\\":[],\\\"formId\\\":101,\\\"renderKey\\\":\\\"1011694592250766\\\"},\\\"__slot__\\\":{\\\"prepend\\\":\\\"\\\",\\\"append\\\":\\\"\\\"},\\\"placeholder\\\":\\\"请输入单行文本\\\",\\\"style\\\":{\\\"width\\\":\\\"100%\\\"},\\\"clearable\\\":true,\\\"prefix-icon\\\":\\\"\\\",\\\"suffix-icon\\\":\\\"\\\",\\\"maxlength\\\":null,\\\"show-word-limit\\\":false,\\\"readonly\\\":false,\\\"disabled\\\":false,\\\"__vModel__\\\":\\\"field101\\\"}\"]', NULL, '', '2023-09-13 16:04:19', '', '2023-09-13 16:04:19', b'0', 1); +INSERT INTO `bpm_task_assign_rule`(`id`, `model_id`, `process_definition_id`, `task_definition_key`, `type`, `options`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (297, 'f939dc13-521a-11ee-adcb-00a6230850b9', '', 'Activity_0b7iisg', 30, '[1]', '', '2023-09-13 17:55:26', '', '2023-09-13 17:55:26', b'0', 1); +INSERT INTO bpm_task_assign_rule (model_id, process_definition_id, task_definition_key, type, options, create_time, update_time, tenant_id) VALUES ('00380358-520c-11ee-a1f0-00a6230850b9', 'archives_turn_over:1:564e23d3-52d4-11ee-94c1-00a6230850b9', 'audit1', 30, '[1]', '2023-09-14 15:57:23.024', '2023-09-14 15:57:23.024', 1) + +-- 档案移交表 +-- ---------------------------- +-- Table structure for archives_turn_over +-- ---------------------------- +DROP TABLE IF EXISTS `archives_turn_over`; +CREATE TABLE `archives_turn_over` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `apply_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '移交单号', + `turn_date` datetime(0) NULL DEFAULT NULL COMMENT '移交日期', + `turn_explain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '移交说明', + `output_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '移交人', + `output_name_id` bigint(20) NULL DEFAULT NULL COMMENT '移交人ID', + `input_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '签收人', + `input_name_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 '删除状态', + `updater` varchar(64) 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 '所属部门', + `company_id` bigint(20) NULL DEFAULT NULL COMMENT '业务实体ID', + `company` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务实体', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `tenant_id` bigint(20) NOT NULL COMMENT '租户编号,一个集团/总公司对应一个租户', + `create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '制单人', + `from_organization_id` bigint(20) NULL DEFAULT NULL COMMENT '从立档单位ID', + `from_depot_id` bigint(20) NULL DEFAULT NULL COMMENT '从库房ID', + `from_cabinet_id` bigint(20) NULL DEFAULT NULL COMMENT '从档案柜ID', + `to_organization_id` bigint(20) NULL DEFAULT NULL COMMENT '到立档单位ID', + `to_depot_id` bigint(20) NULL DEFAULT NULL COMMENT '到库房ID', + `to_cabinet_id` bigint(20) NULL DEFAULT NULL COMMENT '到档案柜ID', + `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', + `create_by_id` bigint(20) NOT NULL COMMENT '制单人id', + `amount` int(11) NULL DEFAULT NULL COMMENT '案卷数量', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `process_instance_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流程实例的编号', + `bill_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '申请类型', + `status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '移交表' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; + +-- 插入档案移交菜单 +SELECT * FROM system_menu WHERE name='档案管理'; +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, 'turn-over', '', 'archives/turnOver/index', 'TurnOver', 0, b'1', b'1', b'1', '', '2023-09-13 14:05:07', '', '2023-09-13 14:10:33', b'0'); +SET @menuId2 = LAST_INSERT_ID(); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '移交管理查询', 'archives:turn-over:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-13 14:05:07', '', '2023-09-13 14:05:07', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '移交管理创建', 'archives:turn-over:create', 3, 2, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-13 14:05:07', '', '2023-09-13 14:05:07', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '移交管理更新', 'archives:turn-over:update', 3, 3, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-13 14:05:07', '', '2023-09-13 14:05:07', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '移交管理删除', 'archives:turn-over:delete', 3, 4, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-13 14:05:07', '', '2023-09-13 14:05:07', b'0'); +INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '移交管理导出', 'archives:turn-over:export', 3, 5, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-13 14:05:07', '', '2023-09-13 14:05:07', b'0'); diff --git a/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ArchivesStatusEnum.java b/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ArchivesStatusEnum.java new file mode 100644 index 00000000..53d0c008 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ArchivesStatusEnum.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.archives.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 申请状态枚举 + */ +@AllArgsConstructor +@Getter +public enum ArchivesStatusEnum { + + NOSUBMIT("0", "未提交"), + PROCESS("1", "待审核"), + APPROVE("2", "通过"), + REJECT("3", "驳回"), + CANCEL("4", "取消"); + + + /** + * 类型 + */ + private final String value; + /** + * 类型名 + */ + private final String name; + + +} diff --git a/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/BillTypeEnum.java b/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/BillTypeEnum.java new file mode 100644 index 00000000..bf3fd656 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/BillTypeEnum.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.archives.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 单据类型枚举 + */ +@AllArgsConstructor +@Getter +public enum BillTypeEnum { + + DAYJ("DAYJ", "档案移交申请单"), + ; + + /** + * 类型 + */ + private final String value; + /** + * 类型名 + */ + private final String name; + + public static String getNameByValue(String targetValue) { + for (BillTypeEnum billTypeEnum : BillTypeEnum.values()) { + if (billTypeEnum.getValue().equals(targetValue)) { + return billTypeEnum.getName(); + } + } + return null; + } +} diff --git a/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ErrorCodeConstants.java b/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ErrorCodeConstants.java index 300ab79d..41eaa804 100644 --- a/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ErrorCodeConstants.java +++ b/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ErrorCodeConstants.java @@ -4,4 +4,5 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; public interface ErrorCodeConstants { ErrorCode RECORD_NOT_EXISTS = new ErrorCode(200100, "归档不存在"); ErrorCode CODE_RULE_NOT_EXISTS = new ErrorCode(300100, "编码不存在"); + ErrorCode TURN_OVER_NOT_EXISTS = new ErrorCode(400100, "移交管理不存在"); } \ No newline at end of file diff --git a/yudao-module-archives/yudao-module-archives-biz/pom.xml b/yudao-module-archives/yudao-module-archives-biz/pom.xml index c53ba7a7..de4bd964 100644 --- a/yudao-module-archives/yudao-module-archives-biz/pom.xml +++ b/yudao-module-archives/yudao-module-archives-biz/pom.xml @@ -18,6 +18,13 @@ + + + cn.iocoder.boot + yudao-module-bpm-api + ${revision} + + cn.iocoder.boot yudao-spring-boot-starter-biz-tenant @@ -83,6 +90,12 @@ 1.7.3-snapshot compile + + cn.iocoder.boot + yudao-module-bpm-biz + 1.7.3-snapshot + compile + diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/TurnOverController.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/TurnOverController.java new file mode 100644 index 00000000..9e239976 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/TurnOverController.java @@ -0,0 +1,133 @@ +package cn.iocoder.yudao.module.archives.controller.admin.turnover; + +import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO; +import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService; +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.archives.controller.admin.turnover.vo.*; +import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO; +import cn.iocoder.yudao.module.archives.convert.turnover.TurnOverConvert; +import cn.iocoder.yudao.module.archives.service.turnover.TurnOverService; + +@Tag(name = "管理后台 - 移交") +@RestController +@RequestMapping("/archives/turn-over") +@Validated +public class TurnOverController { + + @Resource + private TurnOverService turnOverService; + + @Resource + private BpmTaskService taskService; + + @PostMapping("/create") + @Operation(summary = "创建移交") + @PreAuthorize("@ss.hasPermission('archives:turn-over:create')") + public CommonResult createTurnOver(@Valid @RequestBody TurnOverCreateReqVO createReqVO) { + return turnOverService.createTurnOver(createReqVO); + } + + @PutMapping("/update") + @Operation(summary = "更新移交") + @PreAuthorize("@ss.hasPermission('archives:turn-over:update')") + public CommonResult updateTurnOver(@Valid @RequestBody TurnOverUpdateReqVO updateReqVO) { + turnOverService.updateTurnOver(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除移交") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('archives:turn-over:delete')") + public CommonResult deleteTurnOver(@RequestParam("id") Long id) { + turnOverService.deleteTurnOver(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得移交") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('archives:turn-over:query')") + public CommonResult getTurnOver(@RequestParam("id") Long id) { + TurnOverDO turnOver = turnOverService.getTurnOver(id); + return success(TurnOverConvert.INSTANCE.convert(turnOver)); + } + + @GetMapping("/list") + @Operation(summary = "获得移交列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('archives:turn-over:query')") + public CommonResult> getTurnOverList(@RequestParam("ids") Collection ids) { + List list = turnOverService.getTurnOverList(ids); + return success(TurnOverConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得移交分页") + @PreAuthorize("@ss.hasPermission('archives:turn-over:query')") + public CommonResult> getTurnOverPage(@Valid TurnOverPageReqVO pageVO) { + PageResult pageResult = turnOverService.getTurnOverPage(pageVO); + List list = pageResult.getList(); + if (CollUtil.isNotEmpty(list)) { + for (TurnOverDO t : list) { + List taskListByProcessInstanceId = taskService.getTaskListByProcessInstanceId(t.getProcessInstanceId()); + Optional latestTask = taskListByProcessInstanceId.stream() + .filter(task -> task.getEndTime() != null) + .sorted(Comparator.comparing(BpmTaskRespVO::getEndTime).reversed()) + .findFirst(); + + if (latestTask.isPresent()) { + BpmTaskRespVO latest = latestTask.get(); + // 找到了endTime最新的任务 + TurnOverUpdateReqVO updateReqVO = new TurnOverUpdateReqVO(); + updateReqVO.setId(t.getId()); + if (!latest.getResult().toString().equals(t.getStatus())) { + updateReqVO.setStatus(latest.getResult().toString()); + turnOverService.updateTurnOver(updateReqVO); + } + } else { + // 没有找到有endTime的任务 + } + } + PageResult pageResult2 = turnOverService.getTurnOverPage(pageVO); + return success(TurnOverConvert.INSTANCE.convertPage(pageResult2)); + } + return success(TurnOverConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出移交 Excel") + @PreAuthorize("@ss.hasPermission('archives:turn-over:export')") + @OperateLog(type = EXPORT) + public void exportTurnOverExcel(@Valid TurnOverExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = turnOverService.getTurnOverList(exportReqVO); + // 导出 Excel + List datas = TurnOverConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "移交.xls", "数据", TurnOverExcelVO.class, datas); + } + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverBaseVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverBaseVO.java new file mode 100644 index 00000000..54dc7a1f --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverBaseVO.java @@ -0,0 +1,97 @@ +package cn.iocoder.yudao.module.archives.controller.admin.turnover.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import javax.validation.constraints.*; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +/** + * 移交 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class TurnOverBaseVO { + + @Schema(description = "移交单号") + private String applyNo; + + @Schema(description = "移交日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime turnDate; + + @Schema(description = "移交说明") + private String turnExplain; + + @Schema(description = "移交人", example = "张三") + private String outputName; + + @Schema(description = "移交人ID", example = "24105") + private Long outputNameId; + + @Schema(description = "签收人", example = "李四") + private String inputName; + + @Schema(description = "签收人ID", example = "28017") + private Long inputNameId; + + @Schema(description = "用户ID", example = "23669") + private Long userId; + + @Schema(description = "所属部门ID", example = "27304") + private Long deptId; + + @Schema(description = "所属部门", example = "张三") + private String deptName; + + @Schema(description = "业务实体ID", example = "13936") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "备注", example = "随便") + private String remark; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "从立档单位ID", example = "12461") + private Long fromOrganizationId; + + @Schema(description = "从库房ID", example = "31262") + private Long fromDepotId; + + @Schema(description = "从档案柜ID", example = "19367") + private Long fromCabinetId; + + @Schema(description = "到立档单位ID", example = "18409") + private Long toOrganizationId; + + @Schema(description = "到库房ID", example = "17779") + private Long toDepotId; + + @Schema(description = "到档案柜ID", example = "24097") + private Long toCabinetId; + + @Schema(description = "制单人id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24299") + private Long createById; + + @Schema(description = "案卷数量") + private Integer amount; + + @Schema(description = "流程实例的编号", example = "705") + private String processInstanceId; + + @Schema(description = "申请类型", example = "2") + private String billType; + + @Schema(description = "状态", example = "1") + private String status; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverCreateReqVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverCreateReqVO.java new file mode 100644 index 00000000..5689f107 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverCreateReqVO.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.archives.controller.admin.turnover.vo; + +import cn.iocoder.yudao.module.archives.enums.ArchivesStatusEnum; +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 TurnOverCreateReqVO extends TurnOverBaseVO { + @Schema(description = "id") + private Long id; + @AssertTrue(message = "状态只能是0或者1提交") + public boolean isStatusValid() { + //只能传未提交和待审核 + return getStatus().equals(ArchivesStatusEnum.NOSUBMIT.getValue()) || getStatus().equals(ArchivesStatusEnum.PROCESS.getValue()); + } +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverExcelVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverExcelVO.java new file mode 100644 index 00000000..e1ac61ce --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverExcelVO.java @@ -0,0 +1,101 @@ +package cn.iocoder.yudao.module.archives.controller.admin.turnover.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 移交 Excel VO + * + * @author 芋道源码 + */ +@Data +public class TurnOverExcelVO { + + @ExcelProperty("主键ID") + private Long id; + + @ExcelProperty("移交单号") + private String applyNo; + + @ExcelProperty("移交日期") + private LocalDateTime turnDate; + + @ExcelProperty("移交说明") + private String turnExplain; + + @ExcelProperty("移交人") + private String outputName; + + @ExcelProperty("移交人ID") + private Long outputNameId; + + @ExcelProperty("签收人") + private String inputName; + + @ExcelProperty("签收人ID") + private Long inputNameId; + + @ExcelProperty("用户ID") + private Long userId; + + @ExcelProperty("所属部门ID") + private Long deptId; + + @ExcelProperty("所属部门") + private String deptName; + + @ExcelProperty("业务实体ID") + private Long companyId; + + @ExcelProperty("业务实体") + private String company; + + @ExcelProperty("备注") + private String remark; + + @ExcelProperty("制单人") + private String createBy; + + @ExcelProperty("从立档单位ID") + private Long fromOrganizationId; + + @ExcelProperty("从库房ID") + private Long fromDepotId; + + @ExcelProperty("从档案柜ID") + private Long fromCabinetId; + + @ExcelProperty("到立档单位ID") + private Long toOrganizationId; + + @ExcelProperty("到库房ID") + private Long toDepotId; + + @ExcelProperty("到档案柜ID") + private Long toCabinetId; + + @ExcelProperty("制单人id") + private Long createById; + + @ExcelProperty("案卷数量") + private Integer amount; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @ExcelProperty("流程实例的编号") + private String processInstanceId; + + @ExcelProperty("申请类型") + private String billType; + + @ExcelProperty("状态") + private String status; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverExportReqVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverExportReqVO.java new file mode 100644 index 00000000..4c2340cc --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverExportReqVO.java @@ -0,0 +1,96 @@ +package cn.iocoder.yudao.module.archives.controller.admin.turnover.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,参数和 TurnOverPageReqVO 是一致的") +@Data +public class TurnOverExportReqVO { + + @Schema(description = "移交单号") + private String applyNo; + + @Schema(description = "移交日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] turnDate; + + @Schema(description = "移交说明") + private String turnExplain; + + @Schema(description = "移交人", example = "张三") + private String outputName; + + @Schema(description = "移交人ID", example = "24105") + private Long outputNameId; + + @Schema(description = "签收人", example = "李四") + private String inputName; + + @Schema(description = "签收人ID", example = "28017") + private Long inputNameId; + + @Schema(description = "用户ID", example = "23669") + private Long userId; + + @Schema(description = "所属部门ID", example = "27304") + private Long deptId; + + @Schema(description = "所属部门", example = "张三") + private String deptName; + + @Schema(description = "业务实体ID", example = "13936") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "备注", example = "随便") + private String remark; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "从立档单位ID", example = "12461") + private Long fromOrganizationId; + + @Schema(description = "从库房ID", example = "31262") + private Long fromDepotId; + + @Schema(description = "从档案柜ID", example = "19367") + private Long fromCabinetId; + + @Schema(description = "到立档单位ID", example = "18409") + private Long toOrganizationId; + + @Schema(description = "到库房ID", example = "17779") + private Long toDepotId; + + @Schema(description = "到档案柜ID", example = "24097") + private Long toCabinetId; + + @Schema(description = "制单人id", example = "24299") + private Long createById; + + @Schema(description = "案卷数量") + private Integer amount; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "流程实例的编号", example = "705") + private String processInstanceId; + + @Schema(description = "申请类型", example = "2") + private String billType; + + @Schema(description = "状态", example = "1") + private String status; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverPageReqVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverPageReqVO.java new file mode 100644 index 00000000..33847dda --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverPageReqVO.java @@ -0,0 +1,98 @@ +package cn.iocoder.yudao.module.archives.controller.admin.turnover.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 TurnOverPageReqVO extends PageParam { + + @Schema(description = "移交单号") + private String applyNo; + + @Schema(description = "移交日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] turnDate; + + @Schema(description = "移交说明") + private String turnExplain; + + @Schema(description = "移交人", example = "张三") + private String outputName; + + @Schema(description = "移交人ID", example = "24105") + private Long outputNameId; + + @Schema(description = "签收人", example = "李四") + private String inputName; + + @Schema(description = "签收人ID", example = "28017") + private Long inputNameId; + + @Schema(description = "用户ID", example = "23669") + private Long userId; + + @Schema(description = "所属部门ID", example = "27304") + private Long deptId; + + @Schema(description = "所属部门", example = "张三") + private String deptName; + + @Schema(description = "业务实体ID", example = "13936") + private Long companyId; + + @Schema(description = "业务实体") + private String company; + + @Schema(description = "备注", example = "随便") + private String remark; + + @Schema(description = "制单人") + private String createBy; + + @Schema(description = "从立档单位ID", example = "12461") + private Long fromOrganizationId; + + @Schema(description = "从库房ID", example = "31262") + private Long fromDepotId; + + @Schema(description = "从档案柜ID", example = "19367") + private Long fromCabinetId; + + @Schema(description = "到立档单位ID", example = "18409") + private Long toOrganizationId; + + @Schema(description = "到库房ID", example = "17779") + private Long toDepotId; + + @Schema(description = "到档案柜ID", example = "24097") + private Long toCabinetId; + + @Schema(description = "制单人id", example = "24299") + private Long createById; + + @Schema(description = "案卷数量") + private Integer amount; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "流程实例的编号", example = "705") + private String processInstanceId; + + @Schema(description = "申请类型", example = "2") + private String billType; + + @Schema(description = "状态", example = "1") + private String status; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverRespVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverRespVO.java new file mode 100644 index 00000000..7a301f9d --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.archives.controller.admin.turnover.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 TurnOverRespVO extends TurnOverBaseVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17036") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverUpdateReqVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverUpdateReqVO.java new file mode 100644 index 00000000..6650c4cc --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/vo/TurnOverUpdateReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.archives.controller.admin.turnover.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 TurnOverUpdateReqVO extends TurnOverBaseVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17036") + @NotNull(message = "主键ID不能为空") + private Long id; + + private String status; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/convert/turnover/TurnOverConvert.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/convert/turnover/TurnOverConvert.java new file mode 100644 index 00000000..7b0bc3cd --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/convert/turnover/TurnOverConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.archives.convert.turnover; + +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.archives.controller.admin.turnover.vo.*; +import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO; + +/** + * 移交 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface TurnOverConvert { + + TurnOverConvert INSTANCE = Mappers.getMapper(TurnOverConvert.class); + + TurnOverDO convert(TurnOverCreateReqVO bean); + + TurnOverDO convert(TurnOverUpdateReqVO bean); + + TurnOverRespVO convert(TurnOverDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/turnover/TurnOverDO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/turnover/TurnOverDO.java new file mode 100644 index 00000000..ec835c27 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/turnover/TurnOverDO.java @@ -0,0 +1,148 @@ +package cn.iocoder.yudao.module.archives.dal.dataobject.turnover; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +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("archives_turn_over") +@KeySequence("archives_turn_over_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TurnOverDO extends BaseDO { + + /** + * 主键ID + */ + @TableId + private Long id; + /** + * 移交单号 + */ + private String applyNo; + /** + * 移交日期 + */ + private LocalDateTime turnDate; + /** + * 移交说明 + */ + private String turnExplain; + /** + * 移交人 + */ + private String outputName; + /** + * 移交人ID + */ + private Long outputNameId; + /** + * 签收人 + */ + private String inputName; + /** + * 签收人ID + */ + private Long inputNameId; + /** + * 用户ID + */ + private Long userId; + /** + * 所属部门ID + */ + private Long deptId; + /** + * 所属部门 + */ + private String deptName; + /** + * 业务实体ID + */ + private Long companyId; + /** + * 业务实体 + */ + private String company; + /** + * 备注 + */ + private String remark; + /** + * 制单人 + */ + private String createBy; + /** + * 从立档单位ID + */ + private Long fromOrganizationId; + /** + * 从库房ID + */ + private Long fromDepotId; + /** + * 从档案柜ID + */ + private Long fromCabinetId; + /** + * 到立档单位ID + */ + private Long toOrganizationId; + /** + * 到库房ID + */ + private Long toDepotId; + /** + * 到档案柜ID + */ + private Long toCabinetId; + /** + * 预留字段1 + */ + private String attr1; + /** + * 预留字段2 + */ + private String attr2; + /** + * 预留字段3 + */ + private Integer attr3; + /** + * 预留字段4 + */ + private Integer attr4; + /** + * 制单人id + */ + private Long createById; + /** + * 案卷数量 + */ + private Integer amount; + /** + * 流程实例的编号 + */ + private String processInstanceId; + /** + * 申请类型 + */ + private String billType; + /** + * 状态 + */ + private String status; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/mysql/turnover/TurnOverMapper.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/mysql/turnover/TurnOverMapper.java new file mode 100644 index 00000000..ed58b7f4 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/mysql/turnover/TurnOverMapper.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.archives.dal.mysql.turnover; + +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.archives.dal.dataobject.turnover.TurnOverDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.archives.controller.admin.turnover.vo.*; + +/** + * 移交 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface TurnOverMapper extends BaseMapperX { + + default PageResult selectPage(TurnOverPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(TurnOverDO::getApplyNo, reqVO.getApplyNo()) + .betweenIfPresent(TurnOverDO::getTurnDate, reqVO.getTurnDate()) + .eqIfPresent(TurnOverDO::getTurnExplain, reqVO.getTurnExplain()) + .likeIfPresent(TurnOverDO::getOutputName, reqVO.getOutputName()) + .eqIfPresent(TurnOverDO::getOutputNameId, reqVO.getOutputNameId()) + .likeIfPresent(TurnOverDO::getInputName, reqVO.getInputName()) + .eqIfPresent(TurnOverDO::getInputNameId, reqVO.getInputNameId()) + .eqIfPresent(TurnOverDO::getUserId, reqVO.getUserId()) + .eqIfPresent(TurnOverDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(TurnOverDO::getDeptName, reqVO.getDeptName()) + .eqIfPresent(TurnOverDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(TurnOverDO::getCompany, reqVO.getCompany()) + .eqIfPresent(TurnOverDO::getRemark, reqVO.getRemark()) + .eqIfPresent(TurnOverDO::getCreateBy, reqVO.getCreateBy()) + .eqIfPresent(TurnOverDO::getFromOrganizationId, reqVO.getFromOrganizationId()) + .eqIfPresent(TurnOverDO::getFromDepotId, reqVO.getFromDepotId()) + .eqIfPresent(TurnOverDO::getFromCabinetId, reqVO.getFromCabinetId()) + .eqIfPresent(TurnOverDO::getToOrganizationId, reqVO.getToOrganizationId()) + .eqIfPresent(TurnOverDO::getToDepotId, reqVO.getToDepotId()) + .eqIfPresent(TurnOverDO::getToCabinetId, reqVO.getToCabinetId()) + .eqIfPresent(TurnOverDO::getCreateById, reqVO.getCreateById()) + .eqIfPresent(TurnOverDO::getAmount, reqVO.getAmount()) + .betweenIfPresent(TurnOverDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(TurnOverDO::getProcessInstanceId, reqVO.getProcessInstanceId()) + .eqIfPresent(TurnOverDO::getBillType, reqVO.getBillType()) + .eqIfPresent(TurnOverDO::getStatus, reqVO.getStatus()) + .orderByDesc(TurnOverDO::getId)); + } + + default List selectList(TurnOverExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(TurnOverDO::getApplyNo, reqVO.getApplyNo()) + .betweenIfPresent(TurnOverDO::getTurnDate, reqVO.getTurnDate()) + .eqIfPresent(TurnOverDO::getTurnExplain, reqVO.getTurnExplain()) + .likeIfPresent(TurnOverDO::getOutputName, reqVO.getOutputName()) + .eqIfPresent(TurnOverDO::getOutputNameId, reqVO.getOutputNameId()) + .likeIfPresent(TurnOverDO::getInputName, reqVO.getInputName()) + .eqIfPresent(TurnOverDO::getInputNameId, reqVO.getInputNameId()) + .eqIfPresent(TurnOverDO::getUserId, reqVO.getUserId()) + .eqIfPresent(TurnOverDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(TurnOverDO::getDeptName, reqVO.getDeptName()) + .eqIfPresent(TurnOverDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(TurnOverDO::getCompany, reqVO.getCompany()) + .eqIfPresent(TurnOverDO::getRemark, reqVO.getRemark()) + .eqIfPresent(TurnOverDO::getCreateBy, reqVO.getCreateBy()) + .eqIfPresent(TurnOverDO::getFromOrganizationId, reqVO.getFromOrganizationId()) + .eqIfPresent(TurnOverDO::getFromDepotId, reqVO.getFromDepotId()) + .eqIfPresent(TurnOverDO::getFromCabinetId, reqVO.getFromCabinetId()) + .eqIfPresent(TurnOverDO::getToOrganizationId, reqVO.getToOrganizationId()) + .eqIfPresent(TurnOverDO::getToDepotId, reqVO.getToDepotId()) + .eqIfPresent(TurnOverDO::getToCabinetId, reqVO.getToCabinetId()) + .eqIfPresent(TurnOverDO::getCreateById, reqVO.getCreateById()) + .eqIfPresent(TurnOverDO::getAmount, reqVO.getAmount()) + .betweenIfPresent(TurnOverDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(TurnOverDO::getProcessInstanceId, reqVO.getProcessInstanceId()) + .eqIfPresent(TurnOverDO::getBillType, reqVO.getBillType()) + .eqIfPresent(TurnOverDO::getStatus, reqVO.getStatus()) + .orderByDesc(TurnOverDO::getId)); + } + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverService.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverService.java new file mode 100644 index 00000000..dce61b9e --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverService.java @@ -0,0 +1,72 @@ +package cn.iocoder.yudao.module.archives.service.turnover; + +import java.util.*; +import javax.validation.*; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.archives.controller.admin.turnover.vo.*; +import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 移交 Service 接口 + * + * @author 芋道源码 + */ +public interface TurnOverService { + + /** + * 创建移交 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + CommonResult createTurnOver(@Valid TurnOverCreateReqVO createReqVO); + + /** + * 更新移交 + * + * @param updateReqVO 更新信息 + */ + void updateTurnOver(@Valid TurnOverUpdateReqVO updateReqVO); + + /** + * 删除移交 + * + * @param id 编号 + */ + void deleteTurnOver(Long id); + + /** + * 获得移交 + * + * @param id 编号 + * @return 移交 + */ + TurnOverDO getTurnOver(Long id); + + /** + * 获得移交列表 + * + * @param ids 编号 + * @return 移交列表 + */ + List getTurnOverList(Collection ids); + + /** + * 获得移交分页 + * + * @param pageReqVO 分页查询 + * @return 移交分页 + */ + PageResult getTurnOverPage(TurnOverPageReqVO pageReqVO); + + /** + * 获得移交列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 移交列表 + */ + List getTurnOverList(TurnOverExportReqVO exportReqVO); + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverServiceImpl.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverServiceImpl.java new file mode 100644 index 00000000..cfba8c4e --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverServiceImpl.java @@ -0,0 +1,124 @@ +package cn.iocoder.yudao.module.archives.service.turnover; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.security.core.LoginUser; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.archives.convert.record.RecordConvert; +import cn.iocoder.yudao.module.archives.dal.dataobject.record.RecordDO; +import cn.iocoder.yudao.module.archives.enums.ArchivesStatusEnum; +import cn.iocoder.yudao.module.archives.enums.BillTypeEnum; +import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; +import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; +import cn.iocoder.yudao.module.system.api.dept.DeptApi; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import com.github.yulichang.base.MPJBaseServiceImpl; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import javax.validation.Validator; + +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import cn.iocoder.yudao.module.archives.controller.admin.turnover.vo.*; +import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.archives.convert.turnover.TurnOverConvert; +import cn.iocoder.yudao.module.archives.dal.mysql.turnover.TurnOverMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.archives.enums.ErrorCodeConstants.*; + +/** + * 移交 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class TurnOverServiceImpl extends MPJBaseServiceImpl implements TurnOverService { + public static final String PROCESS_KEY = "archives_turn_over"; + + @Resource + private TurnOverMapper turnOverMapper; + @Resource + private Validator validator; + @Resource + private AdminUserApi adminUserApi; + @Resource + private DeptApi deptApi; + @Resource + private BpmProcessInstanceApi processInstanceApi; + + @Override + public CommonResult createTurnOver(TurnOverCreateReqVO createReqVO) { + // 插入 + TurnOverDO turnOver = TurnOverConvert.INSTANCE.convert(createReqVO); + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + turnOver.setDeleted(false); + turnOver.setBillType("DAYJ"); + //添加数据userid + turnOver.setUserId(loginUser.getId()); + turnOverMapper.insert(turnOver); + + if (turnOver.getStatus().equals(ArchivesStatusEnum.PROCESS.getValue())) { + Map variables = new HashMap<>(); + variables.put("billType", turnOver.getBillType()); + variables.put("billId", turnOver.getId()); + variables.put("billName", BillTypeEnum.getNameByValue(turnOver.getBillType())); + variables.put("amount", turnOver.getAmount()); + variables.put("deptId", turnOver.getDeptId()); + String processInstanceId = processInstanceApi.createProcessInstance(turnOver.getUserId(), + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY) + .setVariables(variables).setBusinessKey(String.valueOf(turnOver.getId()))); + updateById(new TurnOverDO().setId(turnOver.getId()).setProcessInstanceId(processInstanceId)); + } + + // 返回 + return CommonResult.success(); + } + + @Override + public void updateTurnOver(TurnOverUpdateReqVO updateReqVO) { + // 校验存在 + validateTurnOverExists(updateReqVO.getId()); + // 更新 + TurnOverDO updateObj = TurnOverConvert.INSTANCE.convert(updateReqVO); + turnOverMapper.updateById(updateObj); + } + + @Override + public void deleteTurnOver(Long id) { + // 校验存在 + validateTurnOverExists(id); + // 删除 + turnOverMapper.deleteById(id); + } + + private void validateTurnOverExists(Long id) { + if (turnOverMapper.selectById(id) == null) { + throw exception(TURN_OVER_NOT_EXISTS); + } + } + + @Override + public TurnOverDO getTurnOver(Long id) { + return turnOverMapper.selectById(id); + } + + @Override + public List getTurnOverList(Collection ids) { + return turnOverMapper.selectBatchIds(ids); + } + + @Override + public PageResult getTurnOverPage(TurnOverPageReqVO pageReqVO) { + return turnOverMapper.selectPage(pageReqVO); + } + + @Override + public List getTurnOverList(TurnOverExportReqVO exportReqVO) { + return turnOverMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/resources/mapper/turnover/TurnOverMapper.xml b/yudao-module-archives/yudao-module-archives-biz/src/main/resources/mapper/turnover/TurnOverMapper.xml new file mode 100644 index 00000000..f439f34f --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/resources/mapper/turnover/TurnOverMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-archives/yudao-module-archives-biz/src/test/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverServiceImplTest.java b/yudao-module-archives/yudao-module-archives-biz/src/test/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverServiceImplTest.java new file mode 100644 index 00000000..2736f210 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/test/java/cn/iocoder/yudao/module/archives/service/turnover/TurnOverServiceImplTest.java @@ -0,0 +1,352 @@ +package cn.iocoder.yudao.module.archives.service.turnover; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +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.archives.controller.admin.turnover.vo.*; +import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO; +import cn.iocoder.yudao.module.archives.dal.mysql.turnover.TurnOverMapper; +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.archives.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 TurnOverServiceImpl} 的单元测试类 + * + * @author 芋道源码 + */ +@Import(TurnOverServiceImpl.class) +public class TurnOverServiceImplTest extends BaseDbUnitTest { + + @Resource + private TurnOverServiceImpl turnOverService; + + @Resource + private TurnOverMapper turnOverMapper; + + @Test + public void testCreateTurnOver_success() { + // 准备参数 + TurnOverCreateReqVO reqVO = randomPojo(TurnOverCreateReqVO.class); + + // 调用 + CommonResult turnOverId = turnOverService.createTurnOver(reqVO); + // 断言 + assertNotNull(turnOverId); + // 校验记录的属性是否正确 + TurnOverDO turnOver = turnOverMapper.selectById(turnOverId); + assertPojoEquals(reqVO, turnOver); + } + + @Test + public void testUpdateTurnOver_success() { + // mock 数据 + TurnOverDO dbTurnOver = randomPojo(TurnOverDO.class); + turnOverMapper.insert(dbTurnOver);// @Sql: 先插入出一条存在的数据 + // 准备参数 + TurnOverUpdateReqVO reqVO = randomPojo(TurnOverUpdateReqVO.class, o -> { + o.setId(dbTurnOver.getId()); // 设置更新的 ID + }); + + // 调用 + turnOverService.updateTurnOver(reqVO); + // 校验是否更新正确 + TurnOverDO turnOver = turnOverMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, turnOver); + } + + @Test + public void testUpdateTurnOver_notExists() { + // 准备参数 + TurnOverUpdateReqVO reqVO = randomPojo(TurnOverUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> turnOverService.updateTurnOver(reqVO), TURN_OVER_NOT_EXISTS); + } + + @Test + public void testDeleteTurnOver_success() { + // mock 数据 + TurnOverDO dbTurnOver = randomPojo(TurnOverDO.class); + turnOverMapper.insert(dbTurnOver);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbTurnOver.getId(); + + // 调用 + turnOverService.deleteTurnOver(id); + // 校验数据不存在了 + assertNull(turnOverMapper.selectById(id)); + } + + @Test + public void testDeleteTurnOver_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> turnOverService.deleteTurnOver(id), TURN_OVER_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetTurnOverPage() { + // mock 数据 + TurnOverDO dbTurnOver = randomPojo(TurnOverDO.class, o -> { // 等会查询到 + o.setApplyNo(null); + o.setTurnDate(null); + o.setTurnExplain(null); + o.setOutputName(null); + o.setOutputNameId(null); + o.setInputName(null); + o.setInputNameId(null); + o.setUserId(null); + o.setDeptId(null); + o.setDeptName(null); + o.setCompanyId(null); + o.setCompany(null); + o.setRemark(null); + o.setCreateBy(null); + o.setFromOrganizationId(null); + o.setFromDepotId(null); + o.setFromCabinetId(null); + o.setToOrganizationId(null); + o.setToDepotId(null); + o.setToCabinetId(null); + o.setCreateById(null); + o.setAmount(null); + o.setCreateTime(null); + o.setProcessInstanceId(null); + o.setBillType(null); + o.setStatus(null); + }); + turnOverMapper.insert(dbTurnOver); + // 测试 applyNo 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setApplyNo(null))); + // 测试 turnDate 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setTurnDate(null))); + // 测试 turnExplain 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setTurnExplain(null))); + // 测试 outputName 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setOutputName(null))); + // 测试 outputNameId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setOutputNameId(null))); + // 测试 inputName 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setInputName(null))); + // 测试 inputNameId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setInputNameId(null))); + // 测试 userId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setUserId(null))); + // 测试 deptId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setDeptId(null))); + // 测试 deptName 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setDeptName(null))); + // 测试 companyId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCompanyId(null))); + // 测试 company 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCompany(null))); + // 测试 remark 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setRemark(null))); + // 测试 createBy 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateBy(null))); + // 测试 fromOrganizationId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromOrganizationId(null))); + // 测试 fromDepotId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromDepotId(null))); + // 测试 fromCabinetId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromCabinetId(null))); + // 测试 toOrganizationId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToOrganizationId(null))); + // 测试 toDepotId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToDepotId(null))); + // 测试 toCabinetId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToCabinetId(null))); + // 测试 createById 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateById(null))); + // 测试 amount 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setAmount(null))); + // 测试 createTime 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateTime(null))); + // 测试 processInstanceId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setProcessInstanceId(null))); + // 测试 billType 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setBillType(null))); + // 测试 status 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setStatus(null))); + // 准备参数 + TurnOverPageReqVO reqVO = new TurnOverPageReqVO(); + reqVO.setApplyNo(null); + reqVO.setTurnDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setTurnExplain(null); + reqVO.setOutputName(null); + reqVO.setOutputNameId(null); + reqVO.setInputName(null); + reqVO.setInputNameId(null); + reqVO.setUserId(null); + reqVO.setDeptId(null); + reqVO.setDeptName(null); + reqVO.setCompanyId(null); + reqVO.setCompany(null); + reqVO.setRemark(null); + reqVO.setCreateBy(null); + reqVO.setFromOrganizationId(null); + reqVO.setFromDepotId(null); + reqVO.setFromCabinetId(null); + reqVO.setToOrganizationId(null); + reqVO.setToDepotId(null); + reqVO.setToCabinetId(null); + reqVO.setCreateById(null); + reqVO.setAmount(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setProcessInstanceId(null); + reqVO.setBillType(null); + reqVO.setStatus(null); + + // 调用 + PageResult pageResult = turnOverService.getTurnOverPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbTurnOver, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetTurnOverList() { + // mock 数据 + TurnOverDO dbTurnOver = randomPojo(TurnOverDO.class, o -> { // 等会查询到 + o.setApplyNo(null); + o.setTurnDate(null); + o.setTurnExplain(null); + o.setOutputName(null); + o.setOutputNameId(null); + o.setInputName(null); + o.setInputNameId(null); + o.setUserId(null); + o.setDeptId(null); + o.setDeptName(null); + o.setCompanyId(null); + o.setCompany(null); + o.setRemark(null); + o.setCreateBy(null); + o.setFromOrganizationId(null); + o.setFromDepotId(null); + o.setFromCabinetId(null); + o.setToOrganizationId(null); + o.setToDepotId(null); + o.setToCabinetId(null); + o.setCreateById(null); + o.setAmount(null); + o.setCreateTime(null); + o.setProcessInstanceId(null); + o.setBillType(null); + o.setStatus(null); + }); + turnOverMapper.insert(dbTurnOver); + // 测试 applyNo 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setApplyNo(null))); + // 测试 turnDate 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setTurnDate(null))); + // 测试 turnExplain 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setTurnExplain(null))); + // 测试 outputName 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setOutputName(null))); + // 测试 outputNameId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setOutputNameId(null))); + // 测试 inputName 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setInputName(null))); + // 测试 inputNameId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setInputNameId(null))); + // 测试 userId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setUserId(null))); + // 测试 deptId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setDeptId(null))); + // 测试 deptName 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setDeptName(null))); + // 测试 companyId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCompanyId(null))); + // 测试 company 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCompany(null))); + // 测试 remark 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setRemark(null))); + // 测试 createBy 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateBy(null))); + // 测试 fromOrganizationId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromOrganizationId(null))); + // 测试 fromDepotId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromDepotId(null))); + // 测试 fromCabinetId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromCabinetId(null))); + // 测试 toOrganizationId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToOrganizationId(null))); + // 测试 toDepotId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToDepotId(null))); + // 测试 toCabinetId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToCabinetId(null))); + // 测试 createById 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateById(null))); + // 测试 amount 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setAmount(null))); + // 测试 createTime 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateTime(null))); + // 测试 processInstanceId 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setProcessInstanceId(null))); + // 测试 billType 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setBillType(null))); + // 测试 status 不匹配 + turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setStatus(null))); + // 准备参数 + TurnOverExportReqVO reqVO = new TurnOverExportReqVO(); + reqVO.setApplyNo(null); + reqVO.setTurnDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setTurnExplain(null); + reqVO.setOutputName(null); + reqVO.setOutputNameId(null); + reqVO.setInputName(null); + reqVO.setInputNameId(null); + reqVO.setUserId(null); + reqVO.setDeptId(null); + reqVO.setDeptName(null); + reqVO.setCompanyId(null); + reqVO.setCompany(null); + reqVO.setRemark(null); + reqVO.setCreateBy(null); + reqVO.setFromOrganizationId(null); + reqVO.setFromDepotId(null); + reqVO.setFromCabinetId(null); + reqVO.setToOrganizationId(null); + reqVO.setToDepotId(null); + reqVO.setToCabinetId(null); + reqVO.setCreateById(null); + reqVO.setAmount(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setProcessInstanceId(null); + reqVO.setBillType(null); + reqVO.setStatus(null); + + // 调用 + List list = turnOverService.getTurnOverList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbTurnOver, list.get(0)); + } + +} From c7574db604566a969fbfc481da113f2f55b7b5bd Mon Sep 17 00:00:00 2001 From: JilingLee <18850011309@139.com> Date: Thu, 14 Sep 2023 17:57:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=A7=BB=E4=BA=A4=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/turnover/TurnOverController.java | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/TurnOverController.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/TurnOverController.java index 9e239976..c22e83b3 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/TurnOverController.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/turnover/TurnOverController.java @@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO; import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService; 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; @@ -19,11 +21,13 @@ 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.archives.controller.admin.turnover.vo.*; @@ -93,23 +97,23 @@ public class TurnOverController { List list = pageResult.getList(); if (CollUtil.isNotEmpty(list)) { for (TurnOverDO t : list) { - List taskListByProcessInstanceId = taskService.getTaskListByProcessInstanceId(t.getProcessInstanceId()); - Optional latestTask = taskListByProcessInstanceId.stream() - .filter(task -> task.getEndTime() != null) - .sorted(Comparator.comparing(BpmTaskRespVO::getEndTime).reversed()) - .findFirst(); - - if (latestTask.isPresent()) { - BpmTaskRespVO latest = latestTask.get(); - // 找到了endTime最新的任务 - TurnOverUpdateReqVO updateReqVO = new TurnOverUpdateReqVO(); - updateReqVO.setId(t.getId()); - if (!latest.getResult().toString().equals(t.getStatus())) { - updateReqVO.setStatus(latest.getResult().toString()); - turnOverService.updateTurnOver(updateReqVO); + if (t.getProcessInstanceId() != null) { + List taskListByProcessInstanceId = taskService.getTaskListByProcessInstanceId(t.getProcessInstanceId()); + Optional latestTask = taskListByProcessInstanceId.stream() + .filter(task -> task.getEndTime() != null) + .sorted(Comparator.comparing(BpmTaskRespVO::getEndTime).reversed()) + .findFirst(); + + if (latestTask.isPresent()) { + BpmTaskRespVO latest = latestTask.get(); + // 找到了endTime最新的任务 + TurnOverUpdateReqVO updateReqVO = new TurnOverUpdateReqVO(); + updateReqVO.setId(t.getId()); + if (!latest.getResult().toString().equals(t.getStatus())) { + updateReqVO.setStatus(latest.getResult().toString()); + turnOverService.updateTurnOver(updateReqVO); + } } - } else { - // 没有找到有endTime的任务 } } PageResult pageResult2 = turnOverService.getTurnOverPage(pageVO); @@ -123,7 +127,7 @@ public class TurnOverController { @PreAuthorize("@ss.hasPermission('archives:turn-over:export')") @OperateLog(type = EXPORT) public void exportTurnOverExcel(@Valid TurnOverExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { + HttpServletResponse response) throws IOException { List list = turnOverService.getTurnOverList(exportReqVO); // 导出 Excel List datas = TurnOverConvert.INSTANCE.convertList02(list);