ofbiz实战——学生预约申请管理界面以及代码

学生预约申请管理是该项目的核心功能模块,该功能模块需求分为管理员需求和学生需求。

管理员角色功能需求:查询学生预约申请,审核预约,考勤管理。

学生角色需求:预约实验室项目,取消预约,查看我的预约。

返回导航页

学生预约申请查询界面:


管理员单个审核界面:


管理员批量审核界面:


管理员批量考勤界面:


学生预约申请查询界面:


学生取消预约申请界面:


学生查看我的预约界面:


StuBatchScreens.xml

<?xml version="1.0" encoding="UTF-8"?>
<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://ofbiz.apache.org/Widget-Screen" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Screen http://ofbiz.apache.org/dtds/widget-screen.xsd">
	<screen name="FindStuBatch">
        <section>
            <actions>
                <set field="titleProperty" value="StuBatchManange"/>
				<set field="headerItem" value="StuBatchManange"/>
                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <property-to-field resource="widget" property="widget.form.defaultViewSize" field="viewSizeDefaultValue"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonBookingDecorator" location="component://booking/widget/booking/CommonScreens.xml">
                    <decorator-section name="body">
                        <section>
                            <widgets>
                                <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
                                    <decorator-section name="menu-bar">
                                        <container style="button-bar">
											<include-form name="FindStuBatchBar" location="component://booking/widget/booking/StuBatchForms.xml"/>
											 <!-- 
											<platform-specific>
												<html><html-template location="component://booking/template/booking/ModifyTable.ftl"/></html>
											</platform-specific>  
		
										 
										   <link target="AuditingStuBatchList" text="${uiLabelMap.AuditingStuBatchList}" style="buttontext" target-type="layered-modal"/> 
											<hyperlink description="${uiLabelMap.AuditingStuBatchList}" target="javascript:AuditingStuBatchList()"  also-hidden="false" link-type="layered-modal"/>  
											-->
                                        </container>
										
                                    </decorator-section>
                                    <decorator-section name="search-options">
                                        <include-form name="FindStuBatch" location="component://booking/widget/booking/StuBatchForms.xml"/>
                                    </decorator-section>
                                    <decorator-section name="search-results">
                                        <include-form name="ListFindStuBatch" location="component://booking/widget/booking/StuBatchForms.xml"/>
                                    </decorator-section>
                                </decorator-screen>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
	<screen name="EditStuBatch">
        <section>
            <actions>
                <set field="titleProperty" value="StuBatchManange"/>
                <set field="headerItem" value="StuBatchManange"/>
				<entity-one entity-name="StuBatch" value-field="StuBatch"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonBookingDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
						<container style="button-bar">
							<link target="FindStuBatch" text="${uiLabelMap.CommonBack}" style="buttontext"/>
						</container>
                        <screenlet title="${groovy: parameters.StuBatchId ? uiLabelMap.CommonEdit : uiLabelMap.CommonAdd}">
                            <include-form name="EditStuBatch" location="component://booking/widget/booking/StuBatchForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
	
	<screen name="AuditingStuBatch">
        <section>
            <actions>
                <set field="titleProperty" value="StuBatchManange"/>
                <set field="headerItem" value="StuBatchManange"/>
				<entity-one entity-name="StuBatch" value-field="stuBatch"/>
				<entity-one entity-name="Student" value-field="student">
					<field-map field-name="stuId" from-field="stuBatch.stuId"/>
				</entity-one>
				<entity-one entity-name="LabProjectBatch" value-field="batch">
					<field-map field-name="batchId" from-field="stuBatch.batchId"/>
				</entity-one>
				<entity-one entity-name="LabProject" value-field="pro">
					<field-map field-name="proId" from-field="batch.proId"/>
				</entity-one>
				<entity-one entity-name="Teacher" value-field="teacher">
					<field-map field-name="tchId" from-field="batch.tchId"/>
				</entity-one>
            </actions>
            <widgets>
                <decorator-screen name="CommonBookingDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
						<container style="button-bar">
							<link target="FindStuBatch" text="${uiLabelMap.CommonBack}" style="buttontext"/>
						</container>
                        <screenlet title="${groovy: parameters.StuBatchId ? uiLabelMap.CommonEdit : uiLabelMap.CommonAdd}">
                            <include-form name="AuditingStuBatch" location="component://booking/widget/booking/StuBatchForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

	
	<screen name="FindBatchForStudent">
        <section>
            <actions>
                <set field="titleProperty" value="BookingLab"/>
				<set field="headerItem" value="BookingLab"/>
                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <property-to-field resource="widget" property="widget.form.defaultViewSize" field="viewSizeDefaultValue"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>
				
            </actions>
            <widgets>
                <decorator-screen name="CommonBookingDecorator" location="component://booking/widget/booking/CommonScreens.xml">
                    <decorator-section name="body">
                        <section>
                            <widgets>
                                <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
                                    <decorator-section name="menu-bar">
                                        <container style="button-bar">
                                            <!--<link target="EditLabProjectBatch" text="${uiLabelMap.EditLabProjectBatch}" style="buttontext"/>-->
                                        </container>
                                    </decorator-section>
                                    <decorator-section name="search-options">
                                        <include-form name="FindBatchForStudent" location="component://booking/widget/booking/StuBatchForms.xml"/>
                                    </decorator-section>
                                    <decorator-section name="search-results">
                                        <include-form name="ListFindBatchForStudent" location="component://booking/widget/booking/StuBatchForms.xml"/>
                                    </decorator-section>
                                </decorator-screen>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
	
	<screen name="FindBookingInReview">
        <section>
            <actions>
                <set field="titleProperty" value="InReview"/>
				<set field="headerItem" value="InReview"/>
                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <property-to-field resource="widget" property="widget.form.defaultViewSize" field="viewSizeDefaultValue"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>
				
            </actions>
            <widgets>
                <decorator-screen name="CommonBookingDecorator" location="component://booking/widget/booking/CommonScreens.xml">
                    <decorator-section name="body">
                        <section>
                            <widgets>
                                <decorator-screen name="FindNoSearchScreenDecorator" location="component://booking/widget/booking/CommonScreens.xml">
                                    <decorator-section name="menu-bar">
                                        <container style="button-bar">
                                            <!--<link target="EditLabProjectBatch" text="${uiLabelMap.EditLabProjectBatch}" style="buttontext"/>-->
                                        </container>
                                    </decorator-section>
                                    <decorator-section name="search-results">
										<screenlet title="${uiLabelMap.InReview}">
											<include-form name="ListFindBookingInReview" location="component://booking/widget/booking/StuBatchForms.xml"/>
										</screenlet>
                                        
                                    </decorator-section>
                                </decorator-screen>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
	<screen name="FindMyBooking">
        <section>
            <actions>
                <set field="titleProperty" value="MyBooking"/>
				<set field="headerItem" value="MyBooking"/>
                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <property-to-field resource="widget" property="widget.form.defaultViewSize" field="viewSizeDefaultValue"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>
				
            </actions>
			<widgets>
                <decorator-screen name="CommonBookingDecorator" location="component://booking/widget/booking/CommonScreens.xml">
                    <decorator-section name="body">
                        <section>
                            <widgets>
                                <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
                                    <decorator-section name="menu-bar">
                                        <container style="button-bar">
                                            <!--<link target="EditStuBatch" text="${uiLabelMap.EditStuBatch}" style="buttontext"/>-->
                                        </container>
                                    </decorator-section>
                                    <decorator-section name="search-options">
                                        <include-form name="FindMyBooking" location="component://booking/widget/booking/StuBatchForms.xml"/>
                                    </decorator-section>
                                    <decorator-section name="search-results">
                                        <include-form name="ListFindMyBooking" location="component://booking/widget/booking/StuBatchForms.xml"/>
                                    </decorator-section>
                                </decorator-screen>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
	<screen name="EditAuditingResult">
        <section>
            <actions>
				<property-map resource="BookingUiLabels" map-name="uiLabelMap" global="true"/>
            </actions>
			<widgets>
                <platform-specific>
					<html><html-template location="component://booking/template/booking/AuditingStuBatchList.ftl"/></html>
				</platform-specific>  
            </widgets>
        </section>
    </screen>
	
	
	<screen name="BookingAttendanceManange">
        <section>
            <actions>
                <set field="titleProperty" value="BookingAttendanceManange"/>
				<set field="headerItem" value="BookingAttendanceManange"/>
                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <property-to-field resource="widget" property="widget.form.defaultViewSize" field="viewSizeDefaultValue"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonBookingDecorator" location="component://booking/widget/booking/CommonScreens.xml">
                    <decorator-section name="body">
                        <section>
                            <widgets>
                                <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
                                    <decorator-section name="menu-bar">
                                        <container style="button-bar">
											<platform-specific>
												<html><html-template location="component://booking/template/booking/BookingAttendanceBar.ftl"/></html>
											</platform-specific>  
                                        </container>
                                    </decorator-section>
                                    <decorator-section name="search-options">
                                        <include-form name="BookingAttendanceManange" location="component://booking/widget/booking/StuBatchForms.xml"/>
                                    </decorator-section>
                                    <decorator-section name="search-results">
                                        <include-form name="ListBookingAttendanceManange" location="component://booking/widget/booking/StuBatchForms.xml"/>
                                    </decorator-section>
                                </decorator-screen>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
