From 2b41364824239a958af040b76832262cb8aa9e22 Mon Sep 17 00:00:00 2001 From: "LAPTOP-0SF788NU\\admin" <3306174053@qq.com> Date: Thu, 9 Nov 2023 14:24:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=A3=E6=A1=88=E5=80=9F=E9=98=85=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/20231108JS.sql | 32 +++++++++++++ .../module/archives/enums/BillTypeEnum.java | 33 ------------- .../borrowapply/BorrowApplyController.java | 45 +++++++++++++++++ .../borrowapply/vo/BorrowApplyBaseVO.java | 16 +++++++ .../vo/BorrowApplyExportReqVO.java | 17 +++++++ .../borrowapply/vo/BorrowApplyPageReqVO.java | 17 +++++++ .../dataobject/borrowapply/BorrowApplyDO.java | 16 +++++++ .../borrowapply/BorrowApplyServiceImpl.java | 48 +++++++++++++++---- .../service/turnover/TurnOverServiceImpl.java | 6 +-- .../yudao/module/bs/enums/BillTypeEnum.java | 1 + 10 files changed, 184 insertions(+), 47 deletions(-) create mode 100644 sql/20231108JS.sql delete mode 100644 yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/BillTypeEnum.java diff --git a/sql/20231108JS.sql b/sql/20231108JS.sql new file mode 100644 index 00000000..1e5b4bbf --- /dev/null +++ b/sql/20231108JS.sql @@ -0,0 +1,32 @@ + +-- 借阅表新增 流程实例的编号 字段 +ALTER TABLE archives_borrow_apply ADD COLUMN `process_instance_id` varchar(255) NULL DEFAULT NULL COMMENT '流程实例的编号'; + + +-- 借阅表新增 申请类型 字段 +ALTER TABLE archives_borrow_apply ADD COLUMN `bill_type` varchar(255) NULL DEFAULT NULL COMMENT '申请类型'; + + +-- 借阅表新增 状态 字段 +ALTER TABLE archives_borrow_apply ADD COLUMN `status` varchar(64) NULL DEFAULT NULL COMMENT '状态'; + +ALTER TABLE archives_borrow_apply ADD COLUMN `status` varchar(64) NULL DEFAULT NULL COMMENT '状态'; +alter table archives_borrow_apply alter column status set default 1; + +-- 借阅审批流程消息通知模板插入 +INSERT INTO `lyr-one`.`system_notify_template` (`id`, `name`, `code`, `nickname`, `content`, `type`, `params`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (19, '档案借阅代办', 'BORROW_UNDEAL', '系统通知', '您有新的【{billName}】需要处理,请及时处理!', 2, '[\"billName\"]', 0, NULL, '', '2023-11-09 10:59:29', '', '2023-11-09 11:01:31', b'0'); +INSERT INTO `lyr-one`.`system_notify_template` (`id`, `name`, `code`, `nickname`, `content`, `type`, `params`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (20, '档案借阅驳回', 'BORROW_NOPASS', '系统通知', '您发起的【{billName}】已被驳回,请悉知!\n', 2, '[\"billName\"]', 0, NULL, '', '2023-11-09 11:00:17', '', '2023-11-09 11:01:28', b'0'); +INSERT INTO `lyr-one`.`system_notify_template` (`id`, `name`, `code`, `nickname`, `content`, `type`, `params`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (21, '档案借阅完成通知', 'BORROW_PASS', '系统通知', '您发起的【{billName}】已审核完成,请悉知!', 2, '[\"billName\"]', 0, NULL, '', '2023-11-09 11:01:20', '', '2023-11-09 11:01:25', b'0'); + +-- 移交审批流程消息通知模板插入 +INSERT INTO `lyr-one`.`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 (150, 'borrowApply_turn_over:1:b4d0a15f-7ea1-11ee-996c-9ebfc063da7b', 'ef7a711a-7ea0-11ee-996c-9ebfc063da7b', 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\\\"}\",\"{\\\"__config__\\\":{\\\"label\\\":\\\"多行文本\\\",\\\"labelWidth\\\":null,\\\"showLabel\\\":true,\\\"tag\\\":\\\"el-input\\\",\\\"tagIcon\\\":\\\"textarea\\\",\\\"required\\\":true,\\\"layout\\\":\\\"colFormItem\\\",\\\"span\\\":24,\\\"regList\\\":[],\\\"changeTag\\\":true,\\\"document\\\":\\\"https://element.eleme.cn/#/zh-CN/component/input\\\",\\\"formId\\\":102,\\\"renderKey\\\":\\\"1021699431468585\\\"},\\\"type\\\":\\\"textarea\\\",\\\"placeholder\\\":\\\"请输入多行文本\\\",\\\"autosize\\\":{\\\"minRows\\\":4,\\\"maxRows\\\":4},\\\"style\\\":{\\\"width\\\":\\\"100%\\\"},\\\"maxlength\\\":null,\\\"show-word-limit\\\":false,\\\"readonly\\\":false,\\\"disabled\\\":false,\\\"__vModel__\\\":\\\"field102\\\"}\",\"{\\\"__config__\\\":{\\\"label\\\":\\\"级联选择\\\",\\\"url\\\":\\\"https://www.fastmock.site/mock/f8d7a54fb1e60561e2f720d5a810009d/fg/cascaderList\\\",\\\"method\\\":\\\"get\\\",\\\"dataPath\\\":\\\"list\\\",\\\"dataConsumer\\\":\\\"options\\\",\\\"showLabel\\\":true,\\\"labelWidth\\\":null,\\\"tag\\\":\\\"el-cascader\\\",\\\"tagIcon\\\":\\\"cascader\\\",\\\"layout\\\":\\\"colFormItem\\\",\\\"defaultValue\\\":[],\\\"dataType\\\":\\\"dynamic\\\",\\\"span\\\":24,\\\"required\\\":true,\\\"regList\\\":[],\\\"changeTag\\\":true,\\\"document\\\":\\\"https://element.eleme.cn/#/zh-CN/component/cascader\\\",\\\"formId\\\":103,\\\"renderKey\\\":\\\"1031699431469582\\\"},\\\"options\\\":[{\\\"id\\\":1,\\\"value\\\":1,\\\"label\\\":\\\"选项1\\\",\\\"children\\\":[{\\\"id\\\":2,\\\"value\\\":2,\\\"label\\\":\\\"选项1-1\\\"}]}],\\\"placeholder\\\":\\\"请选择级联选择\\\",\\\"style\\\":{\\\"width\\\":\\\"100%\\\"},\\\"props\\\":{\\\"props\\\":{\\\"multiple\\\":false,\\\"label\\\":\\\"label\\\",\\\"value\\\":\\\"value\\\",\\\"children\\\":\\\"children\\\"}},\\\"show-all-levels\\\":true,\\\"disabled\\\":false,\\\"clearable\\\":true,\\\"filterable\\\":false,\\\"separator\\\":\\\"/\\\",\\\"__vModel__\\\":\\\"field103\\\"}\"]', NULL, NULL, '', '2023-11-09 09:45:48', '', '2023-11-09 09:45:48', b'0', 1); +INSERT INTO `lyr-one`.`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 (300, 'ef7a711a-7ea0-11ee-996c-9ebfc063da7b', '', 'Activity_1miq0ca', 30, '[1]', '', '2023-11-09 09:45:43', '', '2023-11-09 09:45:43', b'0', 1); +INSERT INTO `lyr-one`.`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 (301, 'ef7a711a-7ea0-11ee-996c-9ebfc063da7b', 'borrowApply_turn_over:1:b4d0a15f-7ea1-11ee-996c-9ebfc063da7b', 'Activity_1miq0ca', 30, '[1]', '', '2023-11-09 09:45:48', '', '2023-11-09 09:45:48', b'0', 1); +INSERT INTO `lyr-one`.`act_re_deployment` (`ID_`, `NAME_`, `CATEGORY_`, `KEY_`, `TENANT_ID_`, `DEPLOY_TIME_`, `DERIVED_FROM_`, `DERIVED_FROM_ROOT_`, `PARENT_DEPLOYMENT_ID_`, `ENGINE_VERSION_`) VALUES ('b4a635fc-7ea1-11ee-996c-9ebfc063da7b', '借阅申请单', '1', 'borrowApply_turn_over', '1', '2023-11-09 09:45:48.069', NULL, NULL, 'b4a635fc-7ea1-11ee-996c-9ebfc063da7b', NULL); +INSERT INTO `lyr-one`.`act_ge_bytearray` (`ID_`, `REV_`, `NAME_`, `DEPLOYMENT_ID_`, `BYTES_`, `GENERATED_`) VALUES ('4bf473fb-7ea1-11ee-996c-9ebfc063da7b', 2, 'source', NULL, 0x3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D225554462D38223F3E0A3C62706D6E323A646566696E6974696F6E7320786D6C6E733A7873693D22687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D612D696E7374616E63652220786D6C6E733A62706D6E323D22687474703A2F2F7777772E6F6D672E6F72672F737065632F42504D4E2F32303130303532342F4D4F44454C2220786D6C6E733A62706D6E64693D22687474703A2F2F7777772E6F6D672E6F72672F737065632F42504D4E2F32303130303532342F44492220786D6C6E733A64633D22687474703A2F2F7777772E6F6D672E6F72672F737065632F44442F32303130303532342F44432220786D6C6E733A64693D22687474703A2F2F7777772E6F6D672E6F72672F737065632F44442F32303130303532342F4449222069643D226469616772616D5F50726F636573735F3136393934393430383130303422207461726765744E616D6573706163653D22687474703A2F2F666C6F7761626C652E6F72672F62706D6E223E3C62706D6E323A70726F636573732069643D22626F72726F774170706C795F7475726E5F6F76657222206E616D653D22E5809FE99885E794B3E8AFB7E58D952220697345786563757461626C653D2274727565223E3C62706D6E323A73746172744576656E742069643D224576656E745F3167317361377022206E616D653D22E5BC80E5A78B223E3C62706D6E323A6F7574676F696E673E466C6F775F317064653662723C2F62706D6E323A6F7574676F696E673E3C2F62706D6E323A73746172744576656E743E3C62706D6E323A757365725461736B2069643D2241637469766974795F316D697130636122206E616D653D22E7AEA1E79086E59198223E3C62706D6E323A696E636F6D696E673E466C6F775F317064653662723C2F62706D6E323A696E636F6D696E673E3C62706D6E323A6F7574676F696E673E466C6F775F3174786D30696D3C2F62706D6E323A6F7574676F696E673E3C2F62706D6E323A757365725461736B3E3C62706D6E323A656E644576656E742069643D224576656E745F3075647177786C22206E616D653D22E7BB93E69D9F223E3C62706D6E323A696E636F6D696E673E466C6F775F3174786D30696D3C2F62706D6E323A696E636F6D696E673E3C2F62706D6E323A656E644576656E743E3C62706D6E323A73657175656E6365466C6F772069643D22466C6F775F317064653662722220736F757263655265663D224576656E745F3167317361377022207461726765745265663D2241637469766974795F316D697130636122202F3E3C62706D6E323A73657175656E6365466C6F772069643D22466C6F775F3174786D30696D2220736F757263655265663D2241637469766974795F316D697130636122207461726765745265663D224576656E745F3075647177786C22202F3E3C2F62706D6E323A70726F636573733E3C62706D6E64693A42504D4E4469616772616D2069643D2242504D4E4469616772616D5F31223E3C62706D6E64693A42504D4E506C616E652069643D22626F72726F774170706C795F7475726E5F6F7665725F6469222062706D6E456C656D656E743D22626F72726F774170706C795F7475726E5F6F766572223E3C62706D6E64693A42504D4E456467652069643D22466C6F775F3174786D30696D5F6469222062706D6E456C656D656E743D22466C6F775F3174786D30696D223E3C64693A776179706F696E7420783D223336302220793D2232343022202F3E3C64693A776179706F696E7420783D223433322220793D2232343022202F3E3C2F62706D6E64693A42504D4E456467653E3C62706D6E64693A42504D4E456467652069643D22466C6F775F317064653662725F6469222062706D6E456C656D656E743D22466C6F775F31706465366272223E3C64693A776179706F696E7420783D223137382220793D2232343022202F3E3C64693A776179706F696E7420783D223236302220793D2232343022202F3E3C2F62706D6E64693A42504D4E456467653E3C62706D6E64693A42504D4E53686170652069643D224576656E745F316731736137705F6469222062706D6E456C656D656E743D224576656E745F31673173613770223E3C64633A426F756E647320783D223134322220793D22323232222077696474683D22333622206865696768743D22333622202F3E3C62706D6E64693A42504D4E4C6162656C3E3C64633A426F756E647320783D223134392220793D22323635222077696474683D22323322206865696768743D22313422202F3E3C2F62706D6E64693A42504D4E4C6162656C3E3C2F62706D6E64693A42504D4E53686170653E3C62706D6E64693A42504D4E53686170652069643D2241637469766974795F316D69713063615F6469222062706D6E456C656D656E743D2241637469766974795F316D6971306361223E3C64633A426F756E647320783D223236302220793D22323030222077696474683D2231303022206865696768743D22383022202F3E3C2F62706D6E64693A42504D4E53686170653E3C62706D6E64693A42504D4E53686170652069643D224576656E745F3075647177786C5F6469222062706D6E456C656D656E743D224576656E745F3075647177786C223E3C64633A426F756E647320783D223433322220793D22323232222077696474683D22333622206865696768743D22333622202F3E3C62706D6E64693A42504D4E4C6162656C3E3C64633A426F756E647320783D223433392220793D22323635222077696474683D22323322206865696768743D22313422202F3E3C2F62706D6E64693A42504D4E4C6162656C3E3C2F62706D6E64693A42504D4E53686170653E3C2F62706D6E64693A42504D4E506C616E653E3C2F62706D6E64693A42504D4E4469616772616D3E3C2F62706D6E323A646566696E6974696F6E733E, NULL); +INSERT INTO `lyr-one`.`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 ('ef7a711a-7ea0-11ee-996c-9ebfc063da7b', 7, '借阅申请单', 'borrowApply_turn_over', '1', '2023-11-09 09:40:17.271', '2023-11-09 09:45:48.392', 1, '{\"description\":null,\"formType\":10,\"formId\":1,\"formCustomCreatePath\":null,\"formCustomViewPath\":null}', 'b4a635fc-7ea1-11ee-996c-9ebfc063da7b', '4bf473fb-7ea1-11ee-996c-9ebfc063da7b', NULL, '1'); +INSERT INTO `lyr-one`.`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 (300, 'ef7a711a-7ea0-11ee-996c-9ebfc063da7b', '', 'Activity_1miq0ca', 30, '[1]', '', '2023-11-09 09:45:43', '', '2023-11-09 09:45:43', b'0', 1); +INSERT INTO `lyr-one`.`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 (301, 'ef7a711a-7ea0-11ee-996c-9ebfc063da7b', 'borrowApply_turn_over:1:b4d0a15f-7ea1-11ee-996c-9ebfc063da7b', 'Activity_1miq0ca', 30, '[1]', '', '2023-11-09 09:45:48', '', '2023-11-09 09:45:48', b'0', 1); + +-- 修改状态默认值 +alter table archives_borrow_apply alter column status set default 1; 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 deleted file mode 100644 index bf3fd656..00000000 --- a/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/BillTypeEnum.java +++ /dev/null @@ -1,33 +0,0 @@ -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-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/BorrowApplyController.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/BorrowApplyController.java index b85af443..533b735e 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/BorrowApplyController.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/BorrowApplyController.java @@ -1,5 +1,13 @@ package cn.iocoder.yudao.module.archives.controller.admin.borrowapply; +import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.module.archives.controller.admin.turnover.vo.TurnOverUpdateReqVO; +import cn.iocoder.yudao.module.archives.convert.turnover.TurnOverConvert; +import cn.iocoder.yudao.module.archives.dal.dataobject.record.RecordDO; +import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO; +import cn.iocoder.yudao.module.archives.service.record.RecordService; +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; @@ -37,6 +45,12 @@ public class BorrowApplyController { @Resource private BorrowApplyService borrowApplyService; + @Resource + private BpmTaskService taskService; + + @Resource + private RecordService recordService; + @PostMapping("/create") @Operation(summary = "创建档案借阅申请") @PreAuthorize("@ss.hasPermission('archives:borrow-apply:create')") @@ -84,6 +98,37 @@ public class BorrowApplyController { @PreAuthorize("@ss.hasPermission('archives:borrow-apply:query')") public CommonResult> getBorrowApplyPage(@Valid BorrowApplyPageReqVO pageVO) { PageResult pageResult = borrowApplyService.getBorrowApplyPage(pageVO); + List list = pageResult.getList(); + if (CollUtil.isNotEmpty(list)) { + for (BorrowApplyDO t : list) { + 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最新的任务 + BorrowApplyUpdateReqVO updateReqVO = new BorrowApplyUpdateReqVO(); + updateReqVO.setId(t.getId()); + if (latest.getResult().equals(2)){ + updateReqVO.setBorrowState("0");//已借阅 + }else { + updateReqVO.setBorrowState("1");//驳回or未借阅 + } + if (!latest.getResult().toString().equals(t.getStatus())) { + updateReqVO.setStatus(latest.getResult().toString()); + + borrowApplyService.updateBorrowApply(updateReqVO); + } + } + } + } + PageResult pageResult2 = borrowApplyService.getBorrowApplyPage(pageVO); + return success(BorrowApplyConvert.INSTANCE.convertPage(pageResult2)); + } return success(BorrowApplyConvert.INSTANCE.convertPage(pageResult)); } diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyBaseVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyBaseVO.java index bc444a41..7e7949c5 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyBaseVO.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyBaseVO.java @@ -74,5 +74,21 @@ public class BorrowApplyBaseVO { @Schema(description = "案卷号", example = "案卷号") private String filesNum; + /** + * 流程实例的编号 + */ + @Schema(description = "流程实例的编号", example = "流程实例的编号") + private String processInstanceId; + /** + * 申请类型 + */ + @Schema(description = "申请类型", example = "申请类型") + private String billType; + /** + * 状态 + */ + @Schema(description = "状态", example = "状态") + private String status; + } diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyExportReqVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyExportReqVO.java index b3632c99..3c19058e 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyExportReqVO.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyExportReqVO.java @@ -72,4 +72,21 @@ public class BorrowApplyExportReqVO { @Schema(description = "案卷号", example = "案卷号") private String filesNum; + /** + * 流程实例的编号 + */ + @Schema(description = "流程实例的编号", example = "流程实例的编号") + private String processInstanceId; + /** + * 申请类型 + */ + @Schema(description = "申请类型", example = "申请类型") + private String billType; + /** + * 状态 + */ + @Schema(description = "状态", example = "状态") + private String status; + + } diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyPageReqVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyPageReqVO.java index 04f566a7..c401428e 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyPageReqVO.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyPageReqVO.java @@ -79,6 +79,23 @@ public class BorrowApplyPageReqVO extends PageParam { @Schema(description = "判断调用历史接口还是新增列表接口", example = "判断调用历史接口还是新增列表接口") private String historyOrList; + /** + * 流程实例的编号 + */ + @Schema(description = "流程实例的编号", example = "流程实例的编号") + private String processInstanceId; + /** + * 申请类型 + */ + @Schema(description = "申请类型", example = "申请类型") + private String billType; + /** + * 状态 + */ + @Schema(description = "状态", example = "状态") + private String status; + + } diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/borrowapply/BorrowApplyDO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/borrowapply/BorrowApplyDO.java index d9d6f197..b13d5c83 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/borrowapply/BorrowApplyDO.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/borrowapply/BorrowApplyDO.java @@ -106,5 +106,21 @@ public class BorrowApplyDO extends BaseDO { */ private String filesNum; + /** + * 流程实例的编号 + */ + @Schema(description = "流程实例的编号", example = "流程实例的编号") + private String processInstanceId; + /** + * 申请类型 + */ + @Schema(description = "申请类型", example = "申请类型") + private String billType; + /** + * 状态 + */ + @Schema(description = "状态", example = "状态") + private String status; + } diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java index 7d9b55db..14f927b9 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java @@ -2,9 +2,15 @@ package cn.iocoder.yudao.module.archives.service.borrowapply; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.string.StringUtils; +import cn.iocoder.yudao.framework.security.core.LoginUser; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.archives.controller.admin.record.vo.RecordUpdateReqVO; import cn.iocoder.yudao.module.archives.dal.dataobject.record.RecordDO; import cn.iocoder.yudao.module.archives.service.record.RecordService; +import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; +import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; +import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; +import cn.iocoder.yudao.module.bs.enums.BillTypeEnum; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -20,6 +26,7 @@ import cn.iocoder.yudao.module.archives.convert.borrowapply.BorrowApplyConvert; import cn.iocoder.yudao.module.archives.dal.mysql.borrowapply.BorrowApplyMapper; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.archives.enums.ErrorCodeConstants.*; +import static com.baomidou.mybatisplus.extension.toolkit.Db.updateById; /** * 档案借阅申请 Service 实现类 @@ -30,12 +37,18 @@ import static cn.iocoder.yudao.module.archives.enums.ErrorCodeConstants.*; @Validated public class BorrowApplyServiceImpl implements BorrowApplyService { + public static final String PROCESS_KEY = "borrowApply_turn_over"; + + @Resource private BorrowApplyMapper borrowApplyMapper; @Resource private RecordService recordService; + @Resource + private BpmProcessInstanceApi processInstanceApi; + @Override @Transactional public CommonResult createBorrowApply(BorrowApplyCreateReqVO createReqVO) { @@ -44,17 +57,34 @@ public class BorrowApplyServiceImpl implements BorrowApplyService { } // 插入 BorrowApplyDO borrowApply = BorrowApplyConvert.INSTANCE.convert(createReqVO); - //修改借阅状态 - RecordDO record = recordService.getRecord(createReqVO.getRecordId()); - if (StringUtils.isNotNull(record.getBorrowStatus())){ - if (record.getBorrowStatus().equals("0")){ - return CommonResult.error("档案已被借阅"); - } + + /* + * 这里因为是改为工作流 借阅状态修改在查询列表接口的修改审批状态那里修改了 + * 所以这里改为查询历史记录列表里面有没有已被借阅未归还 通过案卷号查询 + */ + PageResult borrowApplyDOPageResult = borrowApplyMapper.selectPageHistory(new BorrowApplyPageReqVO().setFilesNum(createReqVO.getFilesNum())); + if (StringUtils.isNotNull(borrowApplyDOPageResult)){ + List list = borrowApplyDOPageResult.getList(); + for (BorrowApplyDO b:list) { + if (b.getBorrowState().equals("0")){ + return CommonResult.error("档案已被借阅"); + } + } } - RecordUpdateReqVO recordUpdateReqVO = new RecordUpdateReqVO(); - BeanUtils.copyProperties(record,recordUpdateReqVO); - recordService.updateRecord(recordUpdateReqVO); + + borrowApply.setBillType("BORROW"); borrowApplyMapper.insert(borrowApply); + Map variables = new HashMap<>(); + variables.put("billId", borrowApply.getId()); + variables.put("userName", createReqVO.getUserName()); + variables.put("deptName", createReqVO.getDeptName()); + variables.put("billName", "档案借阅申请单"); + variables.put("billType","BORROW"); + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + String processInstanceId = processInstanceApi.createProcessInstance(loginUser.getId(), + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY) + .setVariables(variables).setBusinessKey(String.valueOf(borrowApply.getId()))); + this.borrowApplyMapper.updateById(new BorrowApplyDO().setId(borrowApply.getId()).setProcessInstanceId(processInstanceId)); // 返回 return CommonResult.success(borrowApply); } 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 index aa59990a..a505430a 100644 --- 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 @@ -37,10 +37,10 @@ import cn.iocoder.yudao.module.archives.dal.mysql.authenticate.AuthenticateMappe import cn.iocoder.yudao.module.archives.dal.mysql.record.RecordMapper; import cn.iocoder.yudao.module.archives.enums.ArchivesStatusEnum; import cn.iocoder.yudao.module.archives.enums.ArchivesTypeEnum; -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.bpm.enums.task.BpmProcessInstanceResultEnum; +import cn.iocoder.yudao.module.bs.enums.BillTypeEnum; import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.ElectronicAssetsExportReqVO; import cn.iocoder.yudao.module.ea.controller.admin.electronicconsultation.vo.ElectronicConsultationExportReqVO; import cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo.ElectronicContractsExportReqVO; @@ -60,21 +60,17 @@ import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; import cn.iocoder.yudao.module.infra.service.file.FileService; import cn.iocoder.yudao.module.setting.tools.JsonToXml; -import cn.iocoder.yudao.module.system.api.dept.DeptApi; -import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import com.alibaba.fastjson.JSON; 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.io.*; import java.net.URL; import java.net.URLConnection; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.*; diff --git a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/BillTypeEnum.java b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/BillTypeEnum.java index feb61999..4817a778 100644 --- a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/BillTypeEnum.java +++ b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/BillTypeEnum.java @@ -20,6 +20,7 @@ public enum BillTypeEnum { RCSQ("RCSQ", "日常申请单"), CLBX("CLBX", "差旅报销单"), RCBX("RCBX", "日常报销单"), + BORROW_KEY("BAYJ","借阅申请单") ; /**