教育版oa--源代码说明_第1页
教育版oa--源代码说明_第2页
教育版oa--源代码说明_第3页
教育版oa--源代码说明_第4页
教育版oa--源代码说明_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、东莞理工学院城市学院city college of dgut教育版oa系统设计与实现源代码说明书versionl0hmay2015版本及修订记录版本日期描述作者1.02015-05-02第一个版本李尚隆文档信息文档号:a0002发行:v授权:东莞理工学院城市学院创建日期:2015-05-11目录1引言311编写目的32程序目录结构33关键代码33.1登录33.2家庭作业53.3学生考勤83.4班级文章93.5班级相片113.6实践活动123.7学生提问143.8成绩查询163.9学生奖惩173.10课程表183.11任课老师193.12班级学生193.13班级班委203.14投票调查211引言

2、1.1编写目的编写此文档的目的在于为以后的修改提供依据。2程序目录结构1) .pzxx<scampus.space<action业务逻辑代码2) .pzxx.scampus.space.dao数据库操作代码3) .pzxx.scampus.space.entity数据实体类彳弋不马4) .pzxx.scampus.space>service数据丿报务类代码3关键代码3.1登录在登录界而输入的账号(username) 密码(password) o通过验证的账号, 将向服务器请求数据,进行加载数据。loginaction.java