</screens>

StuBatchForms.xml

<?xml version="1.0" encoding="UTF-8"?>
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">
    <form name="FindStuBatchBar" target="FindStuBatchBar" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table" >
		<field name="test" title=" " widget-style="buttontext">
			<hyperlink description="${uiLabelMap.AuditingStuBatchList}" target="EditAuditingResult"  also-hidden="false" link-type="layered-modal"/>
		</field>
    </form>
    <form name="FindStuBatch" target="FindStuBatch" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
		<field name="stuId" title="${uiLabelMap.BookingStudentStuId}"><lookup target-form-name="LookupStudent"/></field>  
		<field name="courseId" title="${uiLabelMap.BookingCourseId}"><lookup target-form-name="LookupCourse"/></field>
		<field name="proId" title="${uiLabelMap.BookingLabProjectId}"><lookup target-form-name="LookupLabProject"/></field>
		<field name="termName" title="${uiLabelMap.TermTermName}"><lookup target-form-name="LookupTerm"/></field>
		<field name="tchId" title="${uiLabelMap.BookingTeacherTchId}"><lookup target-form-name="LookupTeacher"/></field>
		<field name="address" title="${uiLabelMap.BookingLabProjectBatchAddress}"><text-find/></field>
		<field name="capacity" title="${uiLabelMap.BookingLabProjectBatchCapacity}"><text-find/></field>
		<field name="date" title="${uiLabelMap.BookingLabProjectBatchDate}"><date-find type="date" /></field>
        <field name="applyDate" title="${uiLabelMap.BookingStuBatchDate}"><date-find type="date-time" /></field>
		<field name="result" title="${uiLabelMap.BookingStuBatchResult}">
            <!--<drop-down allow-empty="true" no-current-selected-key="wait" >   no-current-selected-key 属性对查询条件无效-->
			<drop-down allow-empty="true"  >
				<option key="wait" description="${uiLabelMap.BookingStuBatchResultNULL}"/>
				<option key="Y" description="${uiLabelMap.BookingStuBatchResultY}"/>
                <option key="N" description="${uiLabelMap.BookingStuBatchResultN}"/>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit/>
		</field>		
    </form>

    <form name="ListFindStuBatch" list-name="listIt" title="" type="list" paginate-target="FindStuBatch"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
            <service service-name="performFind" result-map="result" result-map-list="listIt">
                <field-map field-name="inputFields" from-field="requestParameters"/>
                <field-map field-name="entityName" value="StuBatchAndLabProBach"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
				<field-map field-name="orderBy" from-field="applyDate DESC"/>
				<field-map field-name="noConditionFind" value="Y"/>
            </service>
        </actions>
		<row-actions>
            <entity-one entity-name="Student" value-field="student"/>
            <entity-one entity-name="LabProjectBatch" value-field="batch">
                <field-map field-name="batchId" from-field="batchId"/>
            </entity-one>
        </row-actions>
		<field name="stuBatchId" title=" ">
			<check all-checked="true">
				<option key="${groovy: stuId + ','+ batchId+','+ applyDate}" description=" "/>
				<!--<list-options  />-->
			</check>
		</field>
		
		<field name="stuNumber" title="${uiLabelMap.BookingStudentStuNumber}"><display description="${student.stuNumber}"/></field>
		<field name="stuName" title="${uiLabelMap.BookingStudentName}"><display description="${student.name}"/></field>
		
		<field name="batchId" title="${uiLabelMap.BookingLabProjectBatchId}"><display/></field>
		<field name="courseName" title="${uiLabelMap.BookingCourseName}"><display/></field>
		<field name="proName" title="${uiLabelMap.BookingLabProjectName}"><display/></field>
		<field name="termName" title="${uiLabelMap.TermTermName}"><display/></field>
		<field name="tchName" title="${uiLabelMap.BookingTeacherName}"><display/></field>
		<field name="address" title="${uiLabelMap.BookingLabProjectBatchAddress}"><display/></field>
		<field name="capacity" title="${uiLabelMap.BookingLabProjectBatchCapacity}"><display/></field>
		<field name="bookingTotalNums" title="${uiLabelMap.BookingTotalNums}"><display/></field>
		<field name="bookingPassNums" title="${uiLabelMap.BookingPassNums}"><display/></field>
		<field name="date" title="${uiLabelMap.BookingLabProjectBatchDate}"><display/></field>
		<field name="classNO" title="${uiLabelMap.BookingLabProjectBatchClassNO}"><display/></field>
		
		
		<field name="batchId" title="${uiLabelMap.BookingLabProjectBatchId}"><display/></field>
		<field name="applyDate" title="${uiLabelMap.BookingStuBatchDate}"><display/></field>
		<field name="result" title="${uiLabelMap.BookingStuBatchResult}">
			<display description="${groovy: result == 'Y' ? uiLabelMap.BookingStuBatchResultY : (result == 'N' ? uiLabelMap.BookingStuBatchResultN : uiLabelMap.BookingStuBatchResultNULL)}"/>
		</field>
		<field name="reason" title="${uiLabelMap.BookingStuBatchReason}"><display/></field>
		
		<field name="updateLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.BookingStuBatchAuditing}" target="AuditingStuBatch" >
                <parameter param-name="stuId"/>
				<parameter param-name="batchId"/>
				<parameter param-name="date" from-field="applyDate"/>
            </hyperlink>
        </field>    
    </form>
	
	<form name="EditStuBatch" target="updateStuBatch" title="" type="single" header-row-style="header-row" 
		default-table-style="basic-table" default-map-name="StuBatch" default-entity-name="StuBatch">
		<alt-target use-when="StuBatch==null" target="createStuBatch"/>
		<auto-fields-service service-name="updateStuBatch" map-name=""/>
		<field use-when="StuBatch!=null" name="StuId" title="${uiLabelMap.StuBatchStuBatchId}" tooltip="${uiLabelMap.BookingNotModification}." ><display/></field>
        
        
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}">
			<submit/>
		</field>
    </form>
	
	<form name="AuditingStuBatch" target="updateStuBatch" title="" type="single" header-row-style="header-row" 
		default-table-style="basic-table" default-map-name="stuBatch" default-entity-name="StuBatch">
		<!--<auto-fields-service service-name="updateStuBatch" map-name=""/>-->
		
		
		<field name="stuId" title="${uiLabelMap.BookingStudentStuId}" tooltip="${student.name}" ><display/></field>
		<field name="batchId" title="${uiLabelMap.BookingLabProjectBatchId}" ><display/></field>
		<field name="proName" title="${uiLabelMap.BookingLabProjectName}" ><display description="${pro.proName}"/></field>
		<field name="teacherName" title="${uiLabelMap.BookingTeacherName}" ><display description="${teacher.name}"/></field>
		<field name="date" title="${uiLabelMap.BookingStuBatchDate}" ><display/></field>
		<field name="result" title="${uiLabelMap.BookingStuBatchResult}">
            <drop-down allow-empty="true" >
				<option key="Y" description="${uiLabelMap.BookingStuBatchResultY}"/>
                <option key="N" description="${uiLabelMap.BookingStuBatchResultN}"/>
            </drop-down>
        </field>
		<field name="reason" title="${uiLabelMap.BookingStuBatchReason}" ><text size="20" maxlength="20" /></field>
			
        
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}">
			<submit/>
		</field>
    </form>
	
	<form name="FindBatchForStudent" target="FindBatchForStudent" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
		<field name="courseId" title="${uiLabelMap.BookingCourseId}"><lookup target-form-name="LookupCourse"/></field>
		<field name="proId" title="${uiLabelMap.BookingLabProjectId}"><lookup target-form-name="LookupLabProject"/></field>
		<field name="tchId" title="${uiLabelMap.BookingTeacherTchId}"><lookup target-form-name="LookupTeacher"/></field>
		<field name="address" title="${uiLabelMap.BookingLabProjectBatchAddress}"><text-find/></field>
		<field name="capacity" title="${uiLabelMap.BookingLabProjectBatchCapacity}"><text-find/></field>
		<field name="date" title="${uiLabelMap.BookingLabProjectBatchDate}"><date-find type="date" /></field>
		<field name="classNO" title="${uiLabelMap.BookingLabProjectBatchClassNO}"><text-find/></field>
        <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit/></field>
    </form>

    <form name="ListFindBatchForStudent" list-name="listIt" title="" type="list" paginate-target="FindBatchForStudent"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
			<set field="requestParameters.asured" value="Y"/>
            <service service-name="performFind" result-map="result" result-map-list="listIt">
                <field-map field-name="inputFields" from-field="requestParameters"/>
                <field-map field-name="entityName" value="LabProjectBatchAndLabProjectAndTeacher"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
				<field-map field-name="orderBy" value="date DESC"/>
				<field-map field-name="noConditionFind" value="Y"/>
            </service>
        </actions>
		<field name="batchId" title="${uiLabelMap.BookingLabProjectBatchId}"><display/></field>
		<field name="courseName" title="${uiLabelMap.BookingCourseName}"><display/></field>
		<field name="proName" title="${uiLabelMap.BookingLabProjectName}"><display/></field>
		<field name="tchName" title="${uiLabelMap.BookingTeacherName}"><display/></field>
		<field name="address" title="${uiLabelMap.BookingLabProjectBatchAddress}"><display/></field>
		<field name="capacity" title="${uiLabelMap.BookingLabProjectBatchCapacity}"><display/></field>
		<field name="bookingTotalNums" title="${uiLabelMap.BookingTotalNums}"><display/></field>
		<field name="bookingPassNums" title="${uiLabelMap.BookingPassNums}"><display/></field>
		<field name="date" title="${uiLabelMap.BookingLabProjectBatchDate}"><display/></field>
		<field name="classNO" title="${uiLabelMap.BookingLabProjectBatchClassNO}"><display/></field>
		<!--<field name="asured" title="${uiLabelMap.BookingLabProjectBatchAsured}"><display/></field>-->
		<field name="updateLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.BookingBooking}" target="BookingBatch" >
                <parameter param-name="batchId"/>
				<parameter param-name="proName"/>
            </hyperlink>
        </field>    
    </form>
	
	<form name="ListFindBookingInReview" list-name="listIt" title="" type="list" 
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
		<actions>
			<!--<set field="requestParameters.result_op" value="empty"/>-->
			<set field="requestParameters.result" value="wait"/>
			<set field="requestParameters.stuId" from-field="userLogin.userLoginId"/>
            <service service-name="performFind" result-map="result" result-map-list="listIt">
                <field-map field-name="inputFields" from-field="requestParameters"/>
                <field-map field-name="entityName" value="StuBatchAndLabProBach"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
				<field-map field-name="noConditionFind" value="Y"/>
            </service>
        </actions>		

		<field name="batchId" title="${uiLabelMap.BookingLabProjectBatchId}"><display/></field>
		<field name="courseName" title="${uiLabelMap.BookingCourseName}"><display/></field>
		<field name="proName" title="${uiLabelMap.BookingLabProjectName}"><display/></field>
		<field name="termName" title="${uiLabelMap.TermTermName}"><display/></field>
		<field name="tchName" title="${uiLabelMap.BookingTeacherName}"><display/></field>
		<field name="address" title="${uiLabelMap.BookingLabProjectBatchAddress}"><display/></field>
		<field name="capacity" title="${uiLabelMap.BookingLabProjectBatchCapacity}"><display/></field>
		<field name="bookingTotalNums" title="${uiLabelMap.BookingTotalNums}"><display/></field>
		<field name="bookingPassNums" title="${uiLabelMap.BookingPassNums}"><display/></field>
		<field name="date" title="${uiLabelMap.BookingLabProjectBatchDate}"><display/></field>
		<field name="classNO" title="${uiLabelMap.BookingLabProjectBatchClassNO}"><display/></field>
		
	
		<field name="applyDate" title="${uiLabelMap.BookingStuBatchDate}"><display/></field>

		<field name="reason" title="${uiLabelMap.BookingStuBatchReason}"><display/></field>		
		<field name="updateLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.BookingBookingCancel}" target="deleteStuBatch" >
                <parameter param-name="stuId"/>
				<parameter param-name="batchId"/>
				<parameter param-name="date" from-field="applyDate"/>
            </hyperlink>
        </field>       
    </form>
	
	<form name="FindMyBooking" target="FindMyBooking" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
		<field name="courseId" title="${uiLabelMap.BookingCourseId}"><lookup target-form-name="LookupCourse"/></field>
		<field name="proId" title="${uiLabelMap.BookingLabProjectId}"><lookup target-form-name="LookupLabProject"/></field>
		<field name="termName" title="${uiLabelMap.TermTermName}"><lookup target-form-name="LookupTerm"/></field>
		<field name="tchId" title="${uiLabelMap.BookingTeacherTchId}"><lookup target-form-name="LookupTeacher"/></field>
		<field name="address" title="${uiLabelMap.BookingLabProjectBatchAddress}"><text-find/></field>
		<field name="capacity" title="${uiLabelMap.BookingLabProjectBatchCapacity}"><text-find/></field>
		<field name="date" title="${uiLabelMap.BookingLabProjectBatchDate}"><date-find type="date" /></field>
        <field name="applyDate" title="${uiLabelMap.BookingStuBatchDate}"><date-find type="date-time" /></field>
		<field name="result" title="${uiLabelMap.BookingStuBatchResult}">
            <drop-down allow-empty="true" >
				<option key="wait" description="${uiLabelMap.BookingStuBatchResultNULL}"/>
				<option key="Y" description="${uiLabelMap.BookingStuBatchResultY}"/>
                <option key="N" description="${uiLabelMap.BookingStuBatchResultN}"/>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit/></field>
    </form>
	
	<form name="ListFindMyBooking" list-name="listIt" title="" type="list" paginate-target="FindMyBooking"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
		<actions>
		<!--
			<script location="component://booking/groovyScripts/ResultYN.groovy" />
			<set field="requestParameters.result" from-field="resultYN"/>
			-->
			<set field="requestParameters.stuId" from-field="userLogin.userLoginId"/>
            <service service-name="performFind" result-map="result" result-map-list="listIt">
                <field-map field-name="inputFields" from-field="requestParameters"/>
                <field-map field-name="entityName" value="StuBatchAndLabProBach"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
				<field-map field-name="orderBy" from-field="applyDate DESC"/>
				<field-map field-name="noConditionFind" value="Y"/>
            </service>
        </actions>

		<field name="batchId" title="${uiLabelMap.BookingLabProjectBatchId}"><display/></field>
		<field name="courseName" title="${uiLabelMap.BookingCourseName}"><display/></field>
		<field name="proName" title="${uiLabelMap.BookingLabProjectName}"><display/></field>
		<field name="termName" title="${uiLabelMap.TermTermName}"><display/></field>
		<field name="tchName" title="${uiLabelMap.BookingTeacherName}"><display/></field>
		<field name="address" title="${uiLabelMap.BookingLabProjectBatchAddress}"><display/></field>
		<field name="capacity" title="${uiLabelMap.BookingLabProjectBatchCapacity}"><display/></field>
		<field name="bookingTotalNums" title="${uiLabelMap.BookingTotalNums}"><display/></field>
		<field name="bookingPassNums" title="${uiLabelMap.BookingPassNums}"><display/></field>
		<field name="date" title="${uiLabelMap.BookingLabProjectBatchDate}"><display/></field>
		<field name="classNO" title="${uiLabelMap.BookingLabProjectBatchClassNO}"><display/></field>
		
		<field name="applyDate" title="${uiLabelMap.BookingStuBatchDate}"><display/></field>

		<field name="result" title="${uiLabelMap.BookingStuBatchResult}">
			<display description="${groovy: result == 'Y' ? uiLabelMap.BookingStuBatchResultY : (result == 'N' ? uiLabelMap.BookingStuBatchResultN : uiLabelMap.BookingStuBatchResultNULL)}"/>
		</field>
		<field name="reason" title="${uiLabelMap.BookingStuBatchReason}"><display/></field>		


    </form>
	
	
	
	<form name="BookingAttendanceManange" target="BookingAttendanceManange" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
		<field name="stuId" title="${uiLabelMap.BookingStudentStuId}"><lookup target-form-name="LookupStudent"/></field>  
		<field name="courseId" title="${uiLabelMap.BookingCourseId}"><lookup target-form-name="LookupCourse"/></field>
		<field name="proId" title="${uiLabelMap.BookingLabProjectId}"><lookup target-form-name="LookupLabProject"/></field>
		<field name="termName" title="${uiLabelMap.TermTermName}"><lookup target-form-name="LookupTerm"/></field>
		<field name="tchId" title="${uiLabelMap.BookingTeacherTchId}"><lookup target-form-name="LookupTeacher"/></field>
		<field name="address" title="${uiLabelMap.BookingLabProjectBatchAddress}"><text-find/></field>
		<field name="capacity" title="${uiLabelMap.BookingLabProjectBatchCapacity}"><text-find/></field>
		<field name="date" title="${uiLabelMap.BookingLabProjectBatchDate}"><date-find type="date" /></field>
        <field name="applyDate" title="${uiLabelMap.BookingStuBatchDate}"><date-find type="date-time" /></field>

		<field name="attendance" title="${uiLabelMap.BookingStuBatchAttendance}">
            <drop-down allow-empty="true">
				<option key="wait" description="${uiLabelMap.BookingStuBatchResultNULL}"/>
				<option key="Y" description="${uiLabelMap.BookingStuBatchResultY}"/>
                <option key="N" description="${uiLabelMap.BookingStuBatchResultN}"/>
            </drop-down>
        </field>

        <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit/>
		</field>		
    </form>

    <form name="ListBookingAttendanceManange" list-name="listIt" title="" type="list" paginate-target="BookingAttendanceManange"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
			<set field="requestParameters.result" value="Y"/>
            <service service-name="performFind" result-map="result" result-map-list="listIt">
                <field-map field-name="inputFields" from-field="requestParameters"/>
                <field-map field-name="entityName" value="StuBatchAndLabProBach"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
				<field-map field-name="orderBy" from-field="applyDate DESC"/>
				<field-map field-name="noConditionFind" value="Y"/>
            </service>
        </actions>
		<row-actions>
            <entity-one entity-name="Student" value-field="student"/>
            <entity-one entity-name="LabProjectBatch" value-field="batch">
                <field-map field-name="batchId" from-field="batchId"/>
            </entity-one>
        </row-actions>
		<field name="stuBatchId" title=" ">
			<check all-checked="true">
				<option key="${groovy: stuId + ','+ batchId+','+ applyDate}" description=" "/>
				<!--<list-options  />-->
			</check>
		</field>
		
		<field name="stuNumber" title="${uiLabelMap.BookingStudentStuNumber}"><display description="${student.stuNumber}"/></field>
		<field name="stuName" title="${uiLabelMap.BookingStudentName}"><display description="${student.name}"/></field>
		
		<field name="batchId" title="${uiLabelMap.BookingLabProjectBatchId}"><display/></field>
		<field name="courseName" title="${uiLabelMap.BookingCourseName}"><display/></field>
		<field name="proName" title="${uiLabelMap.BookingLabProjectName}"><display/></field>
		<field name="termName" title="${uiLabelMap.TermTermName}"><display/></field>
		<field name="tchName" title="${uiLabelMap.BookingTeacherName}"><display/></field>
		<field name="address" title="${uiLabelMap.BookingLabProjectBatchAddress}"><display/></field>
		<field name="capacity" title="${uiLabelMap.BookingLabProjectBatchCapacity}"><display/></field>
		<field name="bookingTotalNums" title="${uiLabelMap.BookingTotalNums}"><display/></field>
		<field name="bookingPassNums" title="${uiLabelMap.BookingPassNums}"><display/></field>
		<field name="date" title="${uiLabelMap.BookingLabProjectBatchDate}"><display/></field>
		<field name="classNO" title="${uiLabelMap.BookingLabProjectBatchClassNO}"><display/></field>
		
		
		<field name="batchId" title="${uiLabelMap.BookingLabProjectBatchId}"><display/></field>
		<field name="applyDate" title="${uiLabelMap.BookingStuBatchDate}"><display/></field>
		<field name="result" title="${uiLabelMap.BookingStuBatchResult}">
			<display description="${groovy: result == 'Y' ? uiLabelMap.BookingStuBatchResultY : (result == 'N' ? uiLabelMap.BookingStuBatchResultN : uiLabelMap.BookingStuBatchResultNULL)}"/>
		</field>
		<field name="reason" title="${uiLabelMap.BookingStuBatchReason}"><display/></field>
		
		<field name="attendance" title="${uiLabelMap.BookingStuBatchAttendance}">
			<display description="${groovy: attendance == 'Y' ? uiLabelMap.BookingStuBatchAttendanceY : (attendance == 'N' ? uiLabelMap.BookingStuBatchAttendanceN : uiLabelMap.BookingStuBatchAttendanceNULL)}"/>
		</field>
		<!--
		<field use-when="headerItem=='StuBatchManange'" name="updateLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.BookingStuBatchAuditing}" target="AuditingStuBatch" >
                <parameter param-name="stuId"/>
				<parameter param-name="batchId"/>
				<parameter param-name="date" from-field="applyDate"/>
            </hyperlink>
        </field>  
		-->		
    </form>
