版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
packagebuaa.base.action;importjava.io.PrintWriter;importjava.sql.Timestamp;importjava.util.Date;importjava.util.Iterator;importjava.util.Set;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpSession;importimportbuaa.base.dao.BaseDao;packagebuaa.base.action;importjava.io.PrintWriter;importjava.sql.Timestamp;importjava.util.Date;importjava.util.Iterator;importjava.util.Set;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpSession;importimportbuaa.base.dao.BaseDao;importbuaa.base.entity.Log;importbuaa.base.entity.User;publicBaseAction{publicvoidsetBaseDao(BaseDao{this.baseDao=}StringforwardUrl)throwsJSONObjectitem=newJSONObject();item.put("statusCode",statusCode);item.put("message",message);item.put("navTabId",navTabId);item.put("rel",rel);item.put("forwardUrl",forwardUrl);PrintWriterpw=response.getWriter();}= item.put("err",item.put("msg",PrintWriterpw=response.getWriter();}item.put("err",item.put("msg",PrintWriterpw=response.getWriter();}publicvoidattachmentJsonBack(Stringid,StringfileName,StringattachmentPath,StringattachmentSize)throwsIOException{JSONObjectitem=newJSONObject();item.put("id",id);item.put("attachmentSize",attachmentSize);PrintWriterpw=response.getWriter();}publicbooleanhasFunctionCode(StringfunctionCode){HttpServletRequestrequestHttpSessionsession=request.getSession();Useru=Iterator<Function>it=functions.iterator();inti=0;Functionf=it.next();}if(i!=returnreturn}publicvoidwriteLog(Stringuser,Stringtable,Stringtype,Stringip,Stringcomment){DatenowDate=newDate();TimestampnowDateTimeStamp=newLoglog=newLog();TimestampnowDateTimeStamp=newLoglog=newLog();}}packageimportcom.opensymphony.oscache.base.NeedsRefreshException;publicclassBaseCacheprivatestaticGeneralCacheAdministratorcache=newpublicvoidputInCache(Stringkey,Objectvalue){cache.putInCache(key,value);}publicvoidremoveEntry(String}}publicObjectgetFromCache(Stringkey)throwsNeedsRefreshException{try{return}catch(NeedsRefreshExceptionthrowe;}}}packageimportimportbuaa.base.entity.*;importbuaa.csr.dao.CsrDao;importbuaa.csr.entity.*;importbuaa.sys.dao.SysDao;importpublicimportimportbuaa.base.entity.*;importbuaa.csr.dao.CsrDao;importbuaa.csr.entity.*;importbuaa.sys.dao.SysDao;importpublicclass{privateBaseCachebaseCache;privateSysDaoprivateEnterpriseDaopublicvoidsetBaseCache(BaseCache{this.baseCache=}publicvoidsetSysDao(SysDao{this.sysDao=}{this.enterpriseDao=}publicvoidsetZbpjDao(CsrDao{this.zbpjDao=}publicvoidSystem.out.println("--CACHEEND--}publicvoidthis.baseCache.putInCache("functionList",functionList);List<Role>roleList=this.sysDao.getAllRole();this.baseCache.putInCache("roleList",this.baseCache.putInCache("eTypeList",eTypeList);this.baseCache.putInCache("industryList",industryList);this.baseCache.putInCache("scaleList",scaleList);this.baseCache.putInCache("propertyList",propertyList);this.baseCache.putInCache("industryList",industryList);this.baseCache.putInCache("scaleList",scaleList);this.baseCache.putInCache("propertyList",propertyList);this.baseCache.putInCache("listedList",listedList);this.baseCache.putInCache("algorithmList",algorithmList);this.baseCache.putInCache("indexTypeList",indexTypeList);this.baseCache.putInCache("schemeTypeList",schemeTypeList);this.baseCache.putInCache("statusList",statusList);this.baseCache.putInCache("materialTypeList",materialTypeList);}publicvoidrefreshCache(Stringif(key.equals("roleList")){List<Role>roleList=this.sysDao.getAllRole();this.baseCache.putInCache("roleList",}this.baseCache.putInCache("industryList",industryList);}}}packagepublicclassMD5public}packagepublicclassMD5publicstaticvoidmain(String{MD5md5=newSystem.out.println("MD5Testsuite:");System.out.println("MD5(\"a\"):"+md5.getMD5ofStr("a"));System.out.println("MD5(\"abc\"):"+md5.getMD5ofStr("abc"));System.out.println("MD5(\"messagedigest\"):"+md5.getMD5ofStr("messagedigest"));}publicStringgetMD5ofStr(String{md5Init();digestHexStr="";for(inti=0;i<16;i++)digestHexStr+=return}publicMD5()state=newlong[4];count=newlong[2];digest=newbyte[16];}privatevoid{count[0]=0L;count[1]=0L;state[0]=state[1]=0xefcdab89L;state[2]=0x98badcfeL;state[3]=}privatelongF(longl,longl1,long{returnl&l1|~l&}privatelongG(longl,longl1,long{returnl&l2|l1&}privatelongH(longl,longprivatelongH(longl,longl1,long{returnl^l1^}privatelongI(longl,longl1,long{returnl1^(l|}privatelongFF(longl,longl1,longl2,longl3,longl4,longl5,long{l+=F(l1,l2,l3)+l4+l=(int)l<<(int)l5|(int)l>>>(int)(32L-l5);l+=l1;return}privatelongGG(longl,longl1,longl2,longl3,longl4,longl5,long{l+=G(l1,l2,l3)+l4+l=(int)l<<(int)l5|(int)l>>>(int)(32L-l5);l+=l1;return}privatelongHH(longl,longl1,longl2,longl3,longl4,longl5,long{l+=H(l1,l2,l3)+l4+l=(int)l<<(int)l5|(int)l>>>(int)(32L-l5);l+=l1;return}privatelongII(longl,longl1,longl2,longl3,longl4,longl5,long{l+=I(l1,l2,l3)+l4+l=(int)l<<(int)l5|(int)l>>>(int)(32L-l5);l+=l1;return}privatevoidmd5Update(byteabyte0[],int{byteabyte1[]=newintk=(int)(count[0]>>>3)&0x3f;if((count[0]+=i<<3)<(long)(i<<3))count[1]+=i>>>29;intl=64-k;intif(i>=l)for(j=l;j+63<i;j+={md5Memcpy(abyte1,abyte0,0,}k=}elsej=}k=}elsej=}md5Memcpy(buffer,abyte0,k,j,i-}privatevoidmd5Final()byteabyte0[]=newbyte[8];Encode(abyte0,count,8);inti=(int)(count[0]>>>3)&0x3f;intj=i>=56?120-i:56-i;md5Update(PADDING,j);md5Update(abyte0,8);Encode(digest,state,}privatevoidmd5Memcpy(byteabyte0[],byteabyte1[],inti,intj,int{for(intl=0;l<k;l++)abyte0[i+l]=abyte1[j+l];}privatevoidmd5Transform(byte{longl=state[0];longl1=state[1];longl2=state[2];longl3=state[3];longal[]=newlong[16];Decode(al,abyte0,64);l=FF(l,l1,l2,l3,al[0],7L,0xd76aa478L);l3=FF(l3,l,l1,l2,al[1],12L,0xe8c7b756L);l2=FF(l2,l3,l,l1,al[2],17L,l1=FF(l1,l2,l3,l,al[3],22L,0xc1bdceeeL);l=FF(l,l1,l2,l3,al[4],7L,0xf57c0fafL);l3=FF(l3,l,l1,l2,al[5],12L,0x4787c62aL);l2=FF(l2,l3,l,l1,al[6],17L,0xa8304613L);l1=FF(l1,l2,l3,l,al[7],22L,0xfd469501L);l=FF(l,l1,l2,l3,al[8],7L,0x698098d8L);l3=FF(l3,l,l1,l2,al[9],12L,0x8b44f7afL);l2=FF(l2,l3,l,l1,al[10],17L,l1=FF(l1,l2,l3,l,al[11],22L,0x895cd7beL);l=FF(l,l1,l2,l3,al[12],7L,0x6b901122L);l3=FF(l3,l,l1,l2,al[13],12L,0xfd987193L);l2=FF(l2,l3,l,l1,al[14],17L,0xa679438eL);l1=FF(l1,l2,l3,l,al[15],22L,0x49b40821L);l=GG(l,l1,l2,l3,al[1],5L,0xf61e2562L);l3=GG(l3,l,l1,l2,al[6],9L,0xc040b340L);l2=l3=GG(l3,l,l1,l2,al[6],9L,0xc040b340L);l2=GG(l2,l3,l,l1,al[11],14L,0x265e5a51L);l1=GG(l1,l2,l3,l,al[0],20L,0xe9b6c7aaL);l=GG(l,l1,l2,l3,al[5],5L,0xd62f105dL);l3=GG(l3,l,l1,l2,al[10],9L,0x2441453L);l2=GG(l2,l3,l,l1,al[15],14L,l1=GG(l1,l2,l3,l,al[4],20L,0xe7d3fbc8L);l=GG(l,l1,l2,l3,al[9],5L,0x21e1cde6L);l3=GG(l3,l,l1,l2,al[14],9L,0xc33707d6L);l2=GG(l2,l3,l,l1,al[3],14L,0xf4d50d87L);l1=GG(l1,l2,l3,l,al[8],20L,0x455a14edL);l=GG(l,l1,l2,l3,al[13],5L,0xa9e3e905L);l3=GG(l3,l,l1,l2,al[2],9L,0xfcefa3f8L);=GG(l2,l3,l,l1,al[7],14L,l1=GG(l1,l2,l3,l,al[12],20L,l=HH(l,l1,l2,l3,al[5],4L,l3=HH(l3,l,l1,l2,al[8],11L,0x8771f681L);l2=HH(l2,l3,l,l1,al[11],16L,0x6d9d6122L);l1=HH(l1,l2,l3,l,al[14],23L,l=HH(l,l1,l2,l3,al[1],4L,0xa4beea44L);l3=HH(l3,l,l1,l2,al[4],11L,0x4bdecfa9L);l2=HH(l2,l3,l,l1,al[7],16L,0xf6bb4b60L);l1=HH(l1,l2,l3,l,al[10],23L,0xbebfbc70L);l=HH(l,l1,l2,l3,al[13],4L,0x289b7ec6L);l3=HH(l3,l,l1,l2,al[0],11L,0xeaa127faL);l2=HH(l2,l3,l,l1,al[3],16L,0xd4ef3085L);l1=HH(l1,l2,l3,l,al[6],23L,0x4881d05L);l=HH(l,l1,l2,l3,al[9],4L,0xd9d4d039L);l3=HH(l3,l,l1,l2,al[12],11L,0xe6db99e5L);l2=HH(l2,l3,l,l1,al[15],16L,0x1fa27cf8L);l1=HH(l1,l2,l3,l,al[2],23L,0xc4ac5665L);l=II(l,l1,l2,l3,al[0],6L,0xf4292244L);l3=II(l3,l,l1,l2,al[7],10L,0x432aff97L);l2=II(l2,l3,l,l1,al[14],15L,0xab9423a7L);l1=II(l1,l2,l3,l,al[5],21L,0xfc93a039L);l=II(l,l1,l2,l3,al[12],6L,0x655b59c3L);l3=II(l3,l,l1,l2,al[3],10L,0x8f0ccc92L);l2=II(l2,l3,l,l1,al[10],15L,0xffeff47dL);l1=II(l1,l2,l3,l,al[1],21L,0x85845dd1L);l=II(l,l1,l2,l3,al[8],6L,l3=II(l3,l,l1,l2,al[15],10L,0xfe2ce6e0L);l2=II(l2,l3,l,l1,al[6],15L,0xa3014314L);l1=II(l1,l2,l3,l,al[13],21L,0x4e0811a1L);l=II(l,l1,l2,l3,al[4],6L,0xf7537e82L);l3=II(l3,l,l1,l2,al[11],10L,l2=II(l2,l3,l,l1,al[2],15L,0x2ad7d2bbL);l1=II(l1,l2,l3,l,al[9],21L,state[0]+=l;state[2]+=state[3]+=}privatevoidstate[3]+=}privatevoidEncode(byteabyte0[],longal[],int{intj=for(intk=0;k<i;k+=4)abyte0[k]=(byte)(int)(al[j]&abyte0[k+1]=(byte)(int)(al[j]>>>8&255L);abyte0[k+2]=(byte)(int)(al[j]>>>16&255L);abyte0[k+3]=(byte)(int)(al[j]>>>24&255L);}}privatevoidDecode(longal[],byteabyte0[],int{intj=for(intk=0;k<i;k+=4)al[j]=b2iu(abyte0[k])|b2iu(abyte0[k+1])<<8|b2iu(abyte0[k+2])<<16|b2iu(abyte0[k+<<}}publicstaticlongb2iu(bytebyte0)returnbyte0>=0?byte0:byte0&}publicstaticStringbyteHEX(byte{charac[]='0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'charac1[]=newchar[2];ac1[0]=ac[byte0>>>4&0xf];ac1[1]=ac[byte0&0xf];Strings=newString(ac1);returns;}staticfinalintS11=7;staticfinalintS12=12;staticfinalintS13=17;staticfinalintS14=publicstaticfinalStringisLogin="OK";staticfinalintS21=5;staticfinalintS22=9;staticfinalintS23=14;staticfinalintS24=20;staticfinalintS31=4;staticfinalintS32=staticfinalintstaticfinalintS33=16;staticfinalintS34=23;staticfinalintS41=6;staticfinalintS42=10;staticfinalintS43=15;staticfinalintS44=staticfinalbytePADDING[]=-128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,privatelongstate[];privatelongcount[];privatebytebuffer[];privatebytedigest[];}packageimportjava.math.BigInteger;importjava.util.ArrayList;importjava.util.List;importimportimportorg.apache.poi.xwpf.usermodel.TextAlignment;importorg.apache.poi.xwpf.usermodel.XWPFDocument;importorg.apache.poi.xwpf.usermodel.XWPFParagraph;importorg.apache.poi.xwpf.usermodel.XWPFRun;importorg.apache.poi.xwpf.usermodel.XWPFTable;importorg.apache.poi.xwpf.usermodel.XWPFTableRow;importorg.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts;importorg.openxmlformats.schemas.wordprocessingml.x2006.main.CTJc;importorg.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr;importorg.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;importorg.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblPr;importorg.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;importorg.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;importorg.openxmlformats.schemas.wordprocessingml.x2006.main.STJc;importorg.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge;publicstaticvoidmain(String[]args)publicstaticvoidmain(String[]args)throwsExceptionWordToolst=newXWPFDocumentwordDoc=newt.addSimpleParagraph(wordDoc,测试文本宋体16,true,false);t.saveDocument(wordDoc,}//publicvoidcreateSimpleTable(Stringtype,List<Map<String,String>>data,XWPFDocumentdoc)throwsException{XWPFTabletable=CTTblttbl=CTTblPrtblPr=ttbl.getTblPr()==null?ttbl.addNewTblPr():ttbl.getTblPr();CTJccTJc=tblPr.addNewJc();tblWidth.setW(newBigInteger("8000"));if(type.equals("enterprise"))for(inti=0;i<data.size();i++)List<String>columnList=newMap<String,String>map=data.get(i);addRows(table,}XWPFTableRowrow=table.insertNewTableRow(0);XWPFTableCellcell1=row.addNewTableCell();createVSpanCell(cell1,"专家","",1600,STMerge.RESTART);XWPFTableCellcell2=row.addNewTableCell();XWPFTableCellcell3=row.addNewTableCell();createVSpanCell(cell3,指标得分1600,}if(type.equals("expert"))for(inti=0;i<data.size();i++)List<String>columnList=newMap<String,String>map=data.get(i);addRows(table,}XWPFTableRowrow=table.insertNewTableRow(0);XWPFTableCellcell1=row.addNewTableCell();createVSpanCell(cell1,"企业Map<String,String>map=data.get(i);addRows(table,}XWPFTableRowrow=table.insertNewTableRow(0);XWPFTableCellcell1=row.addNewTableCell();createVSpanCell(cell1,"企业","",1600,STMerge.RESTART);XWPFTableCellcell2=row.addNewTableCell();XWPFTableCellcell3=row.addNewTableCell();createVSpanCell(cell3,指标得分1600,}table.removeRow(table.getNumberOfRows()-1);//删除最后}publicvoidaddRows(XWPFTabletable,List<String>introwNum=columnList.get(columnList.size()-for(inti=0;i<rowNum;i++){}for(intj=0;j<columnList.size();j++)if(columnList.get(j).indexOf("|")==-{for(inti=0;i<rowNum;i++)if(i==0)createVSpanCell(cell,columnList.get(j),"",1600,createVSpanCell(cell,1600null);//}}elseString[]strArr=for(inti=0;i<rowNum;i++)XWPFTableCellcell=rowList.get(i).addNewTableCell();}}}}publicvoidaddNewPage(XWPFDocumentdocument,}publicvoidaddNewPage(XWPFDocumentdocument,BreakType{XWPFParagraphxp=document.createParagraph();}publicvoidaddBreakClear(XWPFDocumentdocument,BreakClear{XWPFParagraphxp=document.createParagraph();}publicvoidaddSimpleParagraph(XWPFDocumentdocument,Stringtext,StringfontName,intfontSize,Stringcolor,booleanisBold,booleanisItalic){XWPFRunr1=xp.createRun();CTRPrrpr=r1.getCTR().isSetRPr()?r1.getCTR().getRPr():CTFontsfonts=rpr.isSetRFonts()?rpr.getRFonts():}publicvoidsetCellText(XWPFTableCellcell,Stringtext,Stringbgcolor,intwidth){CTTccttc=CTTcPrcellPr=cttc.addNewTcPr();CTTcPrctPr=cttc.addNewTcPr();}publicvoidcreateHSpanCell(XWPFTableCellcell,Stringvalue,Stringbgcolor,intwidth,STMerge.EnumstMerge){CTTccttc=cell.getCTTc();}publicvoidcreateVSpanCell(XWPFTableCellcell,}publicvoidcreateVSpanCell(XWPFTableCellcell,Stringvalue,Stringbgcolor,intwidth,STMerge.EnumstMerge){CTTccttc=CTTcPrcellPr=cttc.addNewTcPr();}publicvoidsaveDocument(XWPFDocumentdocument,StringsavePath)throwsException{FileOutputStreamfos=newFileOutputStream(savePath);}}packageimportjava.text.ParseException;importjava.util.Calendar;importimportjava.util.UUID;publicclassDateToolspublicstaticfinalintFMT_SHORT=publicstaticfinalintFMT_MIDDLE=publicstaticfinalintFMT_LONG=publicStringdatetime){StringBufferbuffer=newStringBuffer();SimpleDateFormatsdf=newSimpleDateFormat("yyyy-MM");Calendarcalendar=newGregorianCalendar();try{Calendarcalendar=newGregorianCalendar();try{if(day<10){}}catch(ParseException{}return}@param@parampublicstaticintdaysBetween(Datedate2){Calendarcal=Calendar.getInstance();longtime2=longbetween_days=(time2-return}publicstaticStringyearString(java.util.Datedate){Stringstrval="";Stringfmtlist=SimpleDateFormatsdf=newSimpleDateFormat(fmtlist);strval=sdf.format(date);return}publicstaticjava.util.Datestring2Date(Strings,int{if(s==null||s.length()==0)returnStringstrFormat=null;strFormat="yyyy-MM-}elseifstrFormat="yyyy-MM-}elseif(i=={strFormat="yyyy-MM-dd}elseif(i=={strFormat="yyyy-MM-ddstrFormat="yyyy-MM-}if(strFormat!=null&&s!=null&&{SimpleDateFormatsdf=newSimpleDateFormat(strFormat);try{dateval=}catch(ParseException{}}return}{if(s==null||s.length()==0)returnStringstrFormat=null;if(s.length()==10)strFormat="yyyy-MM-}elseif(s.length()==16)strFormat="yyyy-MM-dd}elseif(s.length()==19)strFormat="yyyy-MM-ddstrFormat="yyyy-MM-}if(strFormat!=null&&{System.out.println("格式为:"+strFormat);SimpleDateFormatsdfnewSimpleDateFormat(strFormat);try{dateval=}catch(ParseException{}}return}publicstaticStringdate2String(java.util.Date{returndate2String(date,}publicstaticStringdate2String(java.util.DatepublicstaticStringdate2String(java.util.Date{returndate2String(date,}publicstaticStringdate2String(java.util.Datedate,int{Stringstrval=String[]fmtlist={"yyyy-MM-dd","yyyy-MM-ddHH:mm","yyyy-MM-ddHH:mm:ss"};if(i>=FMT_SHORT&&i<=FMT_LONG&&date!={=SimpleDateFormat(fmtlist[i]);strval=}return}publicstaticStringgetNow()return}{Stringstrval=String[]fmtlist={"yyyy-MM-dd","yyyy-MM-ddHH:mm","yyyy-MM-ddHH:mm:ss"};if(i>=FMT_SHORT&&i<=FMT_LONG)SimpleDateFormatsdf=newSimpleDateFormat(fmtlist[i]);strval=sdf.format(newDate(System.currentTimeMillis()));}return}publicstaticStringdateFileName(){SimpleDateFormatsdf=newSimpleDateFormat("yyyyMMddHHmmss");StringdateString=sdf.format(newDate());StringrandCode=UUID.randomUUID().toString().substring(0,4);//4returndateString+}}packageimportimportimportimportjava.io.IOException;publicclassimportjava.io.IOException;publicclassFileToolspublicstaticStringgetFilePrefix(StringfileName){intsplitIndex=fileName.lastIndexOf(".");returnfileName.substring(0,splitIndex);publicstaticStringgetFileSufix(StringfileName){intsplitIndex=fileName.lastIndexOf(".");returnfileName.substring(splitIndex+publicstaticvoidcopyFile(StringinputFile,StringoutputFile)throwsFileNotFoundException{FilesFile=newFile(inputFile);FiletFile=newFileInputStreamfis=newFileInputStream(sFile);FileOutputStreamfos=newFileOutputStream(tFile);inttemp=0;trywhile((temp=fis.read())!=-{}}catch(IOException{}try}catch(IOException{}}}//privatestaticStringmatches="[A-Za-//sPath.matches(matches)方法的返回值判断是否正sPath *@param *@returntruefalsepublicstaticbooleanDeleteFolder(String{booleanflag=false;Filefile=newFile(sPath);//if(!file.exists()){ //不存在falsereturnflag;}else//if(!file.exists()){ //不存在falsereturnflag;}else//( //为文件时调用删除文件方returnelse //return}}}**publicstaticbooleandeleteFile(String{booleanflag=false;Filefile=newFile(sPath);//if(file.isFile()&&flag=true;}return}sPathpublicstaticbooleandeleteDirectory(StringsPath)if{sPath=sPath+}FiledirFile=newif(!dirFile.exists()||{return}booleanflag=File[]files=dirFile.listFiles();for(inti=0;i<files.length;i++)if(files[i].isFile())flag=if(!flag)else{if(!flag)break;}}ifif(!flag)else{if(!flag)break;}}if(!flag)returnif{return}elsereturn}}}packageimportimportbuaa.base.entity.User;publicclassLoginDaoImplextendsBaseHibernateDaoSupportimplementsLoginDaopublicUsergetUser(intid)//TODOAuto-generatedmethod}publicvoidupdateUser(Useruser)}publicList<User>findByNameAndPass(Stringname,Stringpasswd)//TODOAuto-generatedmethodstub.find("fromUseruwhereu.userName=?andu.password=?",name,}}packageimportimportimportpublicclassLoginBusinessImplimplements{privateLoginDaopublicvoidimportpublicclassLoginBusinessImplimplements{privateLoginDaopublicvoidsetLoginDao(LoginDao{this.loginDao=}publicList<User>validLogin(Stringname,Stringpasswd)//TODOAuto-generatedmethodList<User>userList=loginDao.findByNameAndPass(name,return}publicbooleanvalidPassword(intid,Stringpasswd)Useru=loginDao.getUser(id);returntrue;return}publicvoidmodifyPassword(intid,Stringpasswd)Useru=loginDao.getUser(id);}}packageimportjava.io.PrintWriter;importjava.util.List;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpSession;importimportimportbuaa.base.util.MD5;importpublicclassLoginActionextends{privateLoginBusinessimportbuaa.base.util.MD5;importpublicclassLoginActionextends{privateLoginBusiness{this.loginBusiness=}publicStringlogin()throwsHttpServletRequestrequest=ServletActionContext.getRequest();Stringname=request.getParameter("name");Stringyzm=request.getParameter("yzm");HttpSessionsession=StringrandCode=MD5md5=newStringmd5Passwd=List<User>userList=loginBusiness.validLogin(name,md5Passwd);if(userList.size()==1&&yzm.equals(randCode)){Useru=userList.get(0);return}PrintWriterpw=response.getWriter();type='text/javascript'>alert('登录信息错误!请重新输入return}}publicStringHttpServletRequestrequest=return}publicvoidchangePassword()throwsIOException{HttpServletRequestrequest=intid=return}publicvoidchangePassword()throwsIOException{HttpServletRequestrequest=intid=StringoldPassword=request.getParameter("oldPassword");MD5md5=newStringmd5OldPassword=md5.getMD5ofStr(oldPassword);md5OldPassword)){dwzJsonBack("200",修改密码成功"closeCurrent",}"}}}packageimportimportpublicinterfaceSysBusinessvoidaddUser(StringuserName,Stringpassword,StringrealName,Stringdepartment,introleID);voiddeleteUser(intuserID);voidupdateUser(Useruser);UsergetUser(intuserID);voidsubEditUser(intuserID,StringuserName,StringrealName,Stringdepartment,introleID);booleanexistUserName(StringuserName);longlonggetUserNum(StringroleName,StringlonggetUserNumByQuery(Stringhql,Object[]values);List<User>getUserList(Stringhql,intoffset,intpageSize);List<User>getUserList(Stringhql,Object[]values,intoffset,intpageSize);booleanexitUserName(StringuserName);voidaddRole(StringroleName,Stringdescription,int[]voidaddRole(StringroleName,Stringdescription,int[]voidsubEditRole(introleID,StringroleName,Stringdescription,int[]functionIDList);booleanroleInUse(introleID);voiddeleteRole(intlonggetRoleNum()throwsException;longgetRoleNumByQuery(Stringhql,Object[]values);List<Role>getRoleList(Stringhql,intoffset,intpageSize);List<Role>getRoleList(Stringhql,Object[]values,intoffset,intpageSize);booleanexitRoleName(StringroleName);longlonggetLogNumByQuery(Stringhql,Object[]values);List<Log>getLogList(Stringhql,intoffset,intpageSize);List<Log>getLogList(Stringhql,Object[]values,intoffset,int}packageimportjava.util.Date;importjava.util.List;importbuaa.sys.dao.SysDao;importbuaa.sys.dao.SysDaoImpl;importbuaa.base.entity.*;import{privateSysDaopublicvoidsetSysDao(SysDao{this.sysDao=}publicvoidaddUser(StringuserName,Stringpassword,StringrealName,Stringdepartment,introleID){//TODOAuto-generatedmethodstubDatenowDate=newTimestampnowDateTimeStamp=newMD5md5=newStringmd5Password=Useruser=new}publicvoiddeleteUser(intuserID)}publicvoiddeleteUser(intuserID)}publicUsergetUser(intuserID)returnthis.sysDao.getUser(userID);}publicvoidsubEditUser(intuserID,StringuserName,StringrealName,Stringdepartment,introleID){//TODOAuto-generatedmethodstub}publicvoidaddRole(StringroleName,Stringdescription,int[]functionIDList){Rolerole=newRole();introleID=roleList.get(0).getID();for(inti=0;i<functionIDList.length;{RoleFunctionroleFunction=newfor(inti=0;i<functionIDList.length;{RoleFunctionroleFunction=new}}publicvoidsubEditRole(introleID,StringroleName,Stringdescription,int[]functionIDList){//TODOAuto-generatedmethodstubfor(inti=0;i<roleFunctionList.size();i++){introleFunctionID=roleFunction.getID();}for(inti=0;i<functionIDList.length;{RoleFunctionroleFunction=new}}publicbooleanroleInUse(introleID)intm=0;for(inti=0;i<userList.size();i++){Useruser=if(user.getRole().getID()==}}if(m==returnreturn}}}if(m==returnreturn}publicvoiddeleteRole(introleID)for(inti=0;i<roleFunctionList.size();i++){introleFunctionID=roleFunction.getID();}}publiclonggetLogNum()returnthis.sysDao.getLogNum();}publiclonggetLogNumByQuery(Stringhql,Object[]values)//TODOAuto-generatedmethodreturnthis.sysDao.getLogNumByQuery(hql,}publicList<Log>getLogList(Stringhql,intoffset,intpageSize)//TODOAuto-generatedmethodList<Log>logList=((SysDaoImpl)sysDao).findByPage(hql,offset,return}publicList<Log>getLogList(Stringhql,Object[]values,intoffset,intpageSize){//TODOAuto-generatedmethodList<Log>logList=((SysDaoImpl)sysDao).findByPage(hql,values,offset,return}List<Log>logList=((SysDaoImpl)sysDao).findByPage(hql,values,offset,return}publicbooleanexistRoleName(StringroleName)//TODOAuto-generatedmethodList<Role>roleList=returnfalse;return}publicbooleanexistUserName(StringuserName)//TODOAuto-generatedmethodList<User>userList=returnfalse;return}publiclonggetUserNum()returnthis.sysDao.getUserNum();}publiclonggetUserNumByQuery(Stringhql,Object[]values)//TODOAuto-generatedmethodreturnthis.sysDao.getUserNumByQuery(hql,}publicList<User>getUserList(Stringhql,intoffset,intpageSize)//TODOAuto-generatedmethodList<User>userList=((SysDaoImpl)sysDao).findByPage(hql,offset,return}publicList<User>getUserList(Stringhql,Object[]values,intoffset,intpageSize){//TODOAuto-generatedmethod//TODOAuto-generatedmethodreturn}publiclonggetRoleNum()throws//TODOAuto-generatedmethodstubBaseCachebaseCache=newBaseCache();List<Role>roleList=(List<Role>)return}publiclonggetRoleNumByQuery(Stringhql,Object[]values)//TODOAuto-generatedmethodreturnthis.sysDao.getRoleNumByQuery(hql,}publicList<Role>getRoleList(Stringhql,intoffset,intpageSize)//TODOAuto-generatedmethodreturn}publicList<Role>getRoleList(Stringhql,Object[]values,intoffset,intpageSize){//TODOAuto-generatedmethodList<Role>roleList=((SysDaoImpl)sysDao).findByPage(hql,values,offset,return}publicbooleanexitRoleName(StringroleName)//TODOAuto-generatedmethodList<Role>roleList=returnfalse;return}publicbooleanexitUserName(StringuserName)//TODOpublicbooleanexitUserName(StringuserName)//TODOAuto-generatedmethodList<User>userList=returnfalse;return}publicList<User>getAllUserList()returnthis.sysDao.getAllUser();}publicvoidupdateUser(Useruser)}publiclonggetUserNum(StringroleName,Stringflag)//TODOAuto-generatedmethodreturnthis.sysDao.getUserNum(roleName,}}30<%@pagepageEncoding="utf-8"ColorgetRandColor(intfc,intRandomrandomnewRandom();if(fc>255)fc=if(bc>bc=intr=fc+random.nextInt(bc-fc);intg=fc+random.nextInt(bc-fc);intb=fc+random.nextInt(bc-fc);returnnewColor(r,g,b);}response.setDateHeader("Expires",0);intwidth=72,heightresponse.setDateHeader("Expires",0);intwidth=72,height=BufferedImageimage=newBufferedImage(width,height,Graphicsg=Randomrandom=newg.fillRect(0,0,width,height);g.setFont(newFont("TimesNewRoman",Font.PLAIN,for(inti=0;i<200;i++){intx=random.nextInt(width);intxl=random.nextInt(12);intyl=random.nextInt(12);g.drawLine(x,y,x+xl,y+yl);}=StringsRand="";for(inti=0;i<5;i++){sRand+=str;g.setColor(newColor(20+random.nextInt(110),20+random.nextInt(110),20+g.drawString(str,13*i+6,16);}//将认证码存入SESSIONImageIO.write(image,"JPEG",//getOutputStreamhasalreadybeencalledforthisresponseout=ImageIO.write(image,"JPEG",//getOutputStreamhasalreadybeencalledforthisresponseout="-<divrequired-onsubmit="returnvalidateCallback(this,<divclass="pageFormContent"<div<inputtype="password"name="oldPassword"size="28"minlength="6"class="required"<divminlength="6"maxlength="20"class="required<div<inputtype="password"name="rnewPassword"size="28"equalTo="#cp_newPassword"class="requiredalphanumeric"/><inputtype="hidden"name="id"<divtype="submit">提交<%@page<%@tagliburi="http://jav/jsp/jstl/core"<%@page<%@tagliburi="http://jav/jsp/jstl/core""-BaseCachebc=newpageContext.setAttribute("functionList",functionList);<formaction="subAddRole.action"method="post"class="pageFormvalidateCallback(this,navTabAjaxDone);"><divclass="pageFormContent"<dl<inputtype="text"class="requiredtextInput"required-<dl<inputtype="text"class="requiredtextInput"<dl<c:forEachvar="fl"items="${functionList}"<c:iftest="${fl.type== <dl<c:forEachv
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 含氟烯烃生产工岗前专业实操考核试卷含答案
- 临邑施工类应急预案(3篇)
- 传统门店促销活动方案策划(3篇)
- 十五条红线施工方案(3篇)
- 主题讲话系列活动方案策划(3篇)
- 农村春节活动拔河方案策划(3篇)
- upvc热熔施工方案(3篇)
- 1-1-Biphenyl-2-2-6-6-tetracarboxylic-acid-NSC408156-生命科学试剂-MCE
- 单招考试应急预案(3篇)
- 咖啡外卖店营销方案(3篇)
- 海南省主要乡土树种名录
- 产科病房孕妇心肺复苏应急演练脚本
- 工程变更管理流程及案例分析
- 新进人员院感培训
- 木材加工厂安全培训课件
- DGTJ08-2065-2020 住宅二次供水技术标准 附条文说明
- GB/T 13029.1-2025船舶电气装置第1部分:电缆的选择和安装
- 高等数学(上册)(慕课版)课件 第1章 习题课
- 合唱课题申报书
- 2025年八年级上学期地理早背晚默资料
- 云南民族大学附属高级中学2026届高三上学期联考(一)地理试卷(含解析)
评论
0/150
提交评论