feat:[REQ-3488] 协同关系数据进行去重

This commit is contained in:
liuyang 2024-12-31 14:21:39 +08:00
parent 3ac583690b
commit 0df7e7d3b8
2 changed files with 60 additions and 1 deletions

View File

@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
@ -201,7 +202,8 @@ public class CooperateShipServiceImpl implements CooperateShipService {
}
// resultNodeList 根据path进行正序
List<Long> resultCooperateNodeIds = CollUtil.map(resultNodeList, SaasCooperateShip::getId, true);
resultNodeList.sort(Comparator.comparing(SaasCooperateShip::getPath));
return BeanUtil.copyToList(resultNodeList, OrgCooperateShipDTO.class);
return BeanUtil.copyToList(resultNodeList.stream().filter(t -> resultCooperateNodeIds.contains(t.getId())).collect(Collectors.toSet()), OrgCooperateShipDTO.class);
}
}

View File

@ -0,0 +1,57 @@
package cn.axzo.orgmanax;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
/**
* @author tanjie@axzo.cn
* @date 2024/11/28 15:54
*/
@EnableFeignClients(value = {"cn.axzo"})
@SpringBootApplication(scanBasePackages = PreApplication.DEFAULT_DIR)
@Slf4j
public class PreApplication {
public static final String DEFAULT_DIR = "cn.axzo.orgmanax";
public static void main(String[] args) {
System.setProperty("rocket.consumer.listeners.disable", "true");
System.setProperty("spring.profiles.active","pre");
System.setProperty("NACOS_HOST", "https://pre-nacos.axzo.cn");
System.setProperty("NACOS_PORT","443");
System.setProperty("NACOS_NAMESPACE_ID", "8b4cf725-7595-4c92-b2a6-9260a51ce078");
System.setProperty("CUSTOM_ENV","pre");
// System.setProperty("spring.datasource.url","jdbc:mysql://172.16.2.171:3306/pudge?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=true&verifyServerCertificate=false&rewriteBatchedStatements=true");
System.setProperty("spring.redis.port","6379");
System.setProperty("spring.redis.host", "172.16.1.76");
System.setProperty("spring.redis.database","5");
System.setProperty("spring.redis.password", "25HWbgHCsgoE2OktIn9w");
System.setProperty("xxl.job.admin.addresses","http://pre-xxl-job.axzo.cn/xxl-job-admin");
System.setProperty("rocketmq.name-server", "172.16.2.82:9876");
System.setProperty("logback.path", "/tmp");
SpringApplication application = new SpringApplication(PreApplication.class);
ConfigurableApplicationContext run = application.run(args);
Environment env = run.getEnvironment();
log.info(
"--------------------------------------------------------------------------------------------------------------------\n" +
"Application 【{}】 is running on 【{}】 environment!\n" +
"Api Local: \thttp://127.0.0.1:{}\n" +
"Mysql: \t{}\t username:{}\n" +
"Redis: \t{}:{}\t database:{}\n" +
"RocketMQ: \t{}",
env.getProperty("spring.application.name"),
env.getProperty("spring.profiles.active"),
env.getProperty("server.port"),
env.getProperty("spring.datasource.url"),
env.getProperty("spring.datasource.username"),
env.getProperty("spring.redis.host"),
env.getProperty("spring.redis.port"),
env.getProperty("spring.redis.database"),
env.getProperty("rocketmq.name-server") +
"\n----------------------------------------------------------");
}
}