</forms>


管理员批量审核AuditingStuBatchList.ftl:

<script  type="text/javascript">
function EditBookingAttendance(obj)
{
	var stuBatchIds = [];
	var stuBatchId_cks = $("input[name='stuBatchId']:checked");
	$("#div_AuditingStuBatchList").html("");
	var stuBatchIds = new Array();  
	stuBatchId_cks.each(function(){  
		stuBatchIds.push($(this).val());  
		$("#div_AuditingStuBatchList").append($('<input type="hidden" name="stuBatchIds" value="'+$(this).val()+'" />'))
	});  
	if(obj == "Y"){
		$("#div_AuditingStuBatchList").append($('<input type="hidden" name="attendance" value="Y" />'))
	}
	else{
		$("#div_AuditingStuBatchList").append($('<input type="hidden" name="attendance" value="N" />'))
	}
	$("#EditBookingAttendanceForm").submit()
	/*
	$.ajax({  
		type:'post',  
		traditional :true,  
		url:'AuditingStuBatchList',  
		data:{'stuBatchIds':stuBatchIds},  
		success:function(data){  
			alert("test")
		}  
	});  
	*/
}
</script>
<form method="post" action="/booking/control/EditBookingAttendance" id="EditBookingAttendanceForm" class="basic-form" οnsubmit="javascript:submitFormDisableSubmits(this)" name="EditBookingAttendanceForm" novalidate="novalidate">
  <div style="display:none" id="div_AuditingStuBatchList">
  </div>
	<a class="buttontext" href="javascript:EditBookingAttendance('Y')">${uiLabelMap.EditBookingAttendanceY}</a>
	<a class="buttontext" href="javascript:EditBookingAttendance('N')">${uiLabelMap.EditBookingAttendanceN}</a>
