package view;
import domain.Programmer;
import service.NameListService;
import service.ProjectService;
import java.util.ArrayList;
import java.util.ArrayList;
public class IndexView {
/**
* 颜色特效
*/
public static final String ANSI_RESET = "\u001B[0m";
public static final String ANSI_GREEN = "\u001B[32m";
public static final String ANSI_YELLOW = "\u001B[33m";
public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_BLUE = "\u001B[34m";
public static final String ANSI_CYAN = "\u001B[36m";
private LoginView loginVi = new LoginView();
private NameListService nameListSer = new NameListService();
private TeamView teamVi = new TeamView();
private ProjectService projectSer = new ProjectService();
private ArrayList<Programmer[]> manyTeam=null;
public void menu() {
boolean loopFlag = true;
char key = 0;
System.out.println(ANSI_PURPLE);
System.out.println("🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣");
System.out.println("🔣 🔣");
System.out.println("🔣 欢迎来到项目开发团队分配管理软件 🔣");
System.out.println("🔣 🔣");
System.out.println("🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣");
System.out.println("🐕");
System.out.println("🐕");
System.out.println("🐕");
System.out.println("🐕-----------<请您先进行登录>-------------🐕");
TSUtility.readReturn();
try {
loginVi.login();
} catch (InterruptedException e) {
e.printStackTrace();
}
do {
System.out.println(ANSI_RESET + ANSI_CYAN);
System.out.println("🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣");
System.out.println("🔣 🔣");
System.out.println("🔣 ~软件主菜单~ 🔣");
System.out.println("🔣 🔣");
System.out.println("🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣");
System.out.println("🐻1. <用户信息修改> *");
System.out.println("🐘2. <开发人员管理> *");
System.out.println("🦁3. <开发团队调度管理> *");
System.out.println("🐻4. <开发项目管理> *");
System.out.println("🦊5. <退出软件> *");
System.out.println("⬇请选择: ");
System.out.print(ANSI_RESET);
key = TSUtility.readMenuSelectionPro();
switch (key) {
case '1':
try {
loginVi.revise();
} catch (InterruptedException e) {
e.printStackTrace();
}
break;
case '2':
try {
nameListSer.showEmployee();
} catch (InterruptedException e) {
e.printStackTrace();
}
boolean loopFlagSec = true;
char keySec = 0;
do {
System.out.print(ANSI_RESET + ANSI_YELLOW);
System.out.println("🔣 ~开发人员管理主菜单~ 🔣");
System.out.println("🐕1. <开发人员的添加> *");
System.out.println("🐖2. <开发人员的查看> *");
System.out.println("🐱3. <开发人员的修改> *");
System.out.println("🐂4. <开发人员的删除> *");
System.out.println("🐇5. <退出当前菜单> *");
System.out.println("⬇请选择: ");
keySec=TSUtility.readMenuSelectionPro();
switch (keySec) {
case '1':
try {
nameListSer.addEmployee();
} catch (InterruptedException e) {
e.printStackTrace();
}
break;
case '2':
try {
nameListSer.showEmployee();
} catch (InterruptedException e) {
e.printStackTrace();
}
break;
case '3':
System.out.println("请输入需要修改的员工id:");
int i = TSUtility.readInt();
try {
nameListSer.modifyEmployee(i);
} catch (InterruptedException e) {
e.printStackTrace();
}
break;
case '4':
System.out.println("请输入需要删除的员工id:");
int j = TSUtility.readInt();
nameListSer.delEmployee(j);
break;
case '5':
System.out.print("确认是否退出(Y/N):");
char yn = TSUtility.readConfirmSelection();
if (yn == 'Y') {
loopFlagSec = false;
}
break;
default:
System.out.println("输入有误!请重新输入!");
break;
}
} while (loopFlagSec);
break;
case '3':
teamVi.developTeamMainMenu();
manyTeam=teamVi.TeamSvc.getAllTeam();
break;
case '4':
boolean loopFlagThr = true;
char keyThr = 0;
do {
System.out.print(ANSI_RESET + ANSI_GREEN);
System.out.println("🔣 ~开发项目管理主菜单~ 🔣");
System.out.println("🐕1. <项目的添加> *");
System.out.println("🐖2. <项目分配开发团队> *");
System.out.println("🐱3. <项目的查看> *");
System.out.println("🐂4. <项目的删除> *");
System.out.println("🐇5. <退出当前菜单> *");
System.out.println("⬇请选择: ");
System.out.print(ANSI_RESET + ANSI_YELLOW);
keyThr=TSUtility.readMenuSelectionPro();
switch (keyThr) {
case '1':
try {
projectSer.addProject();
} catch (InterruptedException e) {
e.printStackTrace();
}
break;
case '2':
for (Programmer[] pro : manyTeam) {
projectSer.dealingPro(pro);
}
break;
case '3':
try {
projectSer.showPro();
} catch (InterruptedException e) {
e.printStackTrace();
}
break;
case '4':
System.out.println("请输入需要删除的项目id:");
int j = TSUtility.readInt();
projectSer.delPro(j);
break;
case '5':
System.out.print("确认是否退出(Y/N):");
char yn = TSUtility.readConfirmSelection();
if (yn == 'Y') {
loopFlagThr = false;
}
break;
default:
System.out.println("输入有误!请重新输入!");
break;
}
} while (loopFlagThr);
break;
case '5':
System.out.print("确认是否退出(Y/N):");
char yn = TSUtility.readConfirmSelection();
if (yn == 'Y') {
loopFlag = false;
}
break;
default:
break;
}
} while (loopFlag);
}
public static void main(String[] args) {
new IndexView().menu();
}
}