From 5faeaf334edda0fee20631c43fe41f9633c37030 Mon Sep 17 00:00:00 2001
From: JiilingLee <462362@qq.com>
Date: Mon, 6 Nov 2023 15:35:57 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=AF=8F?=
=?UTF-8?q?=E5=B0=8F=E6=97=B6=E6=89=A7=E8=A1=8C=E4=B8=80=E6=AC=A1=E4=BC=9A?=
=?UTF-8?q?=E8=AE=A1=E5=87=AD=E8=AF=81=E5=85=B3=E8=81=94=E5=8E=9F=E5=A7=8B?=
=?UTF-8?q?=E5=87=AD=E8=AF=81=EF=BC=88=E9=99=84=E4=BB=B6=E3=80=81=E5=AE=A1?=
=?UTF-8?q?=E6=89=B9=E6=B5=81=E7=A8=8B=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../yudao-module-accounting-biz/pom.xml | 6 ++
.../module/accounting/job/injoinJob.java | 61 +++++++++++++++++++
2 files changed, 67 insertions(+)
create mode 100644 yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/job/injoinJob.java
diff --git a/yudao-module-accounting/yudao-module-accounting-biz/pom.xml b/yudao-module-accounting/yudao-module-accounting-biz/pom.xml
index 3ccef5c1..3932b743 100644
--- a/yudao-module-accounting/yudao-module-accounting-biz/pom.xml
+++ b/yudao-module-accounting/yudao-module-accounting-biz/pom.xml
@@ -32,6 +32,12 @@
yudao-spring-boot-starter-biz-data-permission
+
+
+ cn.iocoder.boot
+ yudao-spring-boot-starter-job
+
+
cn.iocoder.boot
diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/job/injoinJob.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/job/injoinJob.java
new file mode 100644
index 00000000..663cc805
--- /dev/null
+++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/job/injoinJob.java
@@ -0,0 +1,61 @@
+package cn.iocoder.yudao.module.accounting.job;
+
+import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
+import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
+import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
+import cn.iocoder.yudao.module.accounting.dal.dataobject.attachment.AttachmentDO;
+import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankSlipDO;
+import cn.iocoder.yudao.module.accounting.dal.dataobject.flow.FlowDO;
+import cn.iocoder.yudao.module.accounting.dal.mysql.attachment.AttachmentMapper;
+import cn.iocoder.yudao.module.accounting.dal.mysql.bankslip.BankSlipMapper;
+import cn.iocoder.yudao.module.accounting.dal.mysql.flow.FlowMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Component
+@TenantJob // 多租户
+@Slf4j
+public class injoinJob implements JobHandler {
+
+ @Resource
+ private BankSlipMapper bankSlipMapper;
+ @Resource
+ private FlowMapper flowMapper;
+ @Resource
+ private AttachmentMapper attachmentMapper;
+
+ @Override
+ public String execute(String param) throws Exception {
+ //银行回单流程号OA/ERP流程编号得到凭证id
+ List BankSlipDOList = bankSlipMapper.selectList(new QueryWrapperX()
+ .isNotNull("flow_code"));
+ for (BankSlipDO bankSlip:BankSlipDOList
+ ) {
+ //每个回单的流程号 获取后查找绑定附件、审批流程
+ Long voucherId = bankSlip.getVoucherId();
+ String flowCode = bankSlip.getFlowCode();
+ //通过flowCode查找附件、审批流程
+ List flowDOList = flowMapper.selectList(new QueryWrapperX()
+ .eq("flow_code", flowCode));
+ for (FlowDO flowDO:flowDOList
+ ) {
+ flowDO.setVoucherId(voucherId);
+ flowMapper.updateById(flowDO);
+ }
+ List attachmentDOList = attachmentMapper.selectList(new QueryWrapperX()
+ .eq("flow_code", flowCode));
+ for (AttachmentDO attachmentDO:attachmentDOList
+ ) {
+ attachmentDO.setVoucherId(voucherId);
+ attachmentMapper.updateById(attachmentDO);
+ }
+ }
+
+
+
+ return "injoinJob 执行了";
+ }
+}