项目开发团队分配管理软件总结
目錄
前言
?一、項目需求
二、主要思路
?三、系統流程
四、代碼實現
4.1 登錄
4.2?開發人員管理模塊
4.3開發團隊調度管理模塊
4.4開發項目管理模塊
4.5 IndexView類的設計
五、總結
前言
當我們在學習完了Java基礎和面向對象之后我們就可以開始著手寫一些比較簡單的項目了。當我們能夠自己獨立的寫完一個比較完整的小項目的時候,也表示我們前面學習的Java基礎和面對對象這些都學懂了,能夠進行靈活運用。主要目的就是熟悉Java面向對象的高級特性,進一步掌握編程技巧和調試技巧。
而我先選擇的就是項目開發團隊分配管理軟件這個小項目,這個項目需要的知識點比較全面的囊括了前面所學的基礎和面對對象的知識。
接下來就看一下我寫這個小項目的思路以及做法。
?一、項目需求
在我們拿到一個項目的時候也會拿到這個項目的相關需求,而項目開發團隊分配管理軟件的需求就是,用戶使用的時候能夠有登錄界面,有開發人員的管理,有項目的管理,和項目的分配。
二、主要思路
而這些需求被分成了四個部分,1.用戶注冊和登錄 2.開發人員管理 3.開發團隊調度 4.開發項目管理。在,每個部分下又進行了細分來實現我們需要的功能,比如用戶登錄中有用戶的注冊,用戶的登錄以及用戶的修改。
一個大體的流程和思路圖如下:
?三、系統流程
當我們把整個需求分析成了功能結構后我們就能基本上,畫出我們這個項目的流程圖,當有這個流程圖之后我們寫代碼的時候能夠更加的有思路,讓我們知道寫的相對應的代碼是用來干什么的。
具體流程圖如下:
四、代碼實現
當我們熟悉了我們要寫的整個流程過后就可以進行代碼的書寫了,我是從前往后一一實現功能來寫代碼的,當我把每一個部分的代碼都寫好調試好了之后再來進行最后的組裝整個項目。我是將整個代碼放在了同一個包之下,而在這個包下我又分了三個包來存放同一個類型的類。team.view ? ?模塊為主控模塊,負責菜單的顯示和處理用戶操作,.team.service ?模塊為實體對象(Employee及其子類如程序員等)的管理模塊, NameListService和TeamService類分別用各自的數組來管理公司員工和開發團隊成員對象,ProjectService是對項目的操作對象類,domain模塊為Employee及其子類等JavaBean類所在的包。
具體如下:
4.1 登錄
整個登錄界面我是放在一起的就是LoginView類:
public class TeamService {private static int counter = 1;//用來為開發團隊新增成員自動生成團隊中的唯一IDprivate final int MAX_MEMBER = 5;//表示開發團隊最大成員數private Programmer[] team = new Programmer[MAX_MEMBER];//用來保存當前團隊中的各成員對象private int total = 0;//記錄團隊成員的實際人數//返回當前團隊的所有對象public Programmer[] getTeam() {Programmer team[] = new Programmer[total];for (int i = 0; i < total; i++) {team[i] = this.team[i];}return team;}//初始化當前團隊成員數組public void clearTeam() {team = new Programmer[MAX_MEMBER];counter = 1;total = 0;this.team = team;}//判斷團隊是否有該成員private boolean isExist(Programmer p) {for (int i = 0; i < total; i++) {if (team[i].getId() == p.getId()) return true;}return false;}//向團隊中添加成員public void addMember(Employee e) throws TeamException {if (total >=MAX_MEMBER) {throw new TeamException("團隊成員已滿!!!");}if (!(e instanceof Programmer)) {throw new TeamException("該員工不是開發人員!!!");}Programmer p = (Programmer) e;if (isExist(p)) {throw new TeamException("該員工已是團隊成員!!!");}if (!p.isStatus()) {throw new TeamException("該員工已是某團隊成員");}int numOfArch = 0, numOfDsgn = 0, numOfPrg = 0;for (int i = 0; i < total; i++) {if (team[i] instanceof Architect) {numOfArch++;} else if (team[i] instanceof Designer) {numOfDsgn++;} else if (team[i] instanceof Programmer) {numOfPrg++;}}if (p instanceof Architect) {if (numOfArch >= 1) {throw new TeamException("團隊中至多只能有一名架構師");}} else if (p instanceof Designer) {if (numOfDsgn >= 2) {throw new TeamException("團隊中至多只能有兩名設計師");}} else if (p instanceof Programmer) {if (numOfPrg >= 3) {throw new TeamException("團隊中至多只能有三名程序員");}}//添加到數組p.setStatus(false);p.setMemberId(counter++);team[total++] = p;}//從團隊中刪除成員public void removeMember(int memberId) throws TeamException {int i = 0;for (; i < total; i++) {if (team[i].getMemberId() == memberId) {team[i].setStatus(true);break;}}if (i == total) {throw new TeamException("該團隊沒有該員工,刪除失敗!!!");}for (int j = i + 1; j < total; j++) {team[j - 1] = team[j];}team[--total] = null;} }4.2?開發人員管理模塊
而開發人員的管理是在domain包中完成各個類的實體類創建,在NameListService類中完成功能操作。
代碼如下:
普通員工類(其他類依次實現):
//Employee public class Employee {private int id;//員工碼private String name;//姓名private int age;//年紀private double salary;//薪水public Employee() {}public Employee(int id, String name, int age, double salary) {this.id = id;this.name = name;this.age = age;this.salary = salary;}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public double getSalary() {return salary;}public void setSalary(double salary) {this.salary = salary;}protected String getDetails() {return id + "\t" + name + "\t" + age+ "\t\t" +salary;}@Overridepublic String toString() {return getDetails();} }NameListService類:
public class NameListService {private ArrayList<Employee> employees = new ArrayList<>();//存人員信息private int count = 1;//記錄序號//初始化人員名單{employees.add(new Employee(count, "馬云 ", 22, 3000));employees.add(new Architect(++count, "馬化騰", 32, 18000, new NoteBook("聯想T4", 6000), 60000, 5000));employees.add(new Programmer(++count, "李彥宏", 23, 7000, new PC("戴爾", "NEC 17寸")));employees.add(new Programmer(++count, "劉強東", 24, 7300, new PC("戴爾", "三星 17寸")));employees.add(new Designer(++count, "雷軍 ", 50, 10000, new Printer("激光", "佳能2900"), 5000));employees.add(new Programmer(++count, "任志強", 30, 16800, new PC("華碩", "三星 17寸")));employees.add(new Designer(++count, "柳傳志", 45, 35500, new PC("華碩", "三星 17寸"), 8000));employees.add(new Architect(++count, "楊元慶", 35, 6500, new Printer("針式", "愛普生20k"), 15500, 1200));employees.add(new Designer(++count, "史玉柱", 27, 7800, new NoteBook("惠普m6", 5800), 1500));employees.add(new Programmer(++count, "丁磊 ", 26, 6600, new PC("戴爾", "NEC17寸")));employees.add(new Programmer(++count, "張朝陽 ", 35, 7100, new PC("華碩", "三星 17寸")));employees.add(new Designer(++count, "楊致遠", 38, 9600, new NoteBook("惠普m6", 5800), 3000));}public void view() {char keySec = 0;char yn = 0;do {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':addEmployee();break;case '2':getAllEmployees2();break;case '3':setEmployees();break;case '4':deleteEmployee();break;case '5':System.out.print("確認是否退出(Y/N):");yn = TSUtility.readConfirmSelection();}} while (yn != 'Y');}//得到所有員工public ArrayList<Employee> getAllEmployees() {return employees;}//遍歷所有員工public void getAllEmployees2() {System.out.println("ID" + "\t姓名" + " \t年齡" + "\t\t工資" + " \t職位" + " \t狀態" + "\t\t獎金" + "\t\t\t股票" + "\t\t設備");for (int i = 0; i < employees.size(); i++) {System.out.println(employees.get(i));}}//查詢指定員工public Employee getEmployee(int id) throws TeamException {if (id > count) {try {throw new TeamException("用戶不存在!!!");} catch (TeamException e) {System.out.println("用戶不存在!!!");return null;}}return employees.get(id - 1);}//增加員工public void addEmployee() {char b = 0;do {Scanner sc = new Scanner(System.in);System.out.println("-----------------增加界面-----------------");System.out.println(" 1 普通員工 ");System.out.println(" 2 程序員 ");System.out.println(" 3 設計師 ");System.out.println(" 4 架構師 ");System.out.println(" 5 退出 ");char a = TSUtility.readMenuSelectionPro();switch (a) {case '1':System.out.print("請輸入姓名:");String name = TSUtility.readKeyBoard(4);System.out.print("請輸入年齡:");int age = TSUtility.readInt();System.out.print("請輸入工資:");double salary = sc.nextDouble();employees.add(new Employee(++count, name, age, salary));System.out.println("添加成功!!!");break;case '2':System.out.print("請輸入姓名:");String name1 = TSUtility.readKeyBoard(4);System.out.print("請輸入年齡:");int age1 = TSUtility.readInt();System.out.print("請輸入工資:");double salary1 = sc.nextInt();System.out.print("請輸入臺式電腦型號:");String model = sc.next();System.out.print("請輸入臺式電腦顯示器名稱:");String display = sc.next();employees.add(new Programmer(++count, name1, age1, salary1, new PC(model, display)));System.out.println("添加成功!!!");break;case '3':System.out.print("請輸入姓名:");String name2 = TSUtility.readKeyBoard(4);System.out.print("請輸入年齡:");int age2 = TSUtility.readInt();System.out.print("請輸入工資:");double salary2 = sc.nextDouble();System.out.print("請輸入獎金:");double bonus = sc.nextDouble();System.out.print("請輸入打印機名字:");String dyjmz = sc.next();System.out.print("請輸入打印機類型:");String type = sc.next();employees.add(new Designer(++count, name2, age2, salary2, new Printer(dyjmz, type), bonus));System.out.println("添加成功!!!");break;case '4':System.out.print("請輸入名字:");String name3 = TSUtility.readKeyBoard(4);System.out.print("請輸入年齡:");int age3 = TSUtility.readInt();System.out.print("請輸入工資:");double salary3 = sc.nextDouble();System.out.print("請輸入獎金:");double bonus1 = sc.nextDouble();System.out.print("請輸入股票:");int stock = sc.nextInt();System.out.print("請輸入筆記本電腦型號:");String model2 = sc.next();System.out.print("請輸入筆記本電腦價格:");double price = sc.nextDouble();employees.add(new Architect(++count, name3, age3, salary3, new NoteBook(model2, price), bonus1, stock));System.out.println("添加成功!!!");break;case '5':System.out.println("是否確認退出(輸入Y/N):");b = TSUtility.readConfirmSelection();}} while (b != 'Y');}//刪除員工public void deleteEmployee() {Scanner sc = new Scanner(System.in);System.out.print("請輸入需要刪除的ID:");int a = sc.nextInt();if (a > count) {try {throw new TeamException("用戶不存在!!!");} catch (TeamException e) {System.out.println("用戶不存在!!!");}return;}if (a <= 0) {try {throw new TeamException("輸入有誤!!!");} catch (TeamException e) {System.out.println("輸入有誤!!!");}return;}employees.remove(a - 1);for (int i = a - 1; i < employees.size(); i++) {employees.get(i).setId(employees.get(i).getId() - 1);}System.out.println("刪除成功!!!");}//修改員工信息(只能修改名字、年齡、工資)public void setEmployees() {Scanner sc = new Scanner(System.in);System.out.print("請輸入需要修改的ID:");int a = sc.nextInt();if (a > count) {try {throw new TeamException("用戶不存在!!!");} catch (TeamException e) {System.out.println("用戶不存在!!!");}return;}Employee b = employees.get(a - 1);System.out.print("請輸入新的姓名(" + employees.get(a - 1).getName() + "):");String naem = TSUtility.readString(4, b.getName());System.out.print("請輸入新的年齡(" + b.getAge() + "):");int age = Integer.parseInt(TSUtility.readString(2, b.getAge() + ""));System.out.print("請輸入新的工資(" + b.getSalary() + "):");double salary = Double.parseDouble(TSUtility.readString(10, b.getSalary() + ""));b.setName(naem);b.setAge(age);b.setSalary(salary);employees.set(a - 1, b);System.out.println("修改成功!!!");} }4.3開發團隊調度管理模塊
這個模塊分成了兩個類分別是TeamService類和TeamView類,是進行團隊成員的管理:添加、刪除等。
public class TeamView {private NameListService listSvc = new NameListService();private TeamService teamSvc = new TeamService();private ArrayList<Programmer[]> team = new ArrayList<>();//團隊調度主界面public void enterMainMenu(ArrayList<Employee> employees) {char b = 0;char a = 0;do {if (a != '1') {listAllEmployees(employees);}System.out.print("1-團隊列表 2-添加團隊成員 3-刪除團隊成員 4-退出 請選擇(1-4):");a = TSUtility.readMenuSelection();switch (a) {case '1':getTeam();break;case '2':addMember();break;case '3':deleteMember();break;case '4':System.out.println("是否確認退出(輸入Y/N):");b = TSUtility.readConfirmSelection();if (b == 'Y') {team.add(teamSvc.getTeam());}teamSvc.clearTeam();}} while (b != 'Y');}//以表格形式列出公司所有成員public void listAllEmployees(ArrayList<Employee> employees) {System.out.println("-----------------------------------------開發團隊調度軟件---------------------------------------");ArrayList<Employee> emps = employees;if (emps.size() == 0) {System.out.println("沒有客戶記錄!");} else {System.out.println("ID\t姓名\t 年齡\t 工資\t 職位\t 狀態\t 獎金\t\t 股票\t 領用設備");}for (int i = 0; i < emps.size(); i++) {System.out.println(" " + emps.get(i));}System.out.println("---------------------------------------------------------------------------------------------");}//顯示團隊成員列表操作public void getTeam() {System.out.println("\n--------------------團隊成員列表---------------------\n");Programmer tame[] = teamSvc.getTeam();if (tame.length == 0) {System.out.println("開發團隊目前沒有成員!");} else {System.out.println("TID/ID\t姓名\t\t年齡\t 工資\t 職位\t 獎金\t 股票");}for (int i = 0; i < tame.length; i++) {System.out.println(" " + tame[i].getDetailsForTeam());}}//實現添加成員操作public void addMember() {System.out.println("---------------------添加成員---------------------");System.out.print("請輸入要添加的員工ID:");int id = TSUtility.readInt();try {Employee e = listSvc.getEmployee(id);teamSvc.addMember(e);System.out.println("添加成功");} catch (TeamException e) {System.out.println("添加失敗,原因:" + e.getMessage());}// 按回車鍵繼續...TSUtility.readReturn();}//實現刪除成員操作public void deleteMember() {System.out.println("---------------------刪除成員---------------------");System.out.print("請輸入要刪除員工的TID:");int id = TSUtility.readInt();System.out.print("確認是否刪除(Y/N):");char yn = TSUtility.readConfirmSelection();if (yn == 'N')return;try {teamSvc.removeMember(id);System.out.println("刪除成功");} catch (TeamException e) {System.out.println("刪除失敗,原因:" + e.getMessage());}// 按回車鍵繼續...TSUtility.readReturn();}//增加更多團隊public ArrayList<Programmer[]> getManyTeam(ArrayList<Employee> employees) {char a = 0;char b = 0;do {System.out.println("----------------團隊調度界面---------------");System.out.println(" 1-添加團隊 ");System.out.println(" 2-查看團隊 ");System.out.println(" 3-刪除團隊 ");System.out.println(" 4-退出 ");System.out.println("?請選擇: ");a = TSUtility.readMenuSelection();switch (a) {case '1':enterMainMenu(employees);break;case '2':System.out.println("---------------團隊列表--------------");for (Programmer[] team : team) {for (int i = 0; i < team.length; i++) {System.out.println(team[i]);}System.out.println("------------------");}break;case '3':System.out.print("請輸入要刪除第幾個團隊(從上往下數是第幾個就是幾號團隊):");int num = TSUtility.readInt();if (num <= team.size()) {System.out.print("確認是否刪除(Y/N):");char de = TSUtility.readConfirmSelection();if (de == 'Y') {team.remove(num - 1);} else {System.out.println("請考慮清楚!");}} else {System.out.println("沒有該團隊,請正常輸入!" + "目前團隊只有" + team.size() + "個");}break;case '4':System.out.println("是否確認退出(輸入Y/N):");b = TSUtility.readConfirmSelection();if (b == 'Y') {return team;}}} while (b != 'Y');return team;}public ArrayList<Programmer[]> tame() {return team;} } public class TeamService {private static int counter = 1;//用來為開發團隊新增成員自動生成團隊中的唯一IDprivate final int MAX_MEMBER = 5;//表示開發團隊最大成員數private Programmer[] team = new Programmer[MAX_MEMBER];//用來保存當前團隊中的各成員對象private int total = 0;//記錄團隊成員的實際人數//返回當前團隊的所有對象public Programmer[] getTeam() {Programmer team[] = new Programmer[total];for (int i = 0; i < total; i++) {team[i] = this.team[i];}return team;}//初始化當前團隊成員數組public void clearTeam() {team = new Programmer[MAX_MEMBER];counter = 1;total = 0;this.team = team;}//判斷團隊是否有該成員private boolean isExist(Programmer p) {for (int i = 0; i < total; i++) {if (team[i].getId() == p.getId()) return true;}return false;}//向團隊中添加成員public void addMember(Employee e) throws TeamException {if (total >= MAX_MEMBER) {throw new TeamException("團隊成員已滿!!!");}if (!(e instanceof Programmer)) {throw new TeamException("該員工不是開發人員!!!");}Programmer p = (Programmer) e;if (isExist(p)) {throw new TeamException("該員工已是團隊成員!!!");}if (!p.isStatus()) {throw new TeamException("該員工已是某團隊成員");}int numOfArch = 0, numOfDsgn = 0, numOfPrg = 0;for (int i = 0; i < total; i++) {if (team[i] instanceof Architect) {numOfArch++;} else if (team[i] instanceof Designer) {numOfDsgn++;} else if (team[i] instanceof Programmer) {numOfPrg++;}}if (p instanceof Architect) {if (numOfArch >= 1) {throw new TeamException("團隊中至多只能有一名架構師");}} else if (p instanceof Designer) {if (numOfDsgn >= 2) {throw new TeamException("團隊中至多只能有兩名設計師");}} else if (p instanceof Programmer) {if (numOfPrg >= 3) {throw new TeamException("團隊中至多只能有三名程序員");}}//添加到數組p.setStatus(false);p.setMemberId(counter++);team[total++] = p;}//從團隊中刪除成員public void removeMember(int memberId) throws TeamException {int i = 0;for (; i < total; i++) {if (team[i].getMemberId() == memberId) {team[i].setStatus(true);break;}}if (i == total) {throw new TeamException("該團隊沒有該員工,刪除失敗!!!");}for (int j = i + 1; j < total; j++) {team[j - 1] = team[j];}team[--total] = null;} }4.4開發項目管理模塊
而這個模塊就是在domain包中完成項目實體類Project的創建,在service包中完成項目操作類ProjectService的創建
public class Project {private int proId;//項目號private String projectName;//項目名稱private String desName;//項目描述private Programmer[] team;//開發團隊private String teamName;//開發團隊名稱private boolean status = false;//開發狀態 true為開發中,false為未開發中public Project() {}public Project(int proId, String projectName, String desName, Programmer[] team, String teamName, boolean status) {this.proId = proId;this.projectName = projectName;this.desName = desName;this.team = team;this.teamName = teamName;this.status = status;}public int getProId() {return proId;}public void setProId(int proId) {this.proId = proId;}public String getProjectName() {return projectName;}public void setProjectName(String projectName) {this.projectName = projectName;}public String getDesName() {return desName;}public void setDesName(String desName) {this.desName = desName;}public Programmer[] getTeam() {return team;}public void setTeam(Programmer[] team) {this.team = team;}public String getTeamName() {return teamName;}public void setTeamName(String teamName) {this.teamName = teamName;}public boolean isStatus() {return status;}public void setStatus(boolean status) {this.status = status;}public String des() {return "項目{" +"項目號='" + proId + '\'' +"項目名='" + projectName + '\'' +", 項目描述='" + desName + '\'' +", 開發團隊名稱='" + teamName + '\'' +", 開發狀態=" + status +'}' + "\n";}@Overridepublic String toString() {des();if (status) {return "項目【" + projectName + "】" + "---->正在被團隊【" + teamName + "】開發中!";} else {return des() + "項目【" + projectName + "】---->" + "未被開發!";}} } public class ProjectService {private ArrayList<Project> pro = new ArrayList<>();//用來存項目的集合private int count = 1;//添加項目的標號public void ProjectManage(ArrayList<Programmer[]> manyTeam) throws InterruptedException, TeamException {Scanner sc = new Scanner(System.in);char a = 0;char b = 0;do {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("?請選擇: ");a = TSUtility.readMenuSelectionPro();switch (a) {case '1':addProject();break;case '2':if (manyTeam == null) {System.out.println("沒有團隊,請先添加團隊!!!");break;}for (Programmer[] pro : manyTeam) {dealingPro(pro);}break;case '3':showPro();break;case '4':System.out.println("是否確認刪除團隊(輸入Y/N):");char c = TSUtility.readConfirmSelection();if (c == 'Y') {System.out.println("選擇你要刪除的團隊ID:");int d = TSUtility.readInt();delPro(d);break;} else break;case '5':System.out.println("是否確認退出(輸入Y/N):");b = TSUtility.readConfirmSelection();}} while (b != 'Y');}//新項目添加public void addProject() throws InterruptedException {System.out.println("項目參考:--------------------------------------------------");System.out.println("1.小米官網:開發完成類似于小米官網的web項目.");System.out.println("2.公益在線商城:貓寧Morning公益商城是中國公益性在線電子商城.");System.out.println("3.博客系統:Java博客系統,讓每一個有故事的人更好的表達想法!");System.out.println("4.在線協作文檔編輯系統:一個很常用的功能,適合小組內的文檔編輯。");System.out.println("------------------------------------------------------------");TSUtility.readReturn();System.out.println("請輸入需要添加的項目:");char a = TSUtility.readMenuSelection();switch (a) {case '1':Project p1 = new Project();p1.setProId(count++);p1.setProjectName("小米官網");p1.setDesName("開發完成類似于小米官網的web項目。");pro.add(p1);TSUtility.loadSpecialEffects();System.out.println("已添加項目:" + p1.getProjectName());break;case '2':Project p2 = new Project();p2.setProId(count++);p2.setProjectName("公益在線商城");p2.setDesName("貓寧Morning公益商城是中國公益性在線電子商城。");pro.add(p2);TSUtility.loadSpecialEffects();System.out.println("已添加項目:" + p2.getProjectName());break;case '3':Project p3 = new Project();p3.setProId(count++);p3.setProjectName("博客系統");p3.setDesName("Java博客系統,讓每一個有故事的人更好的表達想法!");pro.add(p3);TSUtility.loadSpecialEffects();System.out.println("已添加項目:" + p3.getProjectName());break;case '4':Project p4 = new Project();p4.setProId(count++);p4.setProjectName("在線協作文檔編輯系統");p4.setDesName("一個很常用的功能,適合小組內的文檔編輯。");pro.add(p4);TSUtility.loadSpecialEffects();System.out.println("已添加項目:" + p4.getProjectName());break;default:System.out.println("沒有該項目!!!");break;}}//項目分配團隊開發public void dealingPro(Programmer[] team) {if (pro == null) {System.out.println("沒有項目,請先添加項目!!!");return;}System.out.println("當前團隊有人員:");for (int i = 0; i < team.length; i++) {System.out.println(team[i]);}System.out.println("請為當前團隊創建一個團隊名稱:");String teamName = TSUtility.readKeyBoard(6, false);Random ra = new Random();int ranNum = ra.nextInt(pro.size());Project project = this.pro.get(ranNum);project.setTeamName(teamName);project.setTeam(team);project.setStatus(true);pro.set(ranNum, project);}//查看項目當前狀態public void showPro() throws InterruptedException {TSUtility.loadSpecialEffects();if (pro.size() == 0) {System.out.println("當前沒有項目,請添加項目!!!");}for (int i = 0; i < pro.size(); i++) {System.out.println(pro.get(i));}}//刪除選擇的項目public void delPro(int id) throws TeamException {boolean a = false;for (int i = 0; i < pro.size(); i++) {if (i == (id - 1)) {pro.remove(i);for (i = id; i <= pro.size(); i++) {pro.get(i - 1).setProId(pro.get(i - 1).getProId() - 1);}a = true;}}if (a) {System.out.println("刪除成功!!!");} else {try {throw new TeamException("該團隊不存在!!!");} catch (TeamException e) {System.out.println("該團隊不存在!!!");}}}//得到所有項目數據集合public ArrayList<Project> getAllPro() {return pro;} }4.5 IndexView類的設計
當我們把每一個模塊的東西都實現好了以后就需要進行模塊的組裝,而我又是把每個模塊的界面就寫在了對應的模塊調度類里面了所以最后只需要在IndexView類中寫一個總的界面然后再將每個模塊調度起來就行了。
具體如下:
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;private ArrayList<Employee> employees = new ArrayList<>();public void menu() throws TeamException, InterruptedException {char key = 0;char a = 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 {System.out.println(ANSI_BLUE);loginVi.view();} catch (InterruptedException e) {e.printStackTrace();}do {System.out.println(ANSI_RESET + ANSI_CYAN);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':System.out.println(ANSI_GREEN + ANSI_YELLOW);loginVi.revise();break;case '2':System.out.println(ANSI_CYAN + ANSI_RESET);nameListSer.view();employees = nameListSer.getAllEmployees();break;case '3':System.out.println(ANSI_RESET + ANSI_CYAN);teamVi.getManyTeam(employees);manyTeam = teamVi.tame();break;case '4':System.out.println(ANSI_RESET);projectSer.ProjectManage(manyTeam);break;case '5':System.out.println(ANSI_CYAN);System.out.println("是否確認退出(輸入Y/N):");a = TSUtility.readConfirmSelection();}} while (a != 'Y');}public ArrayList<Programmer[]> getManyTeam() {return manyTeam;}public static void main(String[] args) throws TeamException, InterruptedException {IndexView indexView = new IndexView();indexView.menu();} }五、總結
在我寫這個項目的過程中遇到了許許多多的問題,比如人員為什么存不進去,為什么分配給了團隊相關的成員之后再查看團隊的時候卻一個都沒有等等。這些問題在一次次的嘗試中都得到了解決,而我們在寫項目的時候不要把整個項目都寫完了再來調試,如果寫完了整個項目再進行調試的話就可能面臨著從每一個類進行修改,而我覺得我們可以每一個模塊的來進行調試,專門建立一個測試的包來裝測試的類,當我們將每一個模塊寫完都調試完了之后再來組裝就會調試的比較輕松不用去修改每一個類。
所有代碼在網盤:
鏈接:https://pan.baidu.com/s/1RiWxfHllU0nM-CY9F9xmVA?
提取碼:1234
以上就是我寫的第一個獨立的項目的所有過程,如有錯誤歡迎指正。
總結
以上是生活随笔為你收集整理的项目开发团队分配管理软件总结的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jquery 调用 click 事件 的
- 下一篇: 如何给孩子的作文下评语