Browse Source

Merge branch 'sprint/S3' into release/S3

master
郑贵龙 1 year ago
parent
commit
22a2e25b2f
7 changed files with 67 additions and 24 deletions
  1. +5
    -1
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java
  2. +17
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/mapper/ReceivablesDetailMapper.xml
  3. +5
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ReceivablesDetailRepository.java
  4. +10
    -8
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/paymentdetails/ReceivablesGetEAIService.java
  5. +4
    -5
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java
  6. +2
    -2
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesCreateEAIService.java
  7. +24
    -8
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.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;
}

+ 17
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/mapper/ReceivablesDetailMapper.xml View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.digiwin.athena.app.ptc.infra.repository.ReceivablesDetailRepository">
<delete id="deleteBatch">
delete from cim_receivables_detail where tenantsid=#{tenantSid}
<foreach collection="list" item="item" index="index" separator=" or" open="" close="">
(
sales_order = #{item.salesOrder}
and sales_order_number = #{item.salesOrderNumber}
)
</foreach>
</delete>
</mapper>

+ 5
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ReceivablesDetailRepository.java View File

@ -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<ReceivablesDetailEntity> {
void deleteBatch(@Param("list") List<CollectionDetailEntity> list, @Param("tenantSid")Long tenantSid);
}

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


+ 4
- 5
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java View File

@ -43,7 +43,7 @@ public class ProductionCreateEAIService extends AbsEAIService {
}
//随机赋值list
List<ProductionDetailsEntity> list = Arrays.asList(
private List<ProductionDetailsEntity> 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)) {


+ 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);


+ 24
- 8
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java View File

@ -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;
@ -38,7 +44,7 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService {
//随机赋值list
List<CollectionDetailEntity> list = Arrays.asList(
private List<CollectionDetailEntity> list = Arrays.asList(
new CollectionDetailEntity("鼎捷A半导体有限公司","dj001","张三","186****9498"),
new CollectionDetailEntity("鼎捷B半导体有限公司","dj002","李四","158****4794"),
new CollectionDetailEntity("鼎捷C半导体有限公司","dj003","王五","150****9529"),
@ -53,14 +59,24 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService {
@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>>() {});
//先删除
collectionDetailRepository.deleteBatch(collectionDetailEntities, SecurityUtil.getUserProfile().getTenantSid());
Long tenantSid = SecurityUtil.getUserProfile().getTenantSid();
//取出已完成的数据
LambdaQueryWrapper<CollectionDetailEntity> lmq = new LambdaQueryWrapper<>();
lmq.eq(CollectionDetailEntity::getTenantSid,tenantSid);
lmq.eq(CollectionDetailEntity::getStatus, TabStatusEnums.COMPLETED.getValue());
List<CollectionDetailEntity> 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);


Loading…
Cancel
Save