![財務(wù)報銷管理_第1頁](http://file4.renrendoc.com/view/1db5e4b750749e7fd5a54c6d3227e591/1db5e4b750749e7fd5a54c6d3227e5911.gif)
![財務(wù)報銷管理_第2頁](http://file4.renrendoc.com/view/1db5e4b750749e7fd5a54c6d3227e591/1db5e4b750749e7fd5a54c6d3227e5912.gif)
![財務(wù)報銷管理_第3頁](http://file4.renrendoc.com/view/1db5e4b750749e7fd5a54c6d3227e591/1db5e4b750749e7fd5a54c6d3227e5913.gif)
![財務(wù)報銷管理_第4頁](http://file4.renrendoc.com/view/1db5e4b750749e7fd5a54c6d3227e591/1db5e4b750749e7fd5a54c6d3227e5914.gif)
![財務(wù)報銷管理_第5頁](http://file4.renrendoc.com/view/1db5e4b750749e7fd5a54c6d3227e591/1db5e4b750749e7fd5a54c6d3227e5915.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
Web應(yīng)用開發(fā)工程師案例手冊----財務(wù)報銷管理系統(tǒng)一、項目需求分析1、項目背景描述某學(xué)院的財務(wù)部門,現(xiàn)在感覺到本院的財務(wù)支出管理有點混亂,對于個別業(yè)務(wù)部門存在任意開支的現(xiàn)象,所以希望通過網(wǎng)上統(tǒng)一登記報銷細(xì)目的形式,財務(wù)主管和院領(lǐng)導(dǎo)可以隨時掌握學(xué)院的經(jīng)費支出情況。學(xué)院的財務(wù)形式描述如下:每年學(xué)院的國家撥款及各類收入都按照各個業(yè)務(wù)部門的預(yù)算,劃成分類的賬號,所有的支出都按照其所發(fā)生的業(yè)務(wù)性質(zhì)所屬賬號進(jìn)行報銷。各個賬號有相應(yīng)的負(fù)責(zé)人和出納,有的負(fù)責(zé)人會有多個賬號的支配權(quán)限,有的出納可以操作多個賬號,只要業(yè)務(wù)相關(guān)即可,這些都是由財務(wù)主管來分配。用戶已經(jīng)提供原始表格,一期任務(wù)把該表格實現(xiàn)網(wǎng)上填報即可。財務(wù)主管可以看到全院所有的報銷信息,財務(wù)助理只能看到自己錄入的信息。所有的記錄應(yīng)可以導(dǎo)出Excel表格。2、需求概要分析(1)、用戶和角色權(quán)限部分:財務(wù)主管維護(hù)系統(tǒng)用戶,并為用戶指定角色,用戶的初始化密碼和證件號相同,各用戶自己登陸后可修改密碼。角色分為三類:、出納:可以對自己被授權(quán)的賬號進(jìn)行報銷記錄的維護(hù);、賬號負(fù)責(zé)人:可以對自己被授權(quán)的賬號進(jìn)行查詢,不能做新增、修改、刪除等操作;、財務(wù)主管:可以查詢、維護(hù)全院所有賬號的報銷記錄;(2)、報銷記錄維護(hù):填寫報銷記錄時,需要記錄摘要、費用類型、經(jīng)辦人、所屬賬號、記錄人、記錄時間、處理方式等信息。參考用戶提供的原始表格。為規(guī)范填寫,費用記錄、處理方式都做標(biāo)準(zhǔn)化處理,財務(wù)主管維護(hù)代碼表后,出納錄入時選擇錄入。為避免賬號填寫錯誤,出納錄入時,賬號信息也是選擇方式錄入,每個出納只能列出自己被授權(quán)的賬號。(3)、報銷記錄查詢根據(jù)賬號、費用類型、金額范圍等字段進(jìn)行查詢。出納和賬號負(fù)責(zé)人只能查詢到自己被授權(quán)的賬號的報銷記錄。財務(wù)主管可以看到所有賬號的報銷記錄。查詢結(jié)果最下方,需要對金額字段做匯總。查詢結(jié)果應(yīng)該能導(dǎo)出Excel3、開發(fā)技術(shù)參數(shù)數(shù)據(jù)庫采用Oracle;系統(tǒng)架構(gòu)采用Struts+Spring+Hibernate;涉及開發(fā)環(huán)境和工具:JDK1.5、Eclipse(MyEclipse)、Resin3.0.19(Tomcat5.5以上亦可)、Dreamweaver、Oracle數(shù)據(jù)庫及客戶端;二、系統(tǒng)功能設(shè)計1、用戶維護(hù)只有財務(wù)主管才有用戶維護(hù)的功能。新加用戶按鈕修改用戶刪除用戶選擇序號用戶名角色C新加用戶按鈕修改用戶刪除用戶選擇序號用戶名角色Checkbox12001230001出納Checkbox22001580610賬號負(fù)責(zé)人Checkbox3…………說明:1、選中某條記錄,可以進(jìn)行修改,每次只能修改一條記錄;2、刪除可以批量進(jìn)行,可以選中多條記錄進(jìn)行刪除;3、點新加用戶按鈕后,跳轉(zhuǎn)到下頁的新加用戶界面;報銷維護(hù)賬號授權(quán)賬號維護(hù)處理方式維護(hù)費用類型維護(hù)用戶維護(hù)退出Banner(財務(wù)主管)---用戶維護(hù)新加用戶頁面新加用戶頁面用戶登陸名:__________用戶姓名:____________角色:__________(select)保存按鈕說明:1、角色的下拉選項有出納、賬號負(fù)責(zé)人兩類;2、保存用戶時,應(yīng)檢測該用戶名是否已經(jīng)存在,如果存在,則返回本頁面并給出相應(yīng)提示;3、用戶名應(yīng)當(dāng)是用戶證件號;2、賬號維護(hù)新加賬號頁面新加賬號頁面賬號:_____________賬號名稱:__________賬號負(fù)責(zé)人:_______賬號狀態(tài):__________(select)備注:_______________________________________________保存按鈕說明:賬號狀態(tài)是指:正常、關(guān)閉兩種狀態(tài)Banner(財務(wù)主管)---賬號維護(hù)Banner(財務(wù)主管)---賬號維護(hù)報銷維護(hù)賬號授權(quán)賬號維護(hù)處理方式維護(hù)費用類型維護(hù)用戶維護(hù)退出新加賬號按鈕修改賬號刪除賬號選擇序號賬號賬號名稱賬號負(fù)責(zé)人賬號狀態(tài)備注Checkbox11000010001日常辦公賬號張華正常Checkbox23000020005學(xué)生活動經(jīng)費李軍正常Checkbox3…………說明:1、選中某條記錄,可以進(jìn)行修改,每次只能修改一條記錄;2、刪除可以批量進(jìn)行,可以選中多條記錄進(jìn)行刪除;3、點新加用戶按鈕后,跳轉(zhuǎn)到上頁的新加賬號界面;3、報銷處理方式維護(hù)Banner(財務(wù)主管)---Banner(財務(wù)主管)---報銷處理方式維護(hù)報銷維護(hù)賬號授權(quán)賬號維護(hù)處理方式維護(hù)費用類型維護(hù)用戶維護(hù)退出新加處理方式按鈕修改刪除選擇序號處理方式Checkbox1已領(lǐng)現(xiàn)金Checkbox2已領(lǐng)支票Checkbox3……說明:1、選中某條記錄,可以進(jìn)行修改,每次只能修改一條記錄;2、刪除可以批量進(jìn)行,可以選中多條記錄進(jìn)行刪除;3、點新加處理方式按鈕后,跳轉(zhuǎn)到下頁的新加處理方式界面;新加處理方式新加處理方式頁面處理方式:__________保存按鈕說明:保存的時候,要檢測該處理方式是否已經(jīng)存在,如果已經(jīng)存在,需要返回本頁并給出提示;4、費用類型維護(hù)Banner(財務(wù)主管)---費用類型維護(hù)Banner(財務(wù)主管)---費用類型維護(hù)報銷維護(hù)賬號授權(quán)賬號維護(hù)處理方式維護(hù)費用類型維護(hù)用戶維護(hù)退出新加費用類型按鈕修改刪除選擇序號費用代碼費用類型費用說明Checkbox101辦公費……Checkbox202郵電費……Checkbox3……說明:1、選中某條記錄,可以進(jìn)行修改,每次只能修改一條記錄;2、刪除可以批量進(jìn)行,可以選中多條記錄進(jìn)行刪除;3、點新加處理方式按鈕后,跳轉(zhuǎn)到下頁的新加處理方式界面;新加費用類型新加費用類型費用代碼:______費用類型:_____________費用說明:____________________________________(textarea)保存按鈕說明:1、保存的時候,要檢測該費用類型是否已經(jīng)存在,如果已經(jīng)存在,需要返回本頁并給出提示;2、費用代碼、費用類型、費用說明均為必填項;5、賬號授權(quán)報銷維護(hù)賬號授權(quán)報銷維護(hù)賬號授權(quán)賬號維護(hù)處理方式維護(hù)費用類型維護(hù)用戶維護(hù)退出Banner(財務(wù)主管)---賬號授權(quán)新加賬號授權(quán)新加賬號授權(quán)按鈕修改刪除賬號_______授權(quán)人______查詢按鈕選擇序號賬號授權(quán)人Checkbox11000010001張華Checkbox21000010002李磊說明:1、選中某條記錄,可以進(jìn)行修改,每次只能修改一條記錄;2、刪除可以批量進(jìn)行,可以選中多條記錄進(jìn)行刪除;3、點新加按鈕后,跳轉(zhuǎn)到下頁的新賬號授權(quán)界面;4、點下查詢按鈕后,本頁顯示查詢結(jié)果;新建賬號授權(quán)頁新建賬號授權(quán)頁賬號:________(select)授權(quán)人:_________(select)保存說明:1、賬號的下拉框是從賬號表中讀出;2、授權(quán)人的下拉框是從用戶表中讀出,顯示用戶的真實姓名,存盤時存用戶的zjh;Banner—Banner—報銷維護(hù)首頁報銷維護(hù)報銷維護(hù)賬號授權(quán)賬號維護(hù)處理方式維護(hù)費用類型維護(hù)用戶維護(hù)退出新加修改刪除新加修改刪除賬號:_____(select)金額范圍____至____報銷時間_____至_____費用類型:______(select)處理方式:_______(select)查詢按鈕選擇序號摘要費用類型處理方式金額經(jīng)辦人記錄人報銷時間備注合計:***----------------------------------------------------------------------------說明:1、賬號是當(dāng)前用戶被授權(quán)的所有賬號下拉選擇;2、費用類型、處理方式都是下拉列表;3、頁面底部是當(dāng)頁的金額合計新加報銷記錄頁新加報銷記錄頁賬號:________(select)金額:____________摘要:________費用類型:______(select)處理方式:________(select)報銷時間:____________經(jīng)辦人:_____________保存按鈕說明:1、存盤的時候,自動保存當(dāng)前用戶為錄入人;2、金額框,只能輸入數(shù)值型;三、數(shù)據(jù)庫設(shè)計1、報銷明細(xì)表2、用戶表3、費用類型4、賬號5、賬號授權(quán)四、運行結(jié)果實例用戶登錄報銷記錄列表賬號授權(quán)結(jié)果導(dǎo)出Excel刪除之前必須進(jìn)行詢問與確認(rèn)賬號維護(hù)用戶管理報銷處理方式的維護(hù)費用類型維護(hù)五、重點代碼剖析Struts-config.xml<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstruts-configPUBLIC"-//ApacheSoftwareFoundation//DTDStrutsConfiguration1.2//EN""/dtds/struts-config_1_2.dtd"><struts-config><data-sources/><form-beans><form-beanname="loginForm"type=".thcic.demo.form.LoginForm"/><form-beanname="zhForm"type=".thcic.demo.form.ZhForm"/><form-beanname="bxListForm"type=".thcic.demo.form.BxListForm"/><form-beanname="fylxForm"type=".thcic.demo.form.FylxForm"/><form-beanname="clfsForm"type=".thcic.demo.form.ClfsForm"/><form-beanname="zhsqForm"type=".thcic.demo.form.ZhsqForm"/><form-beanname="bxmxForm"type=".thcic.demo.form.BxmxForm"/><form-beanname="cwUserForm"type=".thcic.demo.form.CwUserForm"/><form-beanname="testForm"type=".thcic.demo.form.TestForm"/></form-beans><global-exceptions/><global-forwards/><action-mappings><actionattribute="loginForm"input="/login.jsp"name="loginForm"path="/login"scope="request"type=".thcic.demo.action.LoginAction"><forwardname="loginSuccess"path="/bxmx.do?method=list"/><forwardname="loginError"path="/error.jsp"/></action><actionattribute="bxmxForm"input="/bxmxList.jsp"parameter="method"name="bxmxForm"path="/bxmx"scope="request"type=".thcic.demo.action.BxmxAction"><forwardname="success"path="/bxmxList.jsp"/></action><actionattribute="zhForm"name="zhForm"parameter="method"path="/zh"scope="request"type=".thcic.demo.action.ZhAction"><forwardname="success"path="/zh.jsp"/></action><actionattribute="fylxForm"input="/fylxAdd.jsp"name="fylxForm"parameter="method"path="/fylx"scope="request"type=".thcic.demo.action.FylxAction"><forwardname="success"path="/fylx.jsp"/></action><actionattribute="clfsForm"input="/clfsadd.jsp"name="clfsForm"parameter="method"path="/clfs"scope="request"type=".thcic.demo.action.ClfsAction"><forwardname="success"path="/clfs.jsp"/></action><actionattribute="zhsqForm"input="/zhsq.jsp"parameter="method"name="zhsqForm"path="/zhsq"scope="request"type=".thcic.demo.action.ZhsqAction"><forwardname="success"path="/zhsq.jsp"/></action><actionattribute="cwUserForm"input="/cwUserAdd.jsp"name="cwUserForm"parameter="method"path="/cwUser"scope="request"type=".thcic.demo.action.CwUserAction"><forwardname="success"path="/user.jsp"/></action></action-mappings><message-resourcesparameter=".thcic.demo.ApplicationResources"/></struts-config>Web.xml<?xmlversion="1.0"encoding="UTF-8"?><web-app> <!--設(shè)置請求編碼過濾器--> <filter> <filter-name>EncodeFilter</filter-name> <filter-class>.thcic.demo.util.ReqEncodeFilter</filter-class> <init-param> <!--設(shè)置請求編碼類型--> <param-name>RequestEncode</param-name> <param-value>GBK</param-value> </init-param> </filter> <!--請求編碼過濾器與網(wǎng)址映射--> <filter-mapping> <filter-name>EncodeFilter</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping><servlet><servlet-name>action</servlet-name><servlet-class>org.apache.struts.action.ActionServlet</servlet-class><init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param><init-param><param-name>debug</param-name><param-value>3</param-value></init-param><init-param><param-name>detail</param-name><param-value>3</param-value></init-param><load-on-startup>0</load-on-startup></servlet><servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>//報銷明細(xì)的Actionpackage.thcic.demo.action;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts.action.ActionForm;importorg.apache.struts.action.ActionForward;importorg.apache.struts.action.ActionMapping;importorg.apache.struts.actions.DispatchAction;import.thcic.demo.bo.BxmxService;import.thcic.demo.bo.ClfsService;import.thcic.demo.bo.FylxService;import.thcic.demo.bo.ZhsqService;import.thcic.demo.form.BxmxForm;import.thcic.demo.vo.Bxmx;import.thcic.demo.vo.CwUser;publicclassBxmxActionextendsDispatchAction{ //報銷明細(xì)的列表 publicActionForwardlist(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ getListData(request); returnmapping.findForward("success"); }//獲得列表需要顯示的數(shù)據(jù) privatevoidgetListData(HttpServletRequestrequest){ BxmxServicebxmxService=newBxmxService(); ZhsqServicezhsqService=newZhsqService(); FylxServicefylxService=newFylxService(); ClfsServiceclfsService=newClfsService(); CwUseruser=(CwUser)request.getSession().getAttribute("user"); //找到當(dāng)前用戶有權(quán)限看到的所有報銷記錄 request.setAttribute("bxmxList",bxmxService.getUserBxmx(user)); //找到當(dāng)前用戶被授權(quán)的全部賬號 request.setAttribute("zhList",zhsqService.getUserZhList(user)); //費用類型列表 request.setAttribute("fylxList",fylxService.getAllFylxList()); //處理方式列表 request.setAttribute("clfsList",clfsService.getAllClfsList()); } //新加報銷明細(xì) publicActionForwardsaveOrUpdate(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ BxmxFormbxmxForm=(BxmxForm)form; //把form里的屬性賦值給mx實體 Bxmxmx=newBxmx(); if(bxmxForm.getId()!=null&&bxmxForm.getId().trim()!=""&&bxmxForm.getId().length()>0){ mx.setId(Long.parseLong(bxmxForm.getId())); } mx.setFylx(bxmxForm.getFylx()); mx.setJe(Double.parseDouble(bxmxForm.getJe())); mx.setBxsj(bxmxForm.getBxsj()); mx.setClfs(bxmxForm.getClfs()); mx.setBz(bxmxForm.getBz()); mx.setJbr(bxmxForm.getJbr()); mx.setJlr(((CwUser)request.getSession().getAttribute("user")).getUsername()); mx.setZh(bxmxForm.getZh()); mx.setZy(bxmxForm.getZy()); newBxmxService().saveOrUpdateClfs(mx); //做好返回數(shù)據(jù)準(zhǔn)備 this.getListData(request); bxmxForm.reset(mapping,request); returnmapping.findForward("success"); } //刪除報銷明細(xì) publicActionForwarddelete(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ BxmxServicebxmxService=newBxmxService(); Stringid=request.getParameter("id"); Bxmxmx=bxmxService.getBxmxById(id); bxmxService.delBxmx(mx); this.getListData(request); returnmapping.findForward("success"); } /** *編輯某條記錄 **/ publicActionForwardtoEdit(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ BxmxFormbxmxForm=(BxmxForm)form; BxmxServicebxmxService=newBxmxService(); Stringid=request.getParameter("id"); Bxmxmx=bxmxService.getBxmxById(id); bxmxForm.setBxsj(mx.getBxsj()); bxmxForm.setBz(mx.getBz()); bxmxForm.setClfs(mx.getClfs()); bxmxForm.setFylx(mx.getFylx()); bxmxForm.setId(String.valueOf(mx.getId())); bxmxForm.setJbr(mx.getJbr()); bxmxForm.setJe(String.valueOf(mx.getJe())); bxmxForm.setJlr(mx.getJlr()); bxmxForm.setZy(mx.getZy()); bxmxForm.setZh(mx.getZh()); this.getListData(request); returnmapping.findForward("success"); } }package.thcic.demo.action;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts.action.ActionForm;importorg.apache.struts.action.ActionForward;importorg.apache.struts.action.ActionMapping;importorg.apache.struts.actions.DispatchAction;import.thcic.demo.bo.ClfsService;import.thcic.demo.form.ClfsForm;import.thcic.demo.vo.Clfs;publicclassClfsActionextendsDispatchAction{ publicActionForwardlist(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ClfsFormclfsForm=(ClfsForm)form; ClfsServiceclfsService=newClfsService(); request.setAttribute("clfsList",clfsService.getAllClfsList()); returnmapping.findForward("success"); } publicActionForwardsaveOrUpdate(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ClfsFormclfsForm=(ClfsForm)form; ClfsServiceclfsService=newClfsService(); Clfsclfs=newClfs(); clfs.setClfs(clfsForm.getClfs()); if(clfsForm.getId()!=null&&clfsForm.getId().trim()!=""&&clfsForm.getId().length()>0){ clfs.setId(Long.parseLong(clfsForm.getId())); } clfsService.saveOrUpdateClfs(clfs); request.setAttribute("clfsList",clfsService.getAllClfsList()); clfsForm.reset(mapping,request); returnmapping.findForward("success"); } /** *編輯某條記錄 **/ publicActionForwardtoEdit(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ClfsFormclfsForm=(ClfsForm)form; ClfsServiceclfsService=newClfsService(); Stringid=request.getParameter("id"); Clfsclfs=clfsService.getClfsByID(id); clfsForm.setClfs(clfs.getClfs()); clfsForm.setId(String.valueOf(clfs.getId())); request.setAttribute("clfsList",clfsService.getAllClfsList()); returnmapping.findForward("success"); } publicActionForwarddelete(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ClfsFormclfsForm=(ClfsForm)form; ClfsServiceclfsService=newClfsService(); Stringid=request.getParameter("id"); Clfsclfs=clfsService.getClfsByID(id); clfsService.delClfs(clfs); request.setAttribute("clfsList",clfsService.getAllClfsList()); clfsForm.reset(mapping,request); returnmapping.findForward("success"); }}package.thcic.demo.action;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts.action.ActionForm;importorg.apache.struts.action.ActionForward;importorg.apache.struts.action.ActionMapping;importorg.apache.struts.actions.DispatchAction;import.thcic.demo.bo.UserService;import.thcic.demo.form.CwUserForm;import.thcic.demo.vo.CwUser;publicclassCwUserActionextendsDispatchAction{ //用戶列表 publicActionForwardlist(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ CwUserFormcwUserForm=(CwUserForm)form; UserServiceuserService=newUserService(); request.setAttribute("userList",userService.getUserList()); returnmapping.findForward("success"); } //新加用戶 publicActionForwardsaveOrUpdate(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ CwUserFormcwUserForm=(CwUserForm)form; UserServiceuserService=newUserService(); CwUseruser=newCwUser(); if(cwUserForm.getId()!=null&&cwUserForm.getId().trim()!=""&&cwUserForm.getId().length()>0){ user.setId(Long.parseLong(cwUserForm.getId())); } user.setUsername(cwUserForm.getUsername()); user.setRealname(cwUserForm.getRealname()); user.setRole(cwUserForm.getRole()); userService.saveOrUpdate(user); request.setAttribute("userList",userService.getUserList()); cwUserForm.reset(mapping,request); returnmapping.findForward("success"); } /** *編輯某條記錄 **/ publicActionForwardtoEdit(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ CwUserFormcwUserForm=(CwUserForm)form; UserServiceuserService=newUserService(); Stringid=request.getParameter("id"); CwUseruser=userService.getUserById(id); cwUserForm.setUsername(user.getUsername()); cwUserForm.setRealname(user.getRealname()); cwUserForm.setRole(user.getRole()); request.setAttribute("userList",userService.getUserList()); returnmapping.findForward("success"); } //刪除用戶 publicActionForwarddelete(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ CwUserFormcwUserForm=(CwUserForm)form; UserServiceuserService=newUserService(); Stringid=request.getParameter("id"); CwUseruser=userService.getUserById(id); userService.delUser(user); request.setAttribute("userList",userService.getUserList()); cwUserForm.reset(mapping,request); returnmapping.findForward("success"); }}package.thcic.demo.action;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts.action.ActionForm;importorg.apache.struts.action.ActionForward;importorg.apache.struts.action.ActionMapping;importorg.apache.struts.actions.DispatchAction;import.thcic.demo.bo.FylxService;import.thcic.demo.form.FylxForm;import.thcic.demo.vo.Fylx;publicclassFylxActionextendsDispatchAction{ publicActionForwardlist(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ FylxFormfylxForm=(FylxForm)form; getFylxList(request); returnmapping.findForward("success"); } privatevoidgetFylxList(HttpServletRequestrequest){ //獲得所有費用類型的列表 FylxServicefylxService=newFylxService(); request.setAttribute("fylxList",fylxService.getAllFylxList()); } publicActionForwardsaveOrUpdate(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ FylxFormfylxForm=(FylxForm)form; Fylxfylx=newFylx(); if(fylxForm.getId()!=null&&fylxForm.getId().trim()!=""&&fylxForm.getId().length()>0){ fylx.setId(Long.parseLong(fylxForm.getId())); } fylx.setFylx(fylxForm.getFylx()); fylx.setFylxsm(fylxForm.getFylxsm()); FylxServicefylxService=newFylxService(); fylxService.saveOrUpdate(fylx); getFylxList(request); returnmapping.findForward("success"); } publicActionForwarddelete(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ FylxFormfylxForm=(FylxForm)form; FylxServicefylxService=newFylxService(); Stringid=request.getParameter("id");Fylxfylx=fylxService.getFylxById(id) ; fylxService.delFylx(fylx); getFylxList(request); returnmapping.findForward("success"); } /** *編輯某條記錄 **/ publicActionForwardtoEdit(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ FylxFormfylxForm=(FylxForm)form; FylxServicefylxService=newFylxService(); Stringid=request.getParameter("id");Fylxfylx=fylxService.getFylxById(id) ;fylxForm.setFylx(fylx.getFylx());fylxForm.setFylxsm(fylx.getFylxsm());fylxForm.setId(String.valueOf(fylx.getId())); getFylxList(request); returnmapping.findForward("success"); }}package.thcic.demo.action;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts.action.Action;importorg.apache.struts.action.ActionForm;importorg.apache.struts.action.ActionForward;importorg.apache.struts.action.ActionMapping;import.thcic.demo.bo.UserService;import.thcic.demo.form.LoginForm;import.thcic.demo.vo.CwUser;publicclassLoginActionextendsAction{ publicActionForwardexecute(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ LoginFormloginForm=(LoginForm)form; UserServiceuserService=newUserService(); //構(gòu)造VO實體 CwUseruser=newCwUser(); user.setUsername(loginForm.getUsername()); user.setPassword(loginForm.getPassword()); if(userService.isCwUser(user)){ //如果是財務(wù)報銷系統(tǒng)的用戶,得到完整的用戶對象,裝入session request.getSession().setAttribute("user",userService.getCwUser(user)); returnmapping.findForward("loginSuccess"); }else{ request.getSession().setAttribute("errorMessage","登陸用戶名或密碼錯誤!"); returnmapping.findForward("loginError"); } }}package.thcic.demo.action;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts.action.ActionForm;importorg.apache.struts.action.ActionForward;importorg.apache.struts.action.ActionMapping;importorg.apache.struts.actions.DispatchAction;import.thcic.demo.bo.ZhService;import.thcic.demo.form.ZhForm;import.thcic.demo.vo.Zh;publicclassZhActionextendsDispatchAction{ publicActionForwardlist(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ZhFormzhForm=(ZhForm)form; ZhServicezhService=newZhService(); request.setAttribute("zhList",zhService.getAllZhList()); returnmapping.findForward("success"); } /** *賬號新加 **/ publicActionForwardsaveOrUpdate(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ZhFormzhForm=(ZhForm)form; ZhServicezhService=newZhService(); Zhzh=newZh(); zh.setBz(zhForm.getBz()); zh.setZh(zhForm.getZh()); zh.setZhfzr(zhForm.getZhfzr()); zh.setZhmc(zhForm.getZhmc()); zh.setZhzt(zhForm.getZhzt()); if(zhForm.getId()!=null&&zhForm.getId().trim()!=""&&zhForm.getId().length()>0){ zh.setId(Long.parseLong(zhForm.getId())); } zhService.saveOrUpdate(zh); request.setAttribute("zhList",zhService.getAllZhList()); zhForm.reset(mapping,request); returnmapping.findForward("success"); } /** *編輯某條記錄 **/ publicActionForwardtoEdit(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ZhFormzhForm=(ZhForm)form; ZhServicezhService=newZhService(); Stringid=request.getParameter("id"); Zhzh=zhService.getZhById(id); zhForm.setZh(zh.getZh()); zhForm.setId(String.valueOf(zh.getId())); zhForm.setZhfzr(zh.getZhfzr()); zhForm.setZhmc(zh.getZhmc()); zhForm.setZhzt(zh.getZhzt()); request.setAttribute("zhList",zhService.getAllZhList()); returnmapping.findForward("success"); } /** *賬號刪除 **/ publicActionForwarddelete(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ZhFormzhForm=(ZhForm)form; ZhServicezhService=newZhService(); Stringid=request.getParameter("id"); Zhzh=zhService.getZhById(id); zhService.delZh(zh); request.setAttribute("zhList",zhService.getAllZhList()); returnmapping.findForward("success"); } }package.thcic.demo.action;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts.action.ActionForm;importorg.apache.struts.action.ActionForward;importorg.apache.struts.action.ActionMapping;importorg.apache.struts.actions.DispatchAction;import.thcic.demo.bo.ZhService;import.thcic.demo.bo.ZhsqService;import.thcic.demo.form.ZhsqForm;import.thcic.demo.vo.Zhsq;publicclassZhsqActionextendsDispatchAction{ publicActionForwardlist(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ZhsqFormzhsqForm=(ZhsqForm)form; ZhsqServicezhsqService=newZhsqService(); ZhServicezhService=newZhService(); request.setAttribute("zhsqList",zhsqService.getZhsqList()); request.setAttribute("zhList",zhService.getAllZhList()); returnmapping.findForward("success"); } publicActionForwardsaveOrUpdate(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ZhsqFormzhsqForm=(ZhsqForm)form; ZhsqServicezhsqService=newZhsqService(); Zhsqzhsq=newZhsq(); if(zhsqForm.getId()!=null&&zhsqForm.getId().trim()!=""&&zhsqForm.getId().length()>0){ zhsq.setId(Long.parseLong(zhsqForm.getId())); } zhsq.setUsername(zhsqForm.getUsername()); zhsq.setZh(zhsqForm.getZh()); zhsqService.saveOrUpdate(zhsq); request.setAttribute("zhsqList",zhsqService.getZhsqList()); zhsqForm.reset(mapping,request); returnmapping.findForward("success"); } /** *編輯某條記錄 **/ publicActionForwardtoEdit(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ZhsqFormzhsqForm=(ZhsqForm)form; ZhsqServicezhsqService=newZhsqService(); Stringid=request.getParameter("id"); Zhsqzhsq=zhsqService.getZhsqByID(id); zhsqForm.setZh(zhsq.getZh()); zhsqForm.setId(String.valueOf(zhsq.getId())); zhsqForm.setUsername(zhsq.getUsername()); request.setAttribute("zhsqList",zhsqService.getZhsqList()); returnmapping.findForward("success"); } publicActionForwarddelete(ActionMappingmapping,ActionFormform, HttpServletRequestrequest,HttpServletResponseresponse){ ZhsqFormzhsqForm=(ZhsqForm)form; ZhsqServicezhsqService=newZhsqService(); Stringid=request.getParameter("id"); Zhsqzhsq=zhsqService.getZhsqByID(id); zhsqService.delZhsq(zhsq); request.setAttribute("zhsqList",zhsqService.getZhsqList()); returnmapping.findForward("success"); }}package.thcic.demo.bo;importjava.util.ArrayList;importjava.util.List;importorg.hibernate.Transaction;import.thcic.demo.dao.BxmxDAO;import.thcic.demo.vo.Bxmx;import.thcic.demo.vo.CwUser;import.thcic.demo.vo.Zhsq;publicclassBxmxService{ //返回某用戶所有可以看到的報銷明細(xì)記錄 publicList<Bxmx>getUserBxmx(CwUseruser){ List<Bxmx>bxmxList=newArrayList<Bxmx>(); BxmxDAObxmxDao=newBxmxDAO(); if(user.getRole().equals("財務(wù)主管")){ bxmxList=bxmxDao.findAll(); }else{ //先獲得該用戶所有被授權(quán)的賬號列表 ZhsqServicezhsqService=newZhsqService(); List<Zhsq>zhsqList=zhsqService.getUserZh(user.getUsername()); for(Zhsqsq:zhsqList){ Bxmxmx=newBxmx(); mx.setZh(sq.getZh()); //找到每個賬號的報銷明細(xì),添加到返回列表中 List<Bxmx>mxList=bxmxDao.findByExample(mx); for(Bxmxbxmx:mxList){ bxmxList.add(bxmx); } } } returnbxmxList; } // //新增一個報銷明細(xì)記錄// publicvoidaddBxmx(Bxmxmx){// BxmxDAOmxDao=newBxmxDAO();// Transactiontran=null;// try{// tran=mxDao.getSession().beginTransaction();// mxDao.save(mx);// mxDao.getSession().flush();// mit();// }catch(Exceptione){// e.printStackTrace();// }// } //刪除一個報銷明細(xì)記錄 publicvoiddelBxmx(Bxmxmx){ BxmxDAOmxDao=newBxmxDAO(); Transactiontran=null; try{ tran=mxDao.getSession().beginTransaction(); mxDao.delete(mx); mxDao.getSession().flush(); mit(); }catch(Exceptione){ e.printStackTrace(); } } //添加或者修改一條記錄 publicvoidsaveOrUpdateClfs(Bxmxbxmx){ BxmxDAOmxDao=newBxmxDAO(); Transactiontran=null; try{ tran=mxDao.getSession().beginTransaction(); if(bxmx.getId()==null||bxmx.getId()==0){ mxDao.save(bxmx); }else{ mxDao.getSession().clear(); mxDao.update(bxmx); } mxDao.getSession().flush(); mit(); }catch(Exceptione){ e.printStackTrace(); } } /** *根據(jù)ID獲得一個報銷記錄
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 軟件安全人才隊伍建設(shè)研究-詳解洞察
- 梧州2025年廣西梧州市事業(yè)單位招聘1257人筆試歷年參考題庫附帶答案詳解
- 2025年中國塑鋼垂簾軌市場調(diào)查研究報告
- 2025年針織橫機配件項目可行性研究報告
- 廣州廣東廣州市花都區(qū)花山鎮(zhèn)和郁小學(xué)臨聘教師招聘筆試歷年參考題庫附帶答案詳解
- 廣東廣東海洋大學(xué)后勤保障部招聘非編制水電維修工(第二次)筆試歷年參考題庫附帶答案詳解
- 2025年球衣網(wǎng)布項目可行性研究報告
- 2025年水電解器架項目可行性研究報告
- 2025至2031年中國旋風(fēng)式二級回收裝置行業(yè)投資前景及策略咨詢研究報告
- 2025年抗菌防霉乳膠漆項目可行性研究報告
- 學(xué)校小賣部承包合同范文
- 普外腹腔鏡手術(shù)護(hù)理常規(guī)
- 2025年湖南鐵道職業(yè)技術(shù)學(xué)院高職單招職業(yè)技能測試近5年??及鎱⒖碱}庫含答案解析
- 2024年全國職業(yè)院校技能大賽(礦井災(zāi)害應(yīng)急救援賽項)考試題庫(含答案)
- 《預(yù)制高強混凝土風(fēng)電塔筒生產(chǎn)技術(shù)規(guī)程》文本附編制說明
- 2025年浙江省溫州樂清市融媒體中心招聘4人歷年高頻重點提升(共500題)附帶答案詳解
- 2025年煤礦探放水證考試題庫
- 監(jiān)控系統(tǒng)調(diào)試檢驗批質(zhì)量驗收記錄(新表)
- 建筑工程冬期施工規(guī)程JGJT1042011
- 變頻器變頻altivar71說明書
- 室外晾衣架施工方案(共8頁)
評論
0/150
提交評論