3、x1 package .pzxx.scampussysaction;23+ import java.util.hashmap;n2829- /*30 * 登录action31 * author deanzhou32 * version33 *1.0 201412月22日下午 10: 57:4334 */35 parentpackage(mmydefaultu)36 scope("'prototype")37 act ion (value = "loginaction'1)38 ©results(value = result(n

4、ame = nloginjson", type = 11 jsonresult11)39 public class loginaction extends baseaction 4041autowired42 private userserviceuserservice;4343 tautowired44 private menuservicemenuservice;4645 privatestringusername;4846 privatestringpassword;5051|/*|52 *登录53 * return54 */public dsonresult login()

5、dsonresult jsonresul七 = new dsonresult();map<string? object> result = new hashmap<string object>(); result.put(hstatus","error11);result, put ("msg-1,"用户名或蔭玛错误);string usertype =string mdspasswrod = md5utils.encryption(password);if (str ingut i is. equals (const ants

6、.sl/pfr4dwia/, username) /超级管理员(stringutils.equals(constants.superadmin_passmord, mdspasswrod) usertype = usertype.super_admin;result.put(mstatusm, "success11);thisgetsession().setattribute(constants.loginuser, new user(); this gmtsession()setattribute(constants.usertype, usertype);dse 老师teache

7、r teacher = this.userservice.findteacher(username); if(teacher != null) if (stringutils. equats(teacher getpassworck ), md5passwrod) ) usertype = usertype.teacher;result.put(11 status", ""success11);thisgetsession()setattribute(constants.loginuser teacher); thisgetsession().setattribu

8、te(constants.usertype, usertype); else /学生 dwstudentlnfo student = thisuserservice.findstudent(username); if(student != null) usertype = usertype.student; result.put(nstatus1',hsuccess11);thisgetsession().setattribute(constants.loginuser, student); thisgetsession().setattribute(constants.usertyp

9、e, usertype);5 /学校當理员schoolaccount schoolaccount = this.userservice.findschoolaccount(username); if(schoolaccount i= null) usertype = dserlype.schooladmin;result put("status' "success");thisgetsession().setattribute(constants.loginuser, schoolaccount); thisgetsession().setattribut

10、e(constants.usertype, usertype);jsonresult.setresult(result);return jsonresult;家庭作业向服务器发送请求数据,获取家庭作业信息和发布家庭作业。homeworkaction.java x 丄0刁/*水添加作业* / public string addhomework()"y gson gson = new gson();map<string> object> map = new hashmap<string> object>(); map.put(mstatuswerror

11、*);if (homework != null) this.getresponse().setcharacterencoding(mutf-8m);list<string> errorlist = validateutils.vatidate(homework); if (errorlist != null && !errorlist.isempty() map put(herrorlist11, errorlist); this.getresponse().getwriter().write(gson.tojson(map); return null;string

12、 course = thisgetrequest().getparameter(mcoursem);string semestername = this.getrequest()ge上卩8广3皿©上6("5尬。5七厂“8皿"); string classesname = this getrequest().getparameter(mclassesm);jwcourse courses = this.homeworkservice.findjwcourse(course); jwclasses classes = this.homeworkservice.find

13、classes(classesname); if (stringutils.is/votblanfe(homework.getld( ) ) ) system.outprintln(wupdatew); homeworksethomeworkdescribe(homeworkgethommwo广lcdqsc:ribw() .trim(); homework.setsemestername(semestername);homework setcla5ses(classes); homework.setcourseid(courses); teacher t = (teacher) this.ge

14、tsession() .getattribute("loginuser1'); homework setteacherid(t);thishomeworkservice.update(homework); system.out.println(msavem); homework.sethomeworkdescribe(homework.gethomeworkdescribe().trim(); homework.setsemestername(semestername);homework.setclasses(classes); homework.setcourseid(co

15、urses); teacher t = (teacher) this.getsession().getattribute(mloginuser"); homework.setteacherid(t);thishomeworkservicesave(homework);thisgetresponse().getwriter().write('ok"); catch (ioexception e) e.printstacktrace();return null;*刃睹直側作业* return*/public string toqueryho<nework( ) s

16、tringbuffer classes = now stringbuffer();teacher t = (teacher) this.getsession().getattribute(wloginuser");list<curriculumschedule> list2 = thistur广ivulusvheduleservicindbyhql(rx)m curriculumschedu t.getld() > w * order by c.schooltime");string classesl;for (curriculumschedule cur

17、riculumschedule : list2) classesl = curriculumschedule getteachercourseid()getclasses();classes.append(classesl*m);/去1手?5审中夏的手段string str = classes.tostring().splitset set = new treeset();for (int i = 0; i < str.length;set.add(str(i);hashmap<string, list<teachchercourse>> hm = new lin

18、kedhashmap<string> list<teachchercourse>>(); str (string) set.toarray(new string0);for (int i = 0; i < str.length; i“) list<teachchercourse> list=thisteavhspaceser*vice.getclassteacherinfo2(stri); hm.put(stri), list);this getrequest() setattribute("classteacherinfo"

19、,hm);list<teacher> teacherlist = thistgzihspatesg广vicefindteathgr*info();/list<department> departmentlist = this.homewo广xse广vive.getlistdepa厂tme list<semester> semesterlist = this.homewo广kse广vicegetlistsemesterall(); thisgetrequest()setattribute(msew>esterlistm, semesterlist);/t

20、his.getrequest()setattribute("departmentlistm, departmentlist);/thisgetrequest()setattribute(mteacherlistm, teacherlist); return mtoqueryhomeworkm;蹟转添加w改作业* return/public string edithomework()string type = this.getrequest( ) .getparameter(,etypem);stringbuffer classes = naw stringbuffw广();strin

21、gbuffer courses = new stringbuffer();semester defaultsem = this.homeworkservice.getdef3ultsemeste();teacher t = (teacher) this.getsession().getattribute(mloginuserm);list<curriculumschedule> list2 = thisvu厂广iculumschedulese厂vixefindbyhql("frx>m curricu + t.getld() + "* order by c.

22、schooltimem);string classl;string course;for (curriculumschedule curriculumschedule : list2) classl = curriculumschedule.getteachercoutseidc)getclasses()getclassesname(); course = curriculumschedule.getteachercourseid()getjwcourse()getcoursename(); classes, append (classl-m); courses.append(course+w

23、,”);/去持宁符审中飯复的却slist<strying classlist = thisteachspaceserviceto广epeat(classes); list<string> courselist = thisteachspacese厂viceto厂epeat(courses);this.getrequest().setattribute(mclasslist' classlist); this.getrequest()setattribute(mcourselistmcourselist); this.getrequest().setattribute(

24、mdefaultsemm, defaultsem);if(typeequals("update")system.out.printin(updatew);homework homelist = this.homeworkservice.gethomewok_t(ho!neworlcgetld(); this.getrequest().setattribute("homelistw,homelist);this getrequest ( ) setattribute( "type'*9 "update'*);/* 伽0请假71-7

25、2737475-7677787980818283848586878889909192939495969798991001011021033.3学生考勤public string save()system.out.println(mupdate555m);try gson gson = new gson();map<string, object> map = new hashmap<stringy object>();mapput("status", merrorm);if (attendance != null) this.getresponse()

26、.setcharacterencoding(rutf-8w);lis广errorlist = validateutilsif(errorlist != null && !errorlist.isempty() mapput(merrorlist", errorlist);thisgetre5ponse()getwriter()write(gson.tojson(map); return null;if (stringutils.is/votblanl?(attendance.getid() date data = new date();atte ndance.mtte

27、ndance setstate(;semester semester = this.attendanceservice.getdgfaultsgmestg厂(); atte ndsntgswtsemgs七广匚<1(5仑尬鸟5上广);jwstudentlnfo s=(jwstudentlnfo) this.getsession().getattribute("loginuser'1); attendance.setstudentid(s);attendance setclasses(s get3wclass(); attendance.setgrade(s.getjwcl

28、ass().get3wgrade(); attendance.setteacherid(s.getjwc13ss()getclassadviser(); thisattendanceservice.update(attendance); else 104date data = new date();105attendance.setcreatedate(data);106attendance.setstate("待审批");107semester* semester = this.attendanceservicegwtdefaultsemester();108attend

29、ance sqtsemest©广id(semester);109jwstudentlnfo s=(3wstudentinfo) thisgetsession()getattribute(wloginuserm);110attend3nc© setstudentid(s);111attendance setclasses(s.get3wclass();112attendance.get jwclass()getjwgrade();113attendance setteache广id(s.getjwclass()getclassadviser();114thisattendan

30、ceservice.save(attendance);115116117118this.getresponse().getwriter().write(hokm);119 catch (ioexception e) 120e.printstacktrace();121122return null;123 v f 144-145146147 148-149150151152153154155156157158159160161162163164165166167168169170171128 129130131132133134135136137138139140141142 t);attend

31、ance.getstate();*获取列表* return/public string findlist() pagemodel<attendsnce> pagemodel = new pagemodel<attendance>(); thissetpagemodel(pagemodel);string usertype=this.getsession().getattribute(musertypeh).tostring(); if (usertype.equals(ml,t)teacher t = (teacher) this. getsession( ) . ge

32、t at tri but e ( m lcxsi nus e r11); thisattendanceservicefindclassattendance(pagemodeltgetld();else if(usertype.equals(m2m)jwstudentlnfo s=(jwstudentlnfo) this.getsession().getattribute("loginuserm); this.attendanceservicefindmyattendance(pagemodel, sgetld();isereturn null;try this getresponse

33、().setcharacterencoding(mutf-8m);this getresponse().getwriter().write(pageut i1s.getjqgridjson(pagemodel); catch (ioexception e) e.printstacktrace();return null;125-/*126 拿批進或不批淮谓假127 *# */public string operation()system out println(attendance getstate();system out p厂int in (attwridaincg getld(); tr

34、y string ids = stringutils.sptit(attendanee.getid(), for(string id : ids) thisattendanceserviceupdatesttendancestate(id, this getresponse().getwriter()write(nok"); catch (ioexception e) eprintstacktrace();return null;3.4班级文章6970717273747576777879808182838485868788899091929394959697oq*获取列表* retu

35、rn/public string findlist() pagemodel<classarticle> pagemodel = new pagemodel<classarticle>(); thissetpagemodel(pagemodel);string usertype = this.getsession().getattribute(,usertypem).tostring(); if (usertype.equals("1") teacher t = (teacher) this.getsession().getattribute(mlog

36、inuserh); this.classarticleservice.findadviserclassarticlelist(pagemodel t.getld(); else if (usertype.equals(m2m) jwstudentlnfo s = (jwstudentinfo) this.getsession().getattribute( -loginuser-);this.classarticleservice.findclassarticlelist(pagemodelsget3wclass()getld(); elsereturn null;try thisgetres

37、ponse().setcharacterencoding(wutf-8h);thisgetresponse()getwriter() .write(pageutils.getjqgridjson(pagemodel); catch (ioexception e) eprintstacktrace();return null;/*滋加文章 */ . .public string addclassarticle() throws unsupportedencodingexception string articledescribe = this.getrequest()getp3rameter(&

38、quot;textareal"); classarticle.setarticledescribe(articledescribe);classarticle.setarticletitie(classarticle.getarticletitle();system.out.println(articledescribe + classarticlegetaticletitle(); date data = new date();classarticle.setcreatedate(data);classarticle.setclicks(0);string usertype = t

39、his.getsession().getattribute( f,usertypew).tostring(); if (usertype.equals(w1m) teacher t = (teacher) this.getsession().getattribute("loginuser"); / classarticle.setauthors(t getteachername(); else if (usertype.equals(h2m) dwstudentlnfo s = (jwstudentlnfo) this.getsession().getattribute(

40、-loginuser”);classarticle.setstudentid(s); classarticle.setclasses(s.getjwclass();thisclassarticleservice.save(classarticle);"y this getresponse().getwriter().write(mokh); catch (exception e) / todo: handie exceptioneprintstacktrace(); return null;*获取文章详情* return*/ public string findclassarticl

41、e() list<classarticle> classarticlelist = this.classarticleservice.getclassarticle(classarticle.getid();systemout.println(classarticle.getld();classarticle article = this.classarticleservice.findclassarticlebyno(classarticle.getid();this classarticleservice.updatearticleclicks(classarticle.get

42、id(),article.getclicks() + 1);list<comments> articlecomments = mentsservice getarticlecommentsinfoc classarticle.getld();this.getrequest()setattribute(nclassarticlelist", classarticlelist);this.getrequest()getsession() setattribute("classarticleld'1, classarticle.getld(); thisget

43、request().setattribute("articlecomments", articlecomments);string usertype = this.getsession() geta'ttr'ibute("usertype")七03七厂匚介0(); if (usertype.equalsc'l") teacher t = (teacher) this.getsession().getattribute("loginuser11); / classarticle.setauthors(t.gett

44、eachername(); else if (usertype.equals(m211) jwstudentlnfo stu=(jwstudentinfo) this.getsession().getattribute("loginuser"); if (article.getstudentid().getld().equals(stu.getld() this getrequest ( ) . setattribute(11 whoarth, "whoart11);return "toclassarticledetail"3.5班级相片/&#

45、187;»来获取班级相片信息* ©throws exception*/ . .public string gwtclassphotosinfo() throws exceptionlist<classphotos> classphotoslist = thisc 1253卩人0七0556厂21.2.getclassphotosir)fo(); this.getrequest() .getsession() .setattribute(,classphotoslisthj classphotoslist); system out. println(l,toclas

46、sphotos");return "toclassphotos"/*那获取某个相片评论信皀* throws exception*/public string getshowphotosinfo() throws exceptionlist<commerrts> commen七slist = commentssgnvice ge'tcommer)'tsin*fo(cl3ssphcrtos getld(); this getrequest() setattribute("photosname", classphotos

47、getphotosname();classphotos photo = thisclassphotosservicefindclassphotosbyteacherno(classphotosgetld(); thisgetrequest().getsession().setattribute("classphoto", photo);this getrequest() setattribute("photosdescribe'' classphotos getphotosdescribe();this getrequest() setattrib

48、ute("commentsiist", commentslist); return "toshowphotos1'/*获取列表* return*/public string findlist() pagemodel<classphotos> pagemodel = new pagemodel<classphotos>(); thissetpagemodel(pagemodel);string usertype=thisgetsession().getattribute("usertype")tostring();

49、 if(usertype.equals(hln)teacher t = (teacher) this.getsession().getattribute(hloginuser'1); thisclassphotosservice.findadviserphotoslist(pagemodel, t.getld();else if(usertype.equals(,2h)dwstudentlnfo s=(dwstudentlnfo) this.getsession().getattribute("loginuser"); this.classphotosservice

50、.findphotoslist(pagemodel,s.getdwclass().getld(); else return null;try this getresponse() setcharacterencoding(mutf-8");this.getresponse() .get 11厂:1七厂().write(pageutiis .gwtpagemodel); catch (ioexception e) e. prin tstacktrace();return null;81-8283848586-87888990919293949596979899l00l01 l02 l0

51、3 l04 l05 l06 l07 l08 l09 l103.6实践活动获取列表* return*/public string findlist() try pagemodel<practice> pagemodel = new pagemodel<practice>(); this setpagemodel (pagemode|l);string usertype = this.getsession().getattribute("usertype").tostring();if (use广type .equals( t") ) teac

52、her t = (teacher) this getsession()0£七“七七厂:1匕11七8("loginuser”);thispracticeservicefindadviserclasspractice(pagemodel tgetld(); else if (usertype.equals(n2") jwstudentlnfo s = (dwstudentlnfo) this.getsession() .getattributec'loginuser1');this.practiceservice.findclasspractice(p

53、agemodel, s.getjwc13ss().getld(); elsereturn null;this getresponse().setcharacterencoding("utf;this getresponse() getwriter().write (pageutils .get jqgric/json( pagemodel); catch (ioexception e) 2.printstacktrace();return null;*添加实戏活动* */public string save() system, out. printin ('* 保存实找活动

54、u);try gson gson = new gson();map<string object> map = new hashmap<string, object>(); map.put(hstatush,''error");if (practice != null) thisgetresponse()setcharacterencoding("utf;list<string> errorlist = validateutils.vatidate(practice); if (errorlist = null &&

55、amp; !errorlist.isempty() map put (11 errorlisth, errorlist);thisgetresponse().getwriter().write(gsontodson(map); return null;semester defaultsemester = this.practiceservice getdefaultsemester(); if (stringutils.isnotblankpractice.getld() date date = new date(); practice.setcreatedate(date); jwstude

56、ntlnfo s = (owstudentlnfo) this.getsession() getattribute(hloginuser”);practice.setcreateuser(s);practice.setclasses(s.getjwclass(); practice.setsemesterid(defaultsemester); thispracticeservice.update(practice); else date date = new date(); practicesetcreatedate(date); dwstudentinfo s = (dwstudentlnfo) this.getsession() getattribute(mloginuser”);practicesetcreateuser(s); practice setclasses(s.get; practicwsetsemesterid(defauitsemester); thispracticeservice.save(practice);this .getresponse( ) .getwriter( ) .writecok"); catch (ioexception e) e.pr

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论