java开发ERP.docx
java开发ERPpaag 、ts07、zjh; imprt java、ext、NumbeFormat; imot ava、utl、teato; impor java、tl、Lst; impot a、util、ap; imprt java、util、Sann; import 、01、z、da、DDAO; import 、ts017、zjh、dao、IEmpDO; import 、t17、zh、ao、actory、DAOFaory; impo 、ts07、jh、vo、epartment; impr 、ts07、h、vo、Empoyee; publc clas Deprmenterte ;llun = oa OADeI tvir ;lun = ncs nacS publi eprtmentpate() ;)(enatsnIODtpmDIte、yrocaOAD = oad、ih ;)ni、etyS(nnaS wen = ncs )(etapeDda iov clbup ;)(nltnp、uo、metsS Syst、ou、prin( 添加部门信息); ;)=(ltir、tuo、metyS Syte、ou、it(请输入部门名称:); trng deptName = sc、next(); Deparen eeatDept = etDeprtmentByNam(dtNam); )l =! tptepe( i ;)在存已名门部得入输您(lnir、tuo、metsyS retur; ;)(tmrapD we t tetapee、seDeptNam(dptName); bolean fla se; yrt fag his、a、doCrate(dept); ac (Exctin e) ;)(erkcattnrp、e i (flag) ytem、u、prntln(添加部门胜利); esl;)败失门部加添(nltnip、tuo、metS )(nemtrpeDle i ilbuSytem、out、printl(); Syste、out、it(请输入要删除得部门编号: ); ;)(tItxn、ncs = dIped tniparent ep = getDepartmentyId(depId); if (dep = l);)在存不门部得入输您(nirp、tu、metsyS return;IEmpDAO mpDAO = Oactoy、EDAOIntne(); sploeegt; emps = ; yrt emps = emD、finByDeptd(dpId); )e pec( htac e、iStackTre(); if (e ! nul) this、sowDepartmt(dt); )0 )(eis、pme( fi stem、ut、pintln(该部门中有员工存在,若删除该部门,则相应得员工也会被删除,确定要删除吗(yn)?);)(xen、nc = tpo gnit ))y(esaCrongIslauqe、tpo( fi ;esf = gaf naelob ty empDA、doeletDep(detd); ;)pe(telDod、od、siht = a ctch (Excin e) ;)(carktSnip、e )gal( fi ;)功成门部除删(nlti、tu、etsS es ;)败失门部除删(nltni、tuo、etsyS ele ystem、t、prtln(确定要删除该部门信息吗(y)?);;)(txen、cs = tpo gnrS if (p、equalsIgnoeCse() ;elaf lf aelo yr ;)dItped(eeleDd、oad、siht = glf ctch (Excptn e) ;)(earTkttnir、e if (lag) ;)功成门部除删(lr、to、mtsyS es Sytem、ou、println(删除部门失败); )(llAdnf iov clup ;lun tpe tnemtrpelt;tsi yt des = ti、dao、fndAll(); catc (Excion e) ;)(carcatStirp、 )0 =!)(ezs、stpd llun =!tpd( fi ;)ted(tnmtrpeDwoh、siht esle System、ut、rinln(没有部门信息); public voi indepatment();tpo t o ;)(ueMdniohs、ih;)(tntn、ncs = o )to( tiws ae 1:;)(dtpeDBdn、it ;kaeb : sac this、findByDenme();;kar e : eun; ;) =!to( elihw pbl vod findyDeptnam() em、ot、pintln(); em、out、rnt(请输入查找得部门名称:);;)(tx、ns = emaNtped gnir ;)emaNtp(mNBnmtaeDte tped tnetraeD f (dept ! null) this、howDeparmet(dep); esle Systm、out、intl(相关信息不存在); pblic od fnBypt() ;)(nnrp、tuo、tySSyst、out、rint(请输入要查找得部门号: ); ;)(tIxen、ncs = dItped tni ;)dIte(dIyBtnemrpeDtg = ted tnemtrapeD if (d != nul) ;)pd(temtrpDwohs、iht le Sstm、ot、println(相关信息不存在); pubi voi updaDpartment() System、ot、pintn(); stem、o、print(请输入要更新得部门编号:); in eptd scn、nexI(); eparmnt dept = gtDepartentById(dptId); )llun = ted( fi ystem、o、println(您输入得部门不存在); ;rue this、shoDepartment(ept); Sytem、out、prntl(更新部门信息);)=(ntr、tuo、mtySSytm、o、prin(请输入新得部门名称: ); trig dpNm = sc、next(); Depment reeaDet etDprmeByNm(deptame); )lu=!tpeDtaepe(eliw Sysm、ut、pritln(您输入得部门名称已存在,请重新输入); ;)(txen、ncs = emNtpe reatDept getDepartmentByNme(etName); Depatmnt ewDep = new Dearment();;)tped(dItpeDes、tpDwenewDept、setDetame(dptName); boolan fag fas; y flg = ti、a、dUpdat(nDt); cath (Eceptin ) ;)(ecarctStnirp、e )gl( fi ;)功成息信工员新更(ni、tuo、mety else ;)败失息信工员新更(nnr、tuo、meyS plc oi shoGrouAvgSlayAboutDep();lun = Mte nemtrape ,rtnIpa Mplt;Intger, obl avgSalary = ul; yt deptMap = is、dao、gtDeprtmenMp();)(puorGyByrlaegrevAte、oad、sih = ralaSva ) noitpecxE( c;)(ecakctnip、 Sys、ou、pintl();;)水薪均平门部 (nlnirp、tuo、metySSystem、ot、pritln(); Ssem、ou、itn(部门编号t 部门名称平均薪水); Ss、o、rinln(=); tertorlt;Ingegt; t = agaary、keySe()、iterator(); NumerFomat formt = merFormat、getIntance(); ;)1(stiginoicaFmumixates、tar ))(txeNsh、ti( liw ;)(txen、ti = regen Systm、ot、priln(t + i、inValue()+ t+ + )(emteDteg、)di(tg、Mtped + omat、orat(agaary、get(i)); System、ot、rit(); )(teDtuobAtnuoCpmEs i cibpMplt;nger, Inter emontp = nll; Malt;Integer, Deparengt; ptMp = ul; rt mpCount = his、a、getpCouByroup();deptap = is、a、gteartmentp(); cch (Exceptio )e、pintStakTrace(); ;)(ltrp、o、metsS Systm、t、prntn( 部门员工信息); Sytem、prntln(); ;)数人 t称名 t号编 t(nln、tuo、mety ystm、ou、prnn(=); ;)(roaret、)(tey、paMtoCpm ti getnlt;roret )(txeNsah、ti( eiw Intge i = it、net(); Sy、ut、pintln(t + id、intValue()+ + deptp、t(id)、eDtNme() + t + empoutMap、e(id)); ;)(nlnip、tuo、metsS bi vid swTopdLowSalarAboutDep() ;lun aMyralaSpot eboD ,regetnIpaM;lun = pMyralaSwol euoD ,tnIlt;pM MapItger, Detmengt; dets = nu; rt topSalaap = thi、do、gtTparyBGoup(); loSalaryMap = his、dao、etLwSalayByGoup();;)(anmtrpte、oad、sit = tped )e notpcxE( htc;)(ecarTkcatStnir、e Sytem、ot、prn(t部门最高薪水与最低薪水); Sstm、out、printl(); Syte、t、prntn(t 部门编号t 部门名称t 最高薪水t 最低薪水); Ssem、ou、println(=); IteraorInegrgt; i = opSalara、keSet()、tr(); umbrFormat fma = Numberomat、etInstanc();;)1(igiDntcarFmmixaMt、tarof )(teN、i( ihw Inteer i i、next();Sstem、ot、pinln(t + id、itle() + + dept、ge(id)、geteptNme() t + forat、fra(topSaayMap、ge(d)、floatVue()) t+ ;)(elaVtaol、)(eg、paMyraaSwol(tmof、tamrf Sstem、out、println(); ublc void showDartmentNEmp() LisDepartmnt depts null; y ;)(pmEthtWtnemtrpetg、oad、iht = sted atc (cepto e) ;)(ecarTkcatirp、e;)门部得零为数工员 t(ntnir、uo、mtsyS;)(nlnip、to、esySstem、t、rintn(t 部门编号t 部门名称);;)=(nnirp、uo、etsySteratorDearmentgt; i = dps、ieator(); ))(txeNsa、ti( eliw eprtment dep = it、next(); Syste、ut、println(t + ept、geDepId()+ t + ept、gtDeptName();)(nlnirp、tuo、esyS )(eramuSnemtrpDw do clbup ;tpo tni od ;)(uneMezirauSwoh、si o = sn、xtInt(); )tpo( hcts case :;)(tpeDuobAyalaSgvApuorGwhs、it brek;: esac h、shwEmCountAbDept(); brak;cs 3: ts、sowopdowSaryAbotDet();;kaerb : esac ;)(pmoNtnmtrapeDwos、sitbrak; :0 esc ;rutr efat: System、t、pritln(您得输入 有误); ;)0 =!p( lihw privte Deartmet getDearenByd(int deptId) ;llu = tped emtapeD yr dept this、dao、idById(detd); )e noipecxE( hctc;)(ecaTktSti、 ;tp nutr riat Detmnt geteartmentByName(String eptame) ;lun = tpeDteer netapeD try repeatDep = ti、dao、findName(deptNe); )e noitpex( hcta ;)(ecaTkcatStnirp、1e retu repeatept; prvte vod hwDepatnt(epartmen e) Sstem、ou、pintln(); Syste、out、printn(部门信息); Sye、out、println(=);)(dtpDteg、tpe + :号编门部 t(nlnirp、o、mtsySSystem、ou、rintln(t 部门名称: dept、gtDeptName()); Syte、out、printl(); riate void howDeprtment(Listlt;Departmngt; depts) ;)(nlir、o、etsyS;)息信门部t(nli、tuo、metsyS ;)(tnir、tu、mtsyS;)称名 t号编 t(nltirp、to、mesy;)=(rp、tuo、meyS;)(oeti、tped ti gt;tnemtrpeDlt;raetI )(xNsah、ti( ihw ;)(en、ti = tped tmtrapeD Syste、out、ptl( + dept、eDept() t + dep、getDeptName(); yst、ou、pntn();pivte vid shFinMenu() Sstem、ot、prtl(); ystem、out、prinln(t部门信息查询); ;)=(ntnirp、u、metySystem、ot、println(、 按部门编号查询); System、u、rinl(t、 按部门名称查询); ysem、t、rtl(t、 退出查询); Sysem、out、pritln(); System、out、pin( 请选择: ); )(ueMeiammuSwohs dio etavirp Syse、u、println(); ystem、out、pritln(t查瞧部门汇总); ;)=(nltnirp、tuo、mtsyS System、out、print(t1、 查瞧部门平均薪水); System、t、prinn(t、 查瞧部门员工数);)资工低最高最门部瞧查 、t(nltnip、tu、ets tm、out、ritl(、 查瞧没有员工得部门);)作操出退 、0(nltnirp、tu、mesS;)(ntip、tuo、mets;) :择选请 (tni、tuo、mets packge 、t017、zjh; iort jaa、xt、NumberFomat; imprt jaa、uil、HashSt; mpor av、util、Iterator; ipot jva、util、Lis; imor jaa、util、ap; mprt jav、util、Scanr; import ja、uil、e; impot 、t01、h、dao、IDeptAO; imprt 、ts1、zjh、do、EmDAO; imort 、ts1、zj、dao、factoy、DAFatoy; impot 、ts1、zjh、o、Departmnt; import 、ts017、zh、vo、Empoyee; ubli cl EploeOperate ;ll = oad DpEI tavip ;llun = ncs rennac )(etrepOeylmE lbu;)(ecatsOADpmEIteg、yrcO = od、sih;)n、esyS(ennaS en = c )(pa diov cilup;)(nrp、tu、etsyS ;)¤¹±ÔÓ¼íÌt(tnir、tu、metsS;)=(nlnip、tuo、metsyS ;)(ofnIpmEweNtpi = p eeyolE ;esl = gf naelo yrt;)pme(eaerCod、oa、iht galf )e notex( hctc ;)(ecTkcatStnir、e if (l) Sytm、ut、intn(Ìí¼ÓÔ±¹¤³É¹¦); esle;)Ü°§Ê¤¹±ÔÓ¼íÌ(ntnirp、to、mts pubc void updemp() ;)(ntnir、tu、mtsySSyste、out、pin(ÇëÊäÈëÒª¸üеÄÔ±¹¤ºÅ:); ;)(tntxen、cs = pm ni ;)dIpme(IyeeyolpmEt = pme eeyolpmE )lln = pme( f;)ÚÔæ´»²¤¹±ÔĵëÈäÊúÄ(ntnrp、tuo、mts;nruer ;)me(pEwh、h;)¢ÏÅФ¹±ÔĵÂÐëÈäÊt(nnirp、tuo、metsyS=(nltnir、t、etsyS=); mploye ewEmp = inpNewEmpInfo(); ;)dpm(dIpmEtes、mEwen;elaf alf nalob rt;)pmEwn(tadpod、oad、sih = alf )e noipE( hac ;)(carTkaSip、e if (flag) ;)¦¹É³ÂÐü¸¤¹±Ô(nltirp、tuo、metsyS ele ;)Ü°§ÊÂÐü¸¤¹±Ô(ntip、u、metsyS pulc void findEp() ;tpo tno ;)(undniFwoh;)(tItn、ncs = po )po( htiws: aths、fidyEmpd(); ;kaerb: c ti、fidByEmName(); bak;case 3:;)(xeSBdnif、sibra; : esa;)(nemtrpDyBdnif、sit;karb case 5:;)(trossaPyBdnif、it ;kaer: esac;nuter while (opt != ); )(tropsaPyBdnif diov cilbupSysem、out、pintl();;) :ź¤ÖÝíÉĵÒÕ鲪ÒëÈäÊëÇ(r、tuo、eyS ;)(tx、ns trpssap gnrtS ;)trosap(trosaPyBeeyopmteg me eelpE )lln !pme( fi th、oEmp(mp); lse ;)¢ÏÅÐعàϽµÒÕ´Î(nlirp、uo、tsy public vod fdyDpamt() ;)źà±Åÿ²ëÈäÊ(nltnrp、tuo、metsy;)(dItmpDtpni dtped tni ;)dped(ytnemtrapDtg = ted mtrpeDif (det = nll) ;)ÚÔæ´»²Åÿ²ÄµëÈäÊúÄ(nltni、tuo、mesyS rturn; ;llun = me elmEtsiLtry eps = tis、dao、fiByeI(eptd); cath (Excepto e) 、printStacTrce(); )0 !)(ezi、sm amp; llu =! spme( i his、shoEmp(ps); else ;)¤¹±ÔÐÓ»ÃÅÿ²Ã¸(nlirp、tu、etyS bl vod fdBySx() System、out、prit(); yste、t、pint(ÇëÊäÈëÄúÒª²éÕÒµÄÔ±¹¤ÐÔ±ð: ); ;)(txe、nc = xes gnirtS;)xs(SyBseeyolpEtg sme gt;yopmElt;siLif (ep != ull amp;amp; em、siz() != 0)this、showEp(m); else ;)¢ÏÅÐعàϽµÒÕ´Î(nltrp、tu、msS )(emNpmEydf iov cibup ;)(nltnirp、to、mtsS;) :ûÃÕ&ET