Browse Source

feat:接口逻辑调整

master
郑贵龙 1 year ago
parent
commit
be875ee4ec
3 changed files with 17 additions and 11 deletions
  1. +5
    -1
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java
  2. +10
    -8
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/paymentdetails/ReceivablesGetEAIService.java
  3. +2
    -2
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesCreateEAIService.java

+ 5
- 1
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java View File

@ -3,6 +3,7 @@ package com.digiwin.athena.app.ptc.infra.entity;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.digiwin.athena.opt.persistence.domain.BaseMgrEntity;
import com.google.gson.annotations.SerializedName;
@ -115,6 +116,9 @@ public class ReceivablesDetailEntity extends BaseMgrEntity<ReceivablesDetailEnti
@SerializedName(value = "overdue_days")
private String overdueDays;
/** 限制金额 */
@TableField(exist = false)
@SerializedName(value = "limit_amount")
private BigDecimal limitAmount;
}

+ 10
- 8
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/paymentdetails/ReceivablesGetEAIService.java View File

@ -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());
}
}
}


+ 2
- 2
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesCreateEAIService.java View File

@ -39,9 +39,9 @@ public class ReceivablesCreateEAIService extends AbsEAIService {
EAIRequest eaiRequest = EAIRequest.build(messageBody);
List<CollectionDetailEntity> receivablesDetailEntities = eaiRequest.getObject("get_data", new TypeReference<List<CollectionDetailEntity>>() {});
//根据bk删除数据
/*//根据bk删除数据
//先删除
collectionDetailRepository.deleteBatch(receivablesDetailEntities, SecurityUtil.getUserProfile().getTenantSid());
collectionDetailRepository.deleteBatch(receivablesDetailEntities, SecurityUtil.getUserProfile().getTenantSid());*/
collectionDetailService.saveBatch(receivablesDetailEntities);
return buildOK("query_result",receivablesDetailEntities);


Loading…
Cancel
Save