Bladeren bron

订餐页面查询条件修改

user5 5 jaren geleden
bovenliggende
commit
7458f4417e

+ 8 - 0
src/main/java/com/jeeplus/modules/wexintheorder/entity/TheOrder.java

@@ -20,7 +20,15 @@ public class TheOrder extends DataEntity<TheOrder> {
     private Date EndDate;
     private String serialNumber;
     private String number;
+    private String scheduledStr;
 
+    public String getScheduledStr() {
+        return scheduledStr;
+    }
+
+    public void setScheduledStr(String scheduledStr) {
+        this.scheduledStr = scheduledStr;
+    }
 
     public String getNumber() {
         return number;

+ 31 - 11
src/main/java/com/jeeplus/modules/wexintheorder/service/TheOrderWebService.java

@@ -27,17 +27,9 @@ public class TheOrderWebService extends CrudService<TheOrderWebDao,TheOrder>{
             String dataScopeSql = dataScopeFilterOR(theOrder.getCurrentUser(), "o", "u", "s", MenuStatusEnum.WORK_STOCK.getValue());
             theOrder.getSqlMap().put("dsf", dataScopeSql);
         }
-        if (null == theOrder.getOrderStatus()){
-            theOrder.setOrderStatus(0);
-        }
-        Date time = new Date();
-        if (null == theOrder.getBeginDate()){
-            time = time(1);
-            theOrder.setBeginDate(time);
-        }
-        if (null == theOrder.getEndDate()){
-            time = time(2);
-            theOrder.setEndDate(time);
+        //获取预定时间区间
+        if (null != theOrder.getScheduled()){
+            theOrder.setScheduledStr(dateStr(theOrder.getScheduled()));
         }
         int count = dao.queryCount(theOrder);
         page.setCount(count);
@@ -52,6 +44,22 @@ public class TheOrderWebService extends CrudService<TheOrderWebDao,TheOrder>{
         return super.findList(theOrder);
     }
 
+    /**
+     * date转String
+     * @param date
+     * @return
+     */
+    private static String dateStr(Date date){
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+        String dateStr = formatter.format(date);
+        return dateStr;
+    }
+
+    /**
+     * 根据当前时间获取之后相对天数的时间节点
+     * @param status 对应天数
+     * @return
+     */
     private static Date time(Integer status){
         SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
         Calendar c = Calendar.getInstance();
@@ -79,10 +87,18 @@ public class TheOrderWebService extends CrudService<TheOrderWebDao,TheOrder>{
      * @return
      */
     public List<TheOrder> getLeadershipList(TheOrder theOrder){
+        //获取预定时间区间
+        if (null != theOrder.getScheduled()){
+            theOrder.setScheduledStr(dateStr(theOrder.getScheduled()));
+        }
         return dao.getLeadershipList(theOrder);
     }
 
     public List<TheOrder> getTheOrderListByLeadership(TheOrder theOrder){
+        //获取预定时间区间
+        if (null != theOrder.getScheduled()){
+            theOrder.setScheduledStr(dateStr(theOrder.getScheduled()));
+        }
         return dao.getTheOrderListByLeadership(theOrder);
     }
 
@@ -92,6 +108,10 @@ public class TheOrderWebService extends CrudService<TheOrderWebDao,TheOrder>{
      * @return
      */
     public List<TheOrder> getTheOrderListCountByDepartment(TheOrder theOrder){
+        //获取预定时间区间
+        if (null != theOrder.getScheduled()){
+            theOrder.setScheduledStr(dateStr(theOrder.getScheduled()));
+        }
         return dao.getTheOrderListCountByDepartment(theOrder);
     }
 

+ 5 - 2
src/main/java/com/jeeplus/modules/wexintheorder/web/TheOrderWebController.java

@@ -66,8 +66,10 @@ public class TheOrderWebController extends BaseController {
         /*try {*/
             String fileHeader = "预订单";
             String excelHeaderName = null;
-            if (null != theOrder.getBeginDate()){
-                excelHeaderName = dateTimeStr(theOrder.getBeginDate());
+            if (null != theOrder.getScheduled()){
+                excelHeaderName = dateTimeStr(theOrder.getScheduled());
+            }else{
+                excelHeaderName = "";
             }
             String fileName = fileHeader+ excelHeaderName+".xlsx";
             List<TheOrder> leadershipList = theOrderWebService.getLeadershipList(theOrder);
@@ -79,6 +81,7 @@ public class TheOrderWebController extends BaseController {
                 TheOrderLeadership theOrderLeadership = new TheOrderLeadership();
                 leadership.setBeginDate(theOrder.getBeginDate());
                 leadership.setEndDate(theOrder.getEndDate());
+                leadership.setScheduled(theOrder.getScheduled());
                 leadership.setOrderStatus(theOrder.getOrderStatus());
                 List<TheOrder> theOrderListByLeadership = theOrderWebService.getTheOrderListByLeadership(leadership);
                 theOrderLeadership.setLeadership(leadership.getDepartment());

+ 36 - 20
src/main/resources/mappings/modules/wexintheorder/TheOrderWebDao.xml

@@ -42,13 +42,15 @@
 			<if test="team != null and team != ''">
 				and a.team = #{team}
 			</if>
-			<if test="orderStatus != null and orderStatus == 0">
-				<if test="beginDate !=null">
-					and a.scheduled >= #{beginDate}
-				</if>
-				<if test="endDate !=null">
-					and a.scheduled &lt; #{endDate}
-				</if>
+			<if test="scheduledStr !=null">
+				and date_format(a.scheduled,'%Y-%m-%d') = #{scheduledStr}
+			</if>
+
+			<if test="beginDate !=null">
+				and a.create_date >= #{beginDate}
+			</if>
+			<if test="endDate !=null">
+				and a.create_date &lt; #{endDate}
 			</if>
 		</where>
 		<choose>
@@ -68,13 +70,15 @@
 			<if test="team != null and team != ''">
 				and a.team = #{team}
 			</if>
-			<if test="orderStatus != null and orderStatus == 0">
-				<if test="beginDate !=null">
-					and a.scheduled >= #{beginDate}
-				</if>
-				<if test="endDate !=null">
-					and a.scheduled &lt; #{endDate}
-				</if>
+			<if test="scheduledStr !=null">
+				and date_format(a.scheduled,'%Y-%m-%d') = #{scheduledStr}
+			</if>
+
+			<if test="beginDate !=null">
+				and a.create_date >= #{beginDate}
+			</if>
+			<if test="endDate !=null">
+				and a.create_date &lt; #{endDate}
 			</if>
 		</where>
 	</select>
@@ -86,11 +90,15 @@
 			<if test="team != null and team != ''">
 				and a.team = #{team}
 			</if>
+			<if test="scheduledStr !=null">
+				and date_format(a.scheduled,'%Y-%m-%d') = #{scheduledStr}
+			</if>
+
 			<if test="beginDate !=null">
-				and a.scheduled >= #{beginDate}
+				and a.create_date >= #{beginDate}
 			</if>
 			<if test="endDate !=null">
-				and a.scheduled &lt; #{endDate}
+				and a.create_date &lt; #{endDate}
 			</if>
 		</where>
 	</select>
@@ -107,11 +115,15 @@
 			<if test="team != null and team != ''">
 				and a.team = #{team}
 			</if>
+			<if test="scheduledStr !=null">
+				and date_format(a.scheduled,'%Y-%m-%d') = #{scheduledStr}
+			</if>
+
 			<if test="beginDate !=null">
-				and a.scheduled >= #{beginDate}
+				and a.create_date >= #{beginDate}
 			</if>
 			<if test="endDate !=null">
-				and a.scheduled &lt; #{endDate}
+				and a.create_date &lt; #{endDate}
 			</if>
 		</where>
 		order by a.team asc,a.department asc,a.specific desc,sc.id desc ,so.id desc,a.create_date asc) as theOrder ,(select @rownum := 0) temp
@@ -129,11 +141,15 @@
 			<if test="team != null and team != ''">
 				and a.team = #{team}
 			</if>
+			<if test="scheduledStr !=null">
+				and date_format(a.scheduled,'%Y-%m-%d') = #{scheduledStr}
+			</if>
+
 			<if test="beginDate !=null">
-				and a.scheduled >= #{beginDate}
+				and a.create_date >= #{beginDate}
 			</if>
 			<if test="endDate !=null">
-				and a.scheduled &lt; #{endDate}
+				and a.create_date &lt; #{endDate}
 			</if>
 		</where>
 		group by a.team,a.specific

+ 0 - 3
src/main/webapp/webpage/modules/theorder/theOrderInformationList.jsp

@@ -57,7 +57,6 @@
 									<option value="潘中" <c:if test="${team=='潘中'}">selected</c:if>>潘中</option>
 									<option value="盛小兰" <c:if test="${team=='盛小兰'}">selected</c:if>>盛小兰</option>
 									<option value="王春生" <c:if test="${team=='王春生'}">selected</c:if>>王春生</option>
-									<option value="其他" <c:if test="${team=='其他'}">selected</c:if>>其他</option>
 								</select>
 							</div>
 						</div>
@@ -129,8 +128,6 @@
                         $('#department').html('<option value="">请选择部门</option>')
                     } else if (data.value == "王春生") {
                         $('#department').html('<option value="">请选择部门</option>')
-                    } else if (data.value == "其他") {
-                        $('#department').html('<option value="">请选择部门</option>')
                     }
                     layui.form.render("select");
                 }

+ 22 - 9
src/main/webapp/webpage/modules/theorder/theOrderList.jsp

@@ -27,6 +27,11 @@
                 event: 'focus', //响应事件。如果没有传入event,则按照默认的click
                 type : 'date'
             });
+            laydate.render({
+                elem: '#scheduled', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
+                event: 'focus', //响应事件。如果没有传入event,则按照默认的click
+                type : 'date'
+            });
         });
 
         /**获取近N天*/
@@ -82,19 +87,14 @@
 									<option value="潘中" <c:if test="${theOrder.team=='潘中'}">selected</c:if>>潘中</option>
 									<option value="盛小兰" <c:if test="${theOrder.team=='盛小兰'}">selected</c:if>>盛小兰</option>
 									<option value="王春生" <c:if test="${theOrder.team=='王春生'}">selected</c:if>>王春生</option>
-									<option value="其他" <c:if test="${theOrder.team=='其他'}">selected</c:if>>其他</option>
 								</select>
 							</div>
 						</div>
 						<div class="layui-item query athird ">
-							<label class="layui-form-label">创建时间:</label>
+							<label class="layui-form-label">预定时间:</label>
 							<div class="layui-input-block">
-								<input id="beginDate" name="beginDate" placeholder="开始时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
-									   value="<fmt:formatDate value="${theOrder.beginDate}" pattern="yyyy-MM-dd"/>"/>
-								</input>
-								<span class="group-sep">-</span>
-								<input id="endDate" name="endDate" placeholder="结束时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
-									   value="<fmt:formatDate value="${theOrder.endDate}" pattern="yyyy-MM-dd"/>"/>
+								<input id="scheduled" name="scheduled" placeholder="预定时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
+									   value="<fmt:formatDate value="${theOrder.scheduled}" pattern="yyyy-MM-dd"/>"/>
 								</input>
 							</div>
 						</div>
@@ -105,8 +105,21 @@
 								<button id="searchQuery" class="fixed-btn searchQuery fr" onclick="search()">查询</button>
 							</div>
 						</div>
-
 						<div style="    clear:both;"></div>
+						<div id="moresees" class="lw7" style="clear:both;display:none;height: 70px;">
+							<div class="layui-item query athird ">
+								<label class="layui-form-label">创建时间:</label>
+								<div class="layui-input-block">
+									<input id="beginDate" name="beginDate" placeholder="开始时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
+										   value="<fmt:formatDate value="${theOrder.beginDate}" pattern="yyyy-MM-dd"/>"/>
+									</input>
+									<span class="group-sep">-</span>
+									<input id="endDate" name="endDate" placeholder="结束时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
+										   value="<fmt:formatDate value="${theOrder.endDate}" pattern="yyyy-MM-dd"/>"/>
+									</input>
+								</div>
+							</div>
+						</div>
 					</div>
 				</form:form>
 			</div>