Browse Source

feat:侦测接口修改

master
郑贵龙 1 year ago
parent
commit
cd74983dc1
3 changed files with 45 additions and 7 deletions
  1. +17
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/mapper/ReceivablesDetailMapper.xml
  2. +5
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ReceivablesDetailRepository.java
  3. +23
    -7
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java

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

+ 23
- 7
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;
@ -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