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 执行了"; + } +}