From f87e8a1cd0d025cdc193719147f6b0843b6dfb1a Mon Sep 17 00:00:00 2001 From: zhenggl Date: Wed, 13 Sep 2023 13:42:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AEbk?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=82=AC=E6=94=B6=E6=95=B0=E6=8D=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3,=E5=82=AC=E6=94=B6=E8=A1=A8=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BA=BA=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReceivablesTaskDeleteEAIService.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesTaskDeleteEAIService.java diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesTaskDeleteEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesTaskDeleteEAIService.java new file mode 100644 index 0000000..33aca83 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesTaskDeleteEAIService.java @@ -0,0 +1,48 @@ +package com.digiwin.athena.app.ptc.service.receivables; + +import com.alibaba.fastjson.TypeReference; +import com.alibaba.nacos.common.utils.StringUtils; +import com.digiwin.app.container.exceptions.DWBusinessException; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.ptc.infra.entity.CollectionDetailEntity; +import com.digiwin.athena.app.ptc.infra.repository.CollectionDetailRepository; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import com.digiwin.athena.opt.common.security.SecurityUtil; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/13 + */ +public class ReceivablesTaskDeleteEAIService extends AbsEAIService { + + @Resource + private CollectionDetailRepository collectionDetailRepository; + + + @Override + public String getServiceName() { + return ReceivablesUtil.RECEIVABLES_TASK_DELETE; + } + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List collectionDetailEntities = eaiRequest.getObject("receivables_info", new TypeReference>() {}); + + + for (CollectionDetailEntity collectionDetailEntity : collectionDetailEntities) { + if (StringUtils.isEmpty(collectionDetailEntity.getSalesOrder()) + ||StringUtils.isEmpty(collectionDetailEntity.getSalesOrderNumber())){ + throw new DWBusinessException("缺少必要参数"); + } + } + + collectionDetailRepository.deleteBatch(collectionDetailEntities, SecurityUtil.getUserProfile().getTenantSid()); + return buildOK(); + } +}