</form>

批量考勤BookingAttendanceBar.ftl:

<script  type="text/javascript">
function onsubmitForMy(obj){
	AuditingStuBatchList()
	submitFormDisableSubmits(obj);
}
function AuditingStuBatchList()
{
	var stuBatchIds = [];
	var stuBatchId_cks = $("input[name='stuBatchId']:checked");
	$("#div_AuditingStuBatchList").html("");
	var stuBatchIds = new Array();  
	stuBatchId_cks.each(function(){  
		stuBatchIds.push($(this).val());  
		$("#div_AuditingStuBatchList").append($('<input type="hidden" name="stuBatchIds" value="'+$(this).val()+'" />'))
	});  
	/*
	$.ajax({  
		type:'post',  
		traditional :true,  
		url:'AuditingStuBatchList',  
		data:{'stuBatchIds':stuBatchIds},  
		success:function(data){  
			alert("test")
		}  
	});  
	*/
}
</script>
<!--
	<a class="buttontext" href="javascript:AuditingStuBatchList()">${uiLabelMap.AuditingStuBatchList}</a>
-->
<form method="post" action="/booking/control/AuditingStuBatchList" id="AuditingStuBatchListForm" class="basic-form" οnsubmit="javascript:onsubmitForMy(this)" name="AuditingStuBatchListForm" novalidate="novalidate">
  <div style="display:none" id="div_AuditingStuBatchList">
  </div>
  <table cellspacing="0">
  <tbody>
  <tr>
	<td class="label">
		<label for="result" title="审核结果。" id="result_title">审核结果</label>  
	</td>
	<td>
		<span class="ui-widget">
			<select name="result" class="required valid" id="result" size="1"> 
				<option value="wait">待审核</option>   		
				<option value="Y" selected>通过</option>          
				<option value="N">拒绝</option>   
		
			</select>
		</span>
	</td>
  </tr>
  <tr>
	<td class="label">
		<label for="reason" title="原因。" >原因</label>  
	</td>
	<td>
		<textarea name="reason" cols="20" rows="4" id="reason" style="margin-top: 0px; margin-bottom: 0px; height: 80px;"></textarea>
	</td>
  </tr>
  <tr>
    <td class="label">   </td>
    <td>
		<input type="submit" name="submitButton" value="提交">
    </td>
  </tr>
 </tbody></table>
