|
@ -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<String, String> headers, String messageBody) throws Exception { |
|
|
|
|
|
EAIRequest eaiRequest = EAIRequest.build(messageBody); |
|
|
|
|
|
List<CollectionDetailEntity> collectionDetailEntities = eaiRequest.getObject("receivables_info", new TypeReference<List<CollectionDetailEntity>>() {}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (CollectionDetailEntity collectionDetailEntity : collectionDetailEntities) { |
|
|
|
|
|
if (StringUtils.isEmpty(collectionDetailEntity.getSalesOrder()) |
|
|
|
|
|
||StringUtils.isEmpty(collectionDetailEntity.getSalesOrderNumber())){ |
|
|
|
|
|
throw new DWBusinessException("缺少必要参数"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
collectionDetailRepository.deleteBatch(collectionDetailEntities, SecurityUtil.getUserProfile().getTenantSid()); |
|
|
|
|
|
return buildOK(); |
|
|
|
|
|
} |
|
|
|
|
|
} |