|
@ -1,11 +1,14 @@ |
|
|
package com.digiwin.athena.app.ptc.service.receivables; |
|
|
package com.digiwin.athena.app.ptc.service.receivables; |
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
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.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.entity.CollectionDetailEntity; |
|
|
import com.digiwin.athena.app.ptc.infra.repository.CollectionDetailRepository; |
|
|
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.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.eai.service.AbsEAIService; |
|
|
import com.digiwin.athena.opt.common.security.SecurityUtil; |
|
|
import com.digiwin.athena.opt.common.security.SecurityUtil; |
|
|
import com.digiwin.athena.opt.common.util.DateUtils; |
|
|
import com.digiwin.athena.opt.common.util.DateUtils; |
|
@ -27,6 +30,9 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService { |
|
|
@Resource |
|
|
@Resource |
|
|
private CollectionDetailRepository collectionDetailRepository; |
|
|
private CollectionDetailRepository collectionDetailRepository; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private ReceivablesDetailRepository receivablesDetailRepository; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private CollectionDetailService collectionDetailService; |
|
|
private CollectionDetailService collectionDetailService; |
|
|
|
|
|
|
|
@ -53,14 +59,24 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService { |
|
|
@Override |
|
|
@Override |
|
|
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { |
|
|
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(); |
|
|
Random random = new Random(); |
|
|
//随机新增 |
|
|
//随机新增 |
|
|
for (CollectionDetailEntity collectionDetailEntity : list) { |
|
|
|
|
|
|
|
|
for (CollectionDetailEntity collectionDetailEntity : this.list) { |
|
|
int randomNumber = random.nextInt(100); |
|
|
int randomNumber = random.nextInt(100); |
|
|
int nextInt = random.nextInt(30); |
|
|
int nextInt = random.nextInt(30); |
|
|
int dayInt = random.nextInt(10); |
|
|
int dayInt = random.nextInt(10); |
|
@ -81,7 +97,7 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService { |
|
|
collectionDetailEntity.setOverdueDays(String.valueOf(DateUtils.getDayInterval(new Date(),collectionDetailEntity.getReceivableDate()))); |
|
|
collectionDetailEntity.setOverdueDays(String.valueOf(DateUtils.getDayInterval(new Date(),collectionDetailEntity.getReceivableDate()))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
collectionDetailService.saveBatch(list); |
|
|
|
|
|
|
|
|
collectionDetailService.saveBatch(this.list); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|