</form>

预约管理业务处理逻辑BookingBatch.groovy


import org.apache.ofbiz.entity.util.*
import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.service.ServiceUtil
import javax.servlet.http.*
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityFindOptions
import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityConditionList
import org.apache.ofbiz.entity.condition.EntityExpr
import org.apache.ofbiz.entity.condition.EntityFieldValue
import org.apache.ofbiz.entity.condition.EntityFunction
import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.entity.util.EntityUtilProperties

// GroovyEngine will invoke the no-arg method.
public Map bookingBatch( ) {
	result = ServiceUtil.returnSuccess()
	String batchId = context.batchId
	String proName = context.proName == null ? "" : context.proName
	//HttpSession session = request.getSession();
	//GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");
	String stuId = userLogin.userLoginId
	Map stuBatch = UtilMisc.toMap("stuId", stuId, "batchId", batchId );
	//GenericValue sb = delegator.findOne("StuBatch", false, stuBatch)

	GenericValue student = delegator.findOne("Student", false, UtilMisc.toMap("stuId", stuId))
	if(student == null){
		result = ServiceUtil.returnError("不是学生用户,不能预约!")
		result.result = stuId
		return result
	}

	def entityName = "StuBatch"
	def mainAndConds = []
	def orCondFields = []
	def andCondFields = []
	
	orCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue("result"), EntityOperator.EQUALS, "Y"))
	orCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue("result"), EntityOperator.EQUALS, null))
	
	andCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue("stuId"), EntityOperator.EQUALS, stuId))
	andCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue("batchId"), EntityOperator.EQUALS, batchId))
	//andCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue("result"), EntityOperator.NOT_EQUAL, "N"))
	
	mainAndConds.add(EntityCondition.makeCondition(orCondFields, EntityOperator.OR))
	mainAndConds.add(EntityCondition.makeCondition(andCondFields, EntityOperator.AND))
	def entityConditionList = EntityCondition.makeCondition(mainAndConds, EntityOperator.AND)
	def havingEntityCondition = EntityCondition.makeCondition([], EntityOperator.AND)
	EntityFindOptions findOptions = new EntityFindOptions()
	long nums = delegator.findCountByCondition(entityName, entityConditionList, havingEntityCondition, findOptions)
	if (nums == 0){
		stuBatch.put("date",new java.sql.Timestamp(new java.util.Date().getTime()));
		stuBatch.put("result", "wait");
		stuBatch.put("attendance", "wait");
		sb = delegator.create("StuBatch", stuBatch)
		result.successMessage =  (String) "[$proName] 预约成功"
		result.result = stuId
	}
	else{
		//result.errorMessage =  "已经预约过了,请不要重复预约!"
		result.successMessage =  (String) "[$proName] 已经预约过了,请不要重复预约!"
		result.result = stuId
	}		
    return result
}

public Map auditingStuBatchList(){
	
	if (context.stuBatchIds != null){
		result = ServiceUtil.returnSuccess()
		result.successMessageList = []
		nums = context.stuBatchIds.size()
		successNums = 0
		failureNums = 0
		for(int i=0; i<nums; i++){
			String stuBatchId = context.stuBatchIds.get(i)
			String[] arr = stuBatchId.split(",")
			String stuId = arr[0]
			String batchId = arr[1]
			String date = arr[2]
			Map stuBatch = UtilMisc.toMap("stuId", arr[0], "batchId", batchId, "date", java.sql.Timestamp.valueOf(date));
			GenericValue sb = delegator.findOne("StuBatch", false, stuBatch)
			if (sb != null){
				if("Y".equals(context.result) ){
					//判断是否预约满了
					GenericValue lpb = sb.getRelatedOne("LabProjectBatch", true)
					//最大容纳人数
					int maxNums = lpb.get("capacity") 
					//获取已审核通过的人数
					int passNums = 0
					def entityName = "StuBatch"
					def andCondFields = []
					andCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue("batchId"), EntityOperator.EQUALS, batchId))
					andCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue("result"), EntityOperator.EQUALS, "Y"))
					def entityConditionList = EntityCondition.makeCondition(andCondFields, EntityOperator.AND)
					def havingEntityCondition = EntityCondition.makeCondition([], EntityOperator.AND)
					EntityFindOptions findOptions = new EntityFindOptions()
					passNums = delegator.findCountByCondition(entityName, entityConditionList, havingEntityCondition, findOptions)
					if( maxNums > passNums){
						sb.set("result",context.result)
						sb.set("reason",context.reason)
						sb.store()
						successNums++
					}
					else{
						failureNums++
					}
				}
				else{
					sb.set("result",context.result)
					sb.set("reason",context.reason)
					sb.store()
					successNums++
				}
			}
		}	
		result.successMessageList.add("成功审核"+successNums+"条记录!")
		if(failureNums > 0){
			result.successMessageList.add("由于实验项目批次容纳人数已满,"+failureNums+"条记录审核失败!")
		}
		//result.successMessage =  (String) "[$context.reason] test!size:" + nums
	}
	else{
		result = ServiceUtil.returnError("请至少勾选一条要审核的记录!")
		//result.errorMessageList = []
		//result.errorMessageList.add("成功审核0条记录!")
	}
	return result
}


public Map editBookingAttendance(){
	
	if (context.stuBatchIds != null){
		result = ServiceUtil.returnSuccess()
		result.successMessageList = []
		nums = context.stuBatchIds.size()
		successNums = 0
		failureNums = 0
		for(int i=0; i<nums; i++){
			String stuBatchId = context.stuBatchIds.get(i)
			String[] arr = stuBatchId.split(",")
			String stuId = arr[0]
			String batchId = arr[1]
			String date = arr[2]
			Map stuBatch = UtilMisc.toMap("stuId", stuId, "batchId", batchId, "date", java.sql.Timestamp.valueOf(date));
			GenericValue sb = delegator.findOne("StuBatch", false, stuBatch)
			if (sb != null){
				sb.set("attendance",context.attendance)
				sb.store()
				successNums++
			}
		}	
		result.successMessageList.add("成功考勤确认"+successNums+"条记录!")
	}
	else{
		result = ServiceUtil.returnError("请至少勾选一条要考勤确认的记录!")
		//result.errorMessageList = []
		//result.errorMessageList.add("成功审核0条记录!")
	}
	return result
}


返回导航页




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值