diff --git a/src/main/java/com/yem/wm/im/intauditbusa/op/InAuditWithdrawalOp.java b/src/main/java/com/yem/wm/im/intauditbusa/op/InAuditWithdrawalOp.java new file mode 100644 index 00000000..bb06f50d --- /dev/null +++ b/src/main/java/com/yem/wm/im/intauditbusa/op/InAuditWithdrawalOp.java @@ -0,0 +1,49 @@ +package com.yem.wm.im.intauditbusa.op; + +import com.yem.wm.utils.DynamicObjectUtil; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.args.EndOperationTransactionArgs; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.AttachmentServiceHelper; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.DeleteServiceHelper; + +import java.util.List; +import java.util.Map; + +/** + * @author ljw + * @date 2024/10/12 15:23 + * @description InAuditWithdrawalOp + */ +public class InAuditWithdrawalOp extends AbstractOperationServicePlugIn { + @Override + public void endOperationTransaction(EndOperationTransactionArgs e) { + DynamicObject[] dataEntities = e.getDataEntities(); + for (DynamicObject dataEntitie : dataEntities) { + dataEntitie = BusinessDataServiceHelper.loadSingle(dataEntitie.getPkValue(), dataEntitie.getDynamicObjectType().getName()); + createPdf(dataEntitie); + } + } + + private void createPdf(DynamicObject dataEntitie) { + // 清空上传的附件面板 + List> beforeUpload = AttachmentServiceHelper.getAttachments("yem_im_intauditbusa", dataEntitie.getLong("id"), "attachmentpanel"); + List> salesorder = AttachmentServiceHelper.getAttachments("yem_es_salesorder", dataEntitie.getLong("yem_sourcebillid"), "attachmentpanel"); + for (Map map : salesorder) { + Boolean bool = false; + if (!bool) { + for (Map beforeUploadmap : beforeUpload) { + if (beforeUploadmap.get("uid").equals(map.get("uid"))) { + bool = true; + } + } + } + if (bool) { + DeleteServiceHelper.delete("bos_attachment", new QFilter[]{new QFilter("id", QCP.equals, map.get("attPkId"))}); + } + } + } +}