|
|
@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.digiwin.app.service.DWEAIResult; |
|
|
|
import com.digiwin.athena.app.ptc.infra.entity.LimitCreditEntity; |
|
|
|
import com.digiwin.athena.app.ptc.infra.entity.PaymentDetailsEntity; |
|
|
|
import com.digiwin.athena.app.ptc.infra.entity.ReceivablesDetailEntity; |
|
|
|
import com.digiwin.athena.app.ptc.infra.service.LimitCreditService; |
|
|
|
import com.digiwin.athena.app.ptc.infra.service.PaymentDetailsService; |
|
|
|
import com.digiwin.athena.app.ptc.infra.service.ReceivablesDetailService; |
|
|
|
import com.digiwin.athena.opt.common.eai.service.AbsEAIService; |
|
|
|
import com.digiwin.athena.opt.common.security.SecurityUtil; |
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
@ -27,7 +29,7 @@ import java.util.stream.Collectors; |
|
|
|
public class ReceivablesGetEAIService extends AbsEAIService { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private PaymentDetailsService paymentDetailsService; |
|
|
|
private ReceivablesDetailService receivablesDetailService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private LimitCreditService limitCreditService; |
|
|
@ -40,25 +42,25 @@ public class ReceivablesGetEAIService extends AbsEAIService { |
|
|
|
@Override |
|
|
|
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { |
|
|
|
|
|
|
|
LambdaQueryWrapper<PaymentDetailsEntity> lmq = new LambdaQueryWrapper<>(); |
|
|
|
lmq.eq(PaymentDetailsEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid()); |
|
|
|
List<PaymentDetailsEntity> list = paymentDetailsService.list(lmq); |
|
|
|
LambdaQueryWrapper<ReceivablesDetailEntity> lmq = new LambdaQueryWrapper<>(); |
|
|
|
lmq.eq(ReceivablesDetailEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid()); |
|
|
|
List<ReceivablesDetailEntity> list = receivablesDetailService.list(lmq); |
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(list)){ |
|
|
|
return buildOK("query_result",list); |
|
|
|
} |
|
|
|
|
|
|
|
//查询限制额度 |
|
|
|
List<String> customerNoList = list.stream().map(PaymentDetailsEntity::getCustomerNo).collect(Collectors.toList()); |
|
|
|
List<String> customerNoList = list.stream().map(ReceivablesDetailEntity::getCustomerNo).collect(Collectors.toList()); |
|
|
|
LambdaQueryWrapper<LimitCreditEntity> creditLmq = new LambdaQueryWrapper<>(); |
|
|
|
creditLmq.in(LimitCreditEntity::getCustomerNo,customerNoList); |
|
|
|
List<LimitCreditEntity> limitCreditEntityList = limitCreditService.list(creditLmq); |
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(limitCreditEntityList)){ |
|
|
|
for (PaymentDetailsEntity paymentDetailsEntity : list) { |
|
|
|
for (ReceivablesDetailEntity receivablesDetailEntity : list) { |
|
|
|
for (LimitCreditEntity limitCreditEntity : limitCreditEntityList) { |
|
|
|
if (Objects.nonNull(limitCreditEntity.getLimitAmount())&&paymentDetailsEntity.getCustomerNo().equals(limitCreditEntity.getCustomerNo())){ |
|
|
|
paymentDetailsEntity.setLimitAmount(limitCreditEntity.getLimitAmount()); |
|
|
|
if (Objects.nonNull(limitCreditEntity.getLimitAmount())&&receivablesDetailEntity.getCustomerNo().equals(limitCreditEntity.getCustomerNo())){ |
|
|
|
receivablesDetailEntity.setLimitAmount(limitCreditEntity.getLimitAmount()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|