|
|
@@ -9,7 +9,6 @@ import cn.reghao.autodop.dmaster.app.repository.build.AppCompileRepository;
|
|
|
import cn.reghao.autodop.dmaster.app.repository.build.AppPackRepository;
|
|
|
import cn.reghao.autodop.dmaster.app.repository.build.AppUpdateRepository;
|
|
|
import cn.reghao.autodop.dmaster.app.vo.BuildConfig;
|
|
|
-import cn.reghao.autodop.dmaster.vue.SelectOption;
|
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
|
|
import java.util.*;
|
|
|
@@ -57,203 +56,6 @@ public class AppRepository {
|
|
|
return buildConfig;
|
|
|
}
|
|
|
|
|
|
- /*public BuildConfig buildConfig() {
|
|
|
- List<AppUpdate> appUpdates = updateRepository.findAll();
|
|
|
- List<AppCompile> appCompiles = compileRepository.findAll();
|
|
|
- List<AppPack> appPacks = packRepository.findAll();
|
|
|
- List<Notification> notifications = notificationRepository.findAll();
|
|
|
-
|
|
|
- List<SelectOption> updateOptions = new ArrayList<>();
|
|
|
- convertToAppUpdates(appUpdates, updateOptions);
|
|
|
- List<SelectOption> compileOptions = new ArrayList<>();
|
|
|
- convertToAppCompiles(appCompiles, compileOptions);
|
|
|
- List<SelectOption> packOptions = new ArrayList<>();
|
|
|
- convertToAppPacks(appPacks, packOptions);
|
|
|
- List<SelectOption> notificationOptions = new ArrayList<>();
|
|
|
- convertToNotifications(notifications, notificationOptions);
|
|
|
-
|
|
|
- BuildConfig buildConfig = new BuildConfig();
|
|
|
- buildConfig.setAppUpdates(updateOptions);
|
|
|
- buildConfig.setAppCompiles(compileOptions);
|
|
|
- buildConfig.setAppPacks(packOptions);
|
|
|
- buildConfig.setNotifications(notificationOptions);
|
|
|
-
|
|
|
- return buildConfig;
|
|
|
- }*/
|
|
|
-
|
|
|
- private void convertToAppUpdates(List<AppUpdate> appUpdates, List<SelectOption> options) {
|
|
|
- Map<String, Integer> keys1 = new HashMap<>();
|
|
|
- Map<String, Integer> keys2 = new HashMap<>();
|
|
|
- Map<String, Integer> keys3 = new HashMap<>();
|
|
|
- for (AppUpdate appUpdate : appUpdates) {
|
|
|
- String repoType = appUpdate.getRepoType();
|
|
|
- String repoName = appUpdate.getRepoName();
|
|
|
- String username = appUpdate.getUsername();
|
|
|
-
|
|
|
- Integer index1 = keys1.get(repoType);
|
|
|
- Integer index2 = keys2.get(repoType + repoName);
|
|
|
- Integer index3 = keys3.get(repoType + repoName + username);
|
|
|
- if (index3 == null) {
|
|
|
- if (index2 == null) {
|
|
|
- if (index1 == null) {
|
|
|
- SelectOption option1 = new SelectOption();
|
|
|
- option1.setValue(repoType);
|
|
|
- options.add(option1);
|
|
|
- keys1.put(repoType, options.size()-1);
|
|
|
-
|
|
|
- SelectOption option2 = new SelectOption();
|
|
|
- option2.setValue(repoName);
|
|
|
- List<SelectOption> list2 = new ArrayList<>();
|
|
|
- list2.add(option2);
|
|
|
- option1.setChildren(list2);
|
|
|
- keys2.put(repoType + repoName, list2.size()-1);
|
|
|
-
|
|
|
- SelectOption option3 = new SelectOption();
|
|
|
- option3.setValue(username);
|
|
|
- List<SelectOption> list3 = new ArrayList<>();
|
|
|
- list3.add(option3);
|
|
|
- option2.setChildren(list3);
|
|
|
- keys3.put(repoType + repoName + username, list3.size()-1);
|
|
|
- } else {
|
|
|
- SelectOption option1 = options.get(index1);
|
|
|
-
|
|
|
- SelectOption option2 = new SelectOption();
|
|
|
- option2.setValue(repoName);
|
|
|
- List<SelectOption> list2 = new ArrayList<>();
|
|
|
- list2.add(option2);
|
|
|
- option1.setChildren(list2);
|
|
|
- keys2.put(repoType + repoName, list2.size()-1);
|
|
|
-
|
|
|
- SelectOption option3 = new SelectOption();
|
|
|
- option3.setValue(username);
|
|
|
- List<SelectOption> list3 = new ArrayList<>();
|
|
|
- list3.add(option3);
|
|
|
- option2.setChildren(list3);
|
|
|
- keys3.put(repoType + repoName + username, list3.size()-1);
|
|
|
- }
|
|
|
- } else {
|
|
|
- SelectOption option1 = options.get(index1);
|
|
|
- SelectOption option2 = option1.getChildren().get(index2);
|
|
|
-
|
|
|
- SelectOption option3 = new SelectOption();
|
|
|
- option3.setValue(username);
|
|
|
- List<SelectOption> list3 = new ArrayList<>();
|
|
|
- list3.add(option3);
|
|
|
- option2.setChildren(list3);
|
|
|
- keys3.put(repoType + repoName + username, list3.size()-1);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void convertToAppCompiles(List<AppCompile> appCompiles, List<SelectOption> options) {
|
|
|
- Map<String, Integer> keys1 = new HashMap<>();
|
|
|
- Map<String, Integer> keys2 = new HashMap<>();
|
|
|
- for (AppCompile appCompile : appCompiles) {
|
|
|
- String compilerType = appCompile.getCompilerType();
|
|
|
- String compilerName = appCompile.getCompilerName();
|
|
|
-
|
|
|
- Integer index1 = keys1.get(compilerType);
|
|
|
- Integer index2 = keys2.get(compilerType + compilerName);
|
|
|
- if (index2 == null) {
|
|
|
- if (index1 == null) {
|
|
|
- SelectOption option1 = new SelectOption();
|
|
|
- option1.setValue(compilerType);
|
|
|
- options.add(option1);
|
|
|
- keys1.put(compilerType, options.size()-1);
|
|
|
-
|
|
|
- SelectOption option2 = new SelectOption();
|
|
|
- option2.setValue(compilerName);
|
|
|
- List<SelectOption> list2 = new ArrayList<>();
|
|
|
- list2.add(option2);
|
|
|
- option1.setChildren(list2);
|
|
|
- keys2.put(compilerType + compilerName, list2.size()-1);
|
|
|
- } else {
|
|
|
- SelectOption option1 = options.get(index1);
|
|
|
-
|
|
|
- SelectOption option2 = new SelectOption();
|
|
|
- option2.setValue(compilerName);
|
|
|
- List<SelectOption> list2 = option1.getChildren();
|
|
|
- list2.add(option2);
|
|
|
- option1.setChildren(list2);
|
|
|
- keys2.put(compilerType + compilerName, list2.size()-1);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void convertToAppPacks(List<AppPack> appPacks, List<SelectOption> options) {
|
|
|
- Map<String, Integer> keys1 = new HashMap<>();
|
|
|
- Map<String, Integer> keys2 = new HashMap<>();
|
|
|
- for (AppPack appPack : appPacks) {
|
|
|
- String packerType = appPack.getPackerType();
|
|
|
- String packerName = appPack.getPackerName();
|
|
|
-
|
|
|
- Integer index1 = keys1.get(packerType);
|
|
|
- Integer index2 = keys2.get(packerType + packerName);
|
|
|
- if (index2 == null) {
|
|
|
- if (index1 == null) {
|
|
|
- SelectOption option1 = new SelectOption();
|
|
|
- option1.setValue(packerType);
|
|
|
- options.add(option1);
|
|
|
- keys1.put(packerType, options.size()-1);
|
|
|
-
|
|
|
- SelectOption option2 = new SelectOption();
|
|
|
- option2.setValue(packerName);
|
|
|
- List<SelectOption> list2 = new ArrayList<>();
|
|
|
- list2.add(option2);
|
|
|
- option1.setChildren(list2);
|
|
|
- keys2.put(packerType + packerName, list2.size()-1);
|
|
|
- } else {
|
|
|
- SelectOption option1 = options.get(index1);
|
|
|
-
|
|
|
- SelectOption option2 = new SelectOption();
|
|
|
- option2.setValue(packerName);
|
|
|
- List<SelectOption> list2 = option1.getChildren();
|
|
|
- list2.add(option2);
|
|
|
- option1.setChildren(list2);
|
|
|
- keys2.put(packerType + packerName, list2.size()-1);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void convertToNotifications(List<Notification> notifications, List<SelectOption> options) {
|
|
|
- Map<String, Integer> keys1 = new HashMap<>();
|
|
|
- Map<String, Integer> keys2 = new HashMap<>();
|
|
|
- for (Notification notification : notifications) {
|
|
|
- String notifierType = notification.getNotifierType();
|
|
|
- String notifierName = notification.getNotifierName();
|
|
|
-
|
|
|
- Integer index1 = keys1.get(notifierType);
|
|
|
- Integer index2 = keys2.get(notifierType + notifierName);
|
|
|
- if (index2 == null) {
|
|
|
- if (index1 == null) {
|
|
|
- SelectOption option1 = new SelectOption();
|
|
|
- option1.setValue(notifierType);
|
|
|
- options.add(option1);
|
|
|
- keys1.put(notifierType, options.size()-1);
|
|
|
-
|
|
|
- SelectOption option2 = new SelectOption();
|
|
|
- option2.setValue(notifierName);
|
|
|
- List<SelectOption> list2 = new ArrayList<>();
|
|
|
- list2.add(option2);
|
|
|
- option1.setChildren(list2);
|
|
|
- keys2.put(notifierType + notifierName, list2.size()-1);
|
|
|
- } else {
|
|
|
- SelectOption option1 = options.get(index1);
|
|
|
-
|
|
|
- SelectOption option2 = new SelectOption();
|
|
|
- option2.setValue(notifierName);
|
|
|
- List<SelectOption> list2 = option1.getChildren();
|
|
|
- list2.add(option2);
|
|
|
- option1.setChildren(list2);
|
|
|
- keys2.put(notifierType + notifierName, list2.size()-1);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public void projs(BuildConfig buildConfig) {
|
|
|
List<String> projs = projRepository.findAll().stream()
|
|
|
.map(ProjOrchestration::getProjId)
|