From 98f0843320f39916443f7a07295d3966ce9776ad Mon Sep 17 00:00:00 2001 From: zhenggl Date: Wed, 13 Sep 2023 14:35:06 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/production/ProductionCreateEAIService.java | 9 ++++----- .../receivables/ReceivablesInitialCreateEAIService.java | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java index 8dbd85c..583f103 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java @@ -43,7 +43,7 @@ public class ProductionCreateEAIService extends AbsEAIService { } //随机赋值list - List list = Arrays.asList( + private List list = Arrays.asList( new ProductionDetailsEntity("001", "一号工厂", "一号工厂刘晓鹏"), new ProductionDetailsEntity("002", "二号工厂", "二号工厂饶文豪"), new ProductionDetailsEntity("003", "三号工厂", "三号工厂卢人辅")); @@ -65,10 +65,9 @@ public class ProductionCreateEAIService extends AbsEAIService { - + Random random = new Random(); //默认赋值 for (ProductionDetailsEntity productionDetailsEntity : productionDetailsEntities) { - Random random = new Random(); int randomNumber = random.nextInt(3); productionDetailsEntity.setFactoryNo(this.list.get(randomNumber).getFactoryNo()); productionDetailsEntity.setFactoryName(this.list.get(randomNumber).getFactoryName()); @@ -77,7 +76,7 @@ public class ProductionCreateEAIService extends AbsEAIService { productionDetailsEntity.setProduceBoss("23467345221"); productionDetailsEntity.setProductionStatus(TabStatusEnums.PENDING.getValue().toString()); productionDetailsEntity.setNature(String.valueOf(randomNumber)); - String batchNo = cteateBatchNo(); + String batchNo = createBatchNo(); productionDetailsEntity.setBatchNo("MMDD-"+batchNo); //预计产量赋值 if (CollectionUtils.isNotEmpty(list)) { @@ -98,7 +97,7 @@ public class ProductionCreateEAIService extends AbsEAIService { return buildOK(); } - private String cteateBatchNo(){ + private String createBatchNo(){ StringBuffer sb = new StringBuffer(); Long batchNo; if (redisUtil.getRedisTemplate().hasKey(ProductionUtil.KEY)) { diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java index ab88599..6e30605 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java @@ -38,7 +38,7 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService { //随机赋值list - List list = Arrays.asList( + private List list = Arrays.asList( new CollectionDetailEntity("鼎捷A半导体有限公司","dj001","张三","186****9498"), new CollectionDetailEntity("鼎捷B半导体有限公司","dj002","李四","158****4794"), new CollectionDetailEntity("鼎捷C半导体有限公司","dj003","王五","150****9529"), From cd74983dc1937546c1efe80beae3e138a3603925 Mon Sep 17 00:00:00 2001 From: zhenggl Date: Wed, 13 Sep 2023 15:31:35 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=E4=BE=A6=E6=B5=8B=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/mapper/ReceivablesDetailMapper.xml | 17 +++++++++++ .../ReceivablesDetailRepository.java | 5 ++++ .../ReceivablesInitialCreateEAIService.java | 30 ++++++++++++++----- 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/mapper/ReceivablesDetailMapper.xml diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/mapper/ReceivablesDetailMapper.xml b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/mapper/ReceivablesDetailMapper.xml new file mode 100644 index 0000000..7d4f9e1 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/mapper/ReceivablesDetailMapper.xml @@ -0,0 +1,17 @@ + + + + + + + delete from cim_receivables_detail where tenantsid=#{tenantSid} + + ( + sales_order = #{item.salesOrder} + and sales_order_number = #{item.salesOrderNumber} + ) + + + diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ReceivablesDetailRepository.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ReceivablesDetailRepository.java index a63d366..387e1c4 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ReceivablesDetailRepository.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ReceivablesDetailRepository.java @@ -1,11 +1,16 @@ package com.digiwin.athena.app.ptc.infra.repository; +import com.digiwin.athena.app.ptc.infra.entity.CollectionDetailEntity; import com.digiwin.athena.app.ptc.infra.entity.ReceivablesDetailEntity; import com.digiwin.athena.opt.persistence.repository.BaseRepository; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @auther: zhenggl * @date: 2023/9/12 */ public interface ReceivablesDetailRepository extends BaseRepository { + void deleteBatch(@Param("list") List list, @Param("tenantSid")Long tenantSid); } diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java index 6e30605..544c896 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java @@ -1,11 +1,14 @@ package com.digiwin.athena.app.ptc.service.receivables; import com.alibaba.fastjson.TypeReference; +import com.alibaba.nacos.common.utils.CollectionUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.infra.common.enums.TabStatusEnums; import com.digiwin.athena.app.ptc.infra.entity.CollectionDetailEntity; import com.digiwin.athena.app.ptc.infra.repository.CollectionDetailRepository; +import com.digiwin.athena.app.ptc.infra.repository.ReceivablesDetailRepository; import com.digiwin.athena.app.ptc.infra.service.CollectionDetailService; -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 com.digiwin.athena.opt.common.util.DateUtils; @@ -27,6 +30,9 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService { @Resource private CollectionDetailRepository collectionDetailRepository; + @Resource + private ReceivablesDetailRepository receivablesDetailRepository; + @Resource private CollectionDetailService collectionDetailService; @@ -53,14 +59,24 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService { @Override public DWEAIResult execute(Map headers, String messageBody) throws Exception { - EAIRequest eaiRequest = EAIRequest.build(messageBody); - List collectionDetailEntities = eaiRequest.getObject("receivables_info", new TypeReference>() {}); - //先删除 - collectionDetailRepository.deleteBatch(collectionDetailEntities, SecurityUtil.getUserProfile().getTenantSid()); + Long tenantSid = SecurityUtil.getUserProfile().getTenantSid(); + + //取出已完成的数据 + LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); + lmq.eq(CollectionDetailEntity::getTenantSid,tenantSid); + lmq.eq(CollectionDetailEntity::getStatus, TabStatusEnums.COMPLETED.getValue()); + List list = collectionDetailService.list(lmq); + + //删除应收数据 + if (CollectionUtils.isNotEmpty(list)){ + receivablesDetailRepository.deleteBatch(list,tenantSid); + } + + Random random = new Random(); //随机新增 - for (CollectionDetailEntity collectionDetailEntity : list) { + for (CollectionDetailEntity collectionDetailEntity : this.list) { int randomNumber = random.nextInt(100); int nextInt = random.nextInt(30); int dayInt = random.nextInt(10); @@ -81,7 +97,7 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService { collectionDetailEntity.setOverdueDays(String.valueOf(DateUtils.getDayInterval(new Date(),collectionDetailEntity.getReceivableDate()))); } - collectionDetailService.saveBatch(list); + collectionDetailService.saveBatch(this.list); From be875ee4ec936bb1f48a64d6b7f99256bcabe8d0 Mon Sep 17 00:00:00 2001 From: zhenggl Date: Wed, 13 Sep 2023 15:52:54 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=E6=8E=A5=E5=8F=A3=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/entity/ReceivablesDetailEntity.java | 6 +++++- .../ReceivablesGetEAIService.java | 18 ++++++++++-------- .../ReceivablesCreateEAIService.java | 4 ++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java index b394bef..901f815 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java @@ -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 headers, String messageBody) throws Exception { - LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); - lmq.eq(PaymentDetailsEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid()); - List list = paymentDetailsService.list(lmq); + LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); + lmq.eq(ReceivablesDetailEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid()); + List list = receivablesDetailService.list(lmq); if (CollectionUtils.isEmpty(list)){ return buildOK("query_result",list); } //查询限制额度 - List customerNoList = list.stream().map(PaymentDetailsEntity::getCustomerNo).collect(Collectors.toList()); + List customerNoList = list.stream().map(ReceivablesDetailEntity::getCustomerNo).collect(Collectors.toList()); LambdaQueryWrapper creditLmq = new LambdaQueryWrapper<>(); creditLmq.in(LimitCreditEntity::getCustomerNo,customerNoList); List 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()); } } } diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesCreateEAIService.java index 217823e..2d5d218 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesCreateEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesCreateEAIService.java @@ -39,9 +39,9 @@ public class ReceivablesCreateEAIService extends AbsEAIService { EAIRequest eaiRequest = EAIRequest.build(messageBody); List receivablesDetailEntities = eaiRequest.getObject("get_data", new TypeReference>() {}); - //根据bk删除数据 + /*//根据bk删除数据 //先删除 - collectionDetailRepository.deleteBatch(receivablesDetailEntities, SecurityUtil.getUserProfile().getTenantSid()); + collectionDetailRepository.deleteBatch(receivablesDetailEntities, SecurityUtil.getUserProfile().getTenantSid());*/ collectionDetailService.saveBatch(receivablesDetailEntities); return buildOK("query_result",receivablesDetailEntities);