ソースを参照

修改飞亚达订餐
1、微信端允许订下周及以后的餐
2、导出数据改为提前一天的16:40开始导第二天的数据(遇到周五的情况,可导出下周一的)

longmeizhen@avic-s.com 2 年 前
コミット
9112a96de2
20 ファイル変更391 行追加94 行削除
  1. 2 2
      sql/huanjingpeizhi/formal environment/tomcat_super_service/WEB-INF/classes/quartz_job2.xml
  2. 3 7
      src/main/java/com/palmnest/application/core/util/DateUtils.java
  3. 5 0
      src/main/java/com/palmnest/dao/dinner/MealDao.java
  4. 1 1
      src/main/java/com/palmnest/dao/dinner/OrderDinnerDao.java
  5. 4 4
      src/main/java/com/palmnest/dao/dinner/OrderDinnerInfoDao.java
  6. 38 0
      src/main/java/com/palmnest/dao/dinner/impl/MealDaoImpl.java
  7. 2 16
      src/main/java/com/palmnest/dao/dinner/impl/OrderDinnerDaoImpl.java
  8. 8 8
      src/main/java/com/palmnest/dao/dinner/impl/OrderDinnerInfoDaoImpl.java
  9. 5 0
      src/main/java/com/palmnest/service/dinner/manager/MealManager.java
  10. 4 4
      src/main/java/com/palmnest/service/dinner/manager/OrderDinnerInfoManager.java
  11. 1 1
      src/main/java/com/palmnest/service/dinner/manager/OrderDinnerManager.java
  12. 28 0
      src/main/java/com/palmnest/service/dinner/manager/impl/MealManagerImpl.java
  13. 8 8
      src/main/java/com/palmnest/service/dinner/manager/impl/OrderDinnerInfoManagerImpl.java
  14. 8 9
      src/main/java/com/palmnest/service/dinner/manager/impl/OrderDinnerManagerImpl.java
  15. 2 0
      src/main/java/com/palmnest/service/dinner/service/OrderDinnerService.java
  16. 147 19
      src/main/java/com/palmnest/service/dinner/service/impl/OrderDinnerServiceImpl.java
  17. 105 11
      src/main/java/com/palmnest/service/dinner/service/impl/PlaceAnOrderServiceImpl.java
  18. 9 1
      src/main/java/com/palmnest/webapp/controller/dinner/wechat/WechatPlaceAnOrderController.java
  19. 1 1
      src/main/java/com/palmnest/webapp/quartz/OrderDinnerGetOrderInfoTask.java
  20. 10 2
      src/main/resources/quartz_job2.xml

+ 2 - 2
sql/huanjingpeizhi/formal environment/tomcat_super_service/WEB-INF/classes/quartz_job2.xml

@@ -343,8 +343,8 @@
     <bean id="orderDinnerGetOrderInfoTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
         <property name="jobDetail" ref="orderDinnerGetOrderInfoTimer"/>
         <property name="cronExpression">
-            <value>0 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 10 * * ?</value>
-            <!-- 从10点开始执行,每1分钟执行一次,只执行到10点30 -->
+            <value>0 40,41,42,43,44,45,46,47,48,49,50 16 * * ?</value>
+            <!-- 从16点40开始执行,每1分钟执行一次,只执行到16点50 -->
         </property>
     </bean>
 

+ 3 - 7
src/main/java/com/palmnest/application/core/util/DateUtils.java

@@ -162,13 +162,9 @@ public class DateUtils {
     }
 
 	public static void main(String[] args) {
-		
-		try {
-			getTimeMin(30);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
+
+		List<WeekDate> list=getWeek();
+		System.out.println(JsonUtils.toJson(list));
 	}
 
 	/**

+ 5 - 0
src/main/java/com/palmnest/dao/dinner/MealDao.java

@@ -1,6 +1,7 @@
 package com.palmnest.dao.dinner;
 
 import java.util.List;
+import java.util.Map;
 
 import com.palmnest.application.bean.Page;
 import com.palmnest.application.dto.input.MealSearchDto;
@@ -58,4 +59,8 @@ public interface MealDao extends GenericDao<Meal, Long> {
 	 * @return
 	 */
 	List<Meal> getMealList(String orgId, String time);
+
+	List<Map<String,Object>> getMealDate(Integer orgId);
+
+	String getNextMealDate(Integer orgId,String date , int type);
 }

+ 1 - 1
src/main/java/com/palmnest/dao/dinner/OrderDinnerDao.java

@@ -227,7 +227,7 @@ public interface OrderDinnerDao extends GenericDao<OrderDinner, Long> {
 	 * @param addressId
 	 * @return
 	 */
-	List<Map<String, Object>> getDeptByOrgAddress(String orgId, String addressId, String addressOrgId);
+	List<Map<String, Object>> getDeptByOrgAddress(String orgId, String addressId, String addressOrgId,String date);
 
 	/**
 	 * 根据部门及餐品id获取餐品相关的下单数量

+ 4 - 4
src/main/java/com/palmnest/dao/dinner/OrderDinnerInfoDao.java

@@ -37,7 +37,7 @@ public interface OrderDinnerInfoDao extends GenericDao<OrderDinnerInfo, Long> {
 	 * @param orgId
 	 * @return
 	 */
-	List<Map<String, Object>> getOrderExcelListByMeal(String orgId);
+	List<Map<String, Object>> getOrderExcelListByMeal(String orgId,String date);
 
 	/**
 	 * 根据部门汇总
@@ -45,7 +45,7 @@ public interface OrderDinnerInfoDao extends GenericDao<OrderDinnerInfo, Long> {
 	 * @param orgId
 	 * @return
 	 */
-	List<Map<String, Object>> getOrderExcelListByDept(String orgId);
+	List<Map<String, Object>> getOrderExcelListByDept(String orgId,String date);
 
 	/**
 	 * 根据用户名汇总
@@ -53,7 +53,7 @@ public interface OrderDinnerInfoDao extends GenericDao<OrderDinnerInfo, Long> {
 	 * @param orgId
 	 * @return
 	 */
-	List<Map<String, Object>> getOrderExcelListByUserName(String orgId);
+	List<Map<String, Object>> getOrderExcelListByUserName(String orgId,String date);
 
 	/**
 	 * 根据地址汇总
@@ -61,7 +61,7 @@ public interface OrderDinnerInfoDao extends GenericDao<OrderDinnerInfo, Long> {
 	 * @param orgId
 	 * @return
 	 */
-	List<Map<String, Object>> getOrderExcelListByAddress(String orgId);
+	List<Map<String, Object>> getOrderExcelListByAddress(String orgId,String date);
 
 	/**
 	 * 根据下单人以及送餐时间获取该用户下的订餐数据

+ 38 - 0
src/main/java/com/palmnest/dao/dinner/impl/MealDaoImpl.java

@@ -1,7 +1,10 @@
 package com.palmnest.dao.dinner.impl;
 
 import java.util.List;
+import java.util.Map;
 
+import com.palmnest.application.core.util.DateHelper;
+import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Repository;
@@ -14,12 +17,14 @@ import com.palmnest.application.dto.input.MealSearchDto;
 import com.palmnest.dao.dinner.MealDao;
 import com.palmnest.dao.hibernate.GenericDaoHibernate;
 import com.palmnest.model.dinner.Meal;
+import org.springframework.util.CollectionUtils;
 
 /**
  * 餐品DAO实现类
  *
  * @author longmeizhen
  */
+@Slf4j
 @Repository("mealDao")
 public class MealDaoImpl extends GenericDaoHibernate<Meal, Long> implements MealDao {
 	private static Logger LOG = LoggerFactory.getLogger(MealDaoImpl.class);
@@ -118,4 +123,37 @@ public class MealDaoImpl extends GenericDaoHibernate<Meal, Long> implements Meal
 		sql.append(" and (mealCodeId=?  or mealCodeId=? )");
 		return getSession().createQuery(sql.toString()).setString(0, orgId).setString(1, mealCodeId).setString(2, mealCodeOrgId).list();
 	}
+
+
+	@Override
+	public List<Map<String,Object>> getMealDate(Integer orgId) {
+		StringBuilder sql = new StringBuilder(" SELECT DISTINCT supplyTime ");
+		sql.append(" ,( CASE WHEN DAYOFWEEK( supplyTime) = 1 THEN 7 WHEN DAYOFWEEK( supplyTime ) > 1 THEN DAYOFWEEK( supplyTime )- 1 END ) weekNo ");
+		sql.append(" , ( CASE WHEN DAYOFWEEK( supplyTime ) = 1 THEN '星期日' WHEN DAYOFWEEK( supplyTime ) = 2 THEN '星期一' WHEN DAYOFWEEK( supplyTime ) = 3 THEN '星期二' WHEN DAYOFWEEK( supplyTime ) = 4 THEN '星期三' WHEN DAYOFWEEK( supplyTime ) = 5 THEN '星期四' WHEN DAYOFWEEK( supplyTime ) = 6 THEN '星期五' WHEN DAYOFWEEK( supplyTime ) = 7 THEN '星期六' END ) weekName ");
+		sql.append(" , ( CASE WHEN supplyTime = DATE_FORMAT( SYSDATE(), '%Y-%m-%d' ) THEN 1 ELSE 0 END ) isToday ");
+		sql.append(" FROM tb_meal  ");
+		sql.append(" WHERE supplyTime >= DATE_FORMAT( SYSDATE(), '%Y-%m-%d' ) AND orgId = "+orgId+" AND isEnabled = 1 AND `status` = 1 ORDER BY supplyTime ");
+		return getJdbcTemplate().queryForList(sql.toString());
+	}
+
+	@Override
+	public String getNextMealDate(Integer orgId, String date, int type) {
+		StringBuilder sql = new StringBuilder(" SELECT DISTINCT supplyTime ");
+		sql.append(" FROM tb_meal  ");
+		if(1 == type){
+			sql.append(" WHERE supplyTime > DATE_FORMAT( '"+date+"', '%Y-%m-%d' ) AND orgId = "+orgId+" AND isEnabled = 1 AND `status` = 1 ORDER BY supplyTime LIMIT 1");
+		}else if(2 == type){
+			sql.append(" WHERE supplyTime >= DATE_FORMAT( '"+date+"', '%Y-%m-%d' ) AND orgId = "+orgId+" AND isEnabled = 1 AND `status` = 1 ORDER BY supplyTime LIMIT 1");
+		}
+		log.info("getNextMealDate-sql:{}",sql);
+		List<Map<String,Object>> list = getJdbcTemplate().queryForList(sql.toString());
+		if(CollectionUtils.isEmpty(list)){
+			return "";
+		}
+		Map<String, Object> map = list.get(0);
+		if (map == null || !map.containsKey("supplyTime") || null == map.get("supplyTime") || StringUtils.isEmpty(map.get("supplyTime").toString())) {
+			return "";
+		}
+		return map.get("supplyTime").toString();
+	}
 }

+ 2 - 16
src/main/java/com/palmnest/dao/dinner/impl/OrderDinnerDaoImpl.java

@@ -746,27 +746,13 @@ public class OrderDinnerDaoImpl extends GenericDaoHibernate<OrderDinner, Long> i
 
 	@Override
 	public List<Map<String, Object>> getDeptByOrgAddress(String orgId,
-														 String addressId, String addressOrgId) {
-//		StringBuilder sql = new StringBuilder("  select distinct ifnull(ador.itemname,adr.itemname) address,d.id,IF(IFNULL(d.shortName,'')='',d.name,d.shortName) deptname  ");
-//		sql.append(" from tb_department d   ");
-//		sql.append(" left join tb_user u on d.id=u.departmentId   ");
-//		sql.append(" left join tb_dictionary_item adr on adr.id=u.address  ");
-//		sql.append(" left join tb_dictionary_org_item ador on ador.id=u.address  ");
-//		sql.append("  where d.isEnabled=1 and u.organizationId=" + orgId + " and (adr.id= '" + addressId + "' or ador.id= '" + addressOrgId + "' )   ");
-//		sql.append("  and d.id in (select us.departmentId from tb_order_dinner o     ");
-//		sql.append("  left join tb_order_dinner_info od on o.id=od.orderId    ");
-//		sql.append("  left join tb_user us on us.id=od.consId   ");
-//		sql.append("  where o.`status`='1' and od.orgId=u.organizationId and od.isEnabled='1' and (us.address=adr.id or us.address=ador.id )     ");
-//		sql.append("  and date_format(od.dinnerTime,'%Y-%m-%d')=date_format(SYSDATE(),'%Y-%m-%d')        ");
-//		sql.append("  GROUP BY us.departmentId)       ");
-//		sql.append("  ORDER BY d.orderNum      ");
+														 String addressId, String addressOrgId,String date) {
 		StringBuilder sql = new StringBuilder(" SELECT DISTINCT ifnull(doi.itemname, di.itemname) AS address,d.id,  ");
-		//sql.append("  IF (IFNULL(d.shortName, '') = '',d. NAME,d.shortName) AS deptname,2 type  ");
 		sql.append("  d. NAME AS deptname,2 type  ");
 		sql.append(" FROM tb_department d,   ");
 		sql.append("  ( SELECT DISTINCT us.departmentId FROM tb_order_dinner o   ");
 		sql.append("    LEFT JOIN tb_order_dinner_info od ON o.id = od.orderId AND od.isEnabled = '1'  ");
-		sql.append("    AND date_format(od.dinnerTime, '%Y-%m-%d') = date_format(SYSDATE(), '%Y-%m-%d')  ");
+		sql.append("    AND date_format(od.dinnerTime, '%Y-%m-%d') = date_format('"+date+"', '%Y-%m-%d')  ");
 		sql.append("    LEFT JOIN tb_user us ON us.id = od.consId  ");
 		sql.append("    WHERE o.`status` = '1' AND od.orgId = "+orgId+"  ");
 		sql.append("    AND ( us.address = '"+addressId+"' OR us.address = '"+addressOrgId+"' )  ");

+ 8 - 8
src/main/java/com/palmnest/dao/dinner/impl/OrderDinnerInfoDaoImpl.java

@@ -71,7 +71,7 @@ public class OrderDinnerInfoDaoImpl extends GenericDaoHibernate<OrderDinnerInfo,
 	 * @return
 	 */
 	@Override
-	public List<Map<String, Object>> getOrderExcelListByMeal(String orgId) {
+	public List<Map<String, Object>> getOrderExcelListByMeal(String orgId,String date) {
 		StringBuilder sql = new StringBuilder("");
 		sql.append(" select sum(od.foodCount) other,ifnull((case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN doi.itemname else CONCAT(doi.itemname,':',od.stapleFoodStr) end ) ");
 		sql.append("   , (case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN di.itemname else CONCAT(di.itemname,':',od.stapleFoodStr) end )) mName  ");
@@ -80,7 +80,7 @@ public class OrderDinnerInfoDaoImpl extends GenericDaoHibernate<OrderDinnerInfo,
 		sql.append(" left join tb_meal m on m.id=od.mealId ");
 		sql.append(" left join tb_dictionary_item di on di.id=m.mealCodeId ");
 		sql.append(" left join tb_dictionary_org_item doi on doi.id=m.mealCodeId ");
-		sql.append(" where o.orgId in (" + orgId + ")  and o.isEnabled='1' and date_format(o.dinnerTime,'%Y-%m-%d')=date_format(SYSDATE(),'%Y-%m-%d') ");
+		sql.append(" where o.orgId in (" + orgId + ")  and o.isEnabled='1' and date_format(o.dinnerTime,'%Y-%m-%d')=date_format('"+date+"','%Y-%m-%d') ");
 		sql.append(" and o.status='1' ");
 		sql.append(" group by ifnull((case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN doi.itemname else CONCAT(doi.itemname,':',od.stapleFoodStr) end ) ,(case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN di.itemname else CONCAT(di.itemname,':',od.stapleFoodStr) end )) ");
 		sql.append(" order by  (case when m.spec>1 then 2 else 1 end) desc  ");
@@ -92,7 +92,7 @@ public class OrderDinnerInfoDaoImpl extends GenericDaoHibernate<OrderDinnerInfo,
 	 * 根据部门汇总
 	 */
 	@Override
-	public List<Map<String, Object>> getOrderExcelListByDept(String orgId) {
+	public List<Map<String, Object>> getOrderExcelListByDept(String orgId,String date) {
 		StringBuilder sql = new StringBuilder("");
 		sql.append("  select dl.name other,ifnull((case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN  CONCAT(doi.itemname,'*',sum(foodCount)) else CONCAT(CONCAT(doi.itemname,':',od.stapleFoodStr),'*',SUM(foodCount)) end ) ");
 		sql.append(" ,(case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN  CONCAT(di.itemname,'*',sum(foodCount)) else CONCAT(CONCAT(di.itemname,':',od.stapleFoodStr),'*',SUM(foodCount)) end )) mName   ");
@@ -103,7 +103,7 @@ public class OrderDinnerInfoDaoImpl extends GenericDaoHibernate<OrderDinnerInfo,
 		sql.append(" left join tb_department dl on dl.id=c.departmentId ");
 		sql.append(" left join tb_dictionary_item di on di.id=m.mealCodeId ");
 		sql.append(" left join tb_dictionary_org_item doi on doi.id=m.mealCodeId ");
-		sql.append(" where o.orgId  in (" + orgId + ")   and o.isEnabled='1' and date_format(o.dinnerTime,'%Y-%m-%d')=date_format(SYSDATE(),'%Y-%m-%d')  ");
+		sql.append(" where o.orgId  in (" + orgId + ")   and o.isEnabled='1' and date_format(o.dinnerTime,'%Y-%m-%d')=date_format('"+date+"','%Y-%m-%d')  ");
 		sql.append(" and o.status='1' ");
 		sql.append(" group by dl.name,ifnull((case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN doi.itemname else CONCAT(doi.itemname,':',od.stapleFoodStr) end )  ");
 		sql.append(" ,(case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN di.itemname else CONCAT(di.itemname,':',od.stapleFoodStr) end ) ) ");
@@ -120,7 +120,7 @@ public class OrderDinnerInfoDaoImpl extends GenericDaoHibernate<OrderDinnerInfo,
 	 */
 	@Override
 	public List<Map<String, Object>> getOrderExcelListByUserName(
-			String orgId) {
+			String orgId,String date) {
 		StringBuilder sql = new StringBuilder("");
 		sql.append("  select dl.name deptname,c.userName other,ifnull((case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN  CONCAT(doi.itemname,'*',sum(foodCount)) else CONCAT(CONCAT(doi.itemname,':',od.stapleFoodStr),'*',SUM(foodCount)) end )   ");
 		sql.append("  ,(case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN  CONCAT(di.itemname,'*',sum(foodCount)) else CONCAT(CONCAT(di.itemname,':',od.stapleFoodStr),'*',SUM(foodCount)) end ))  mName  ");
@@ -131,7 +131,7 @@ public class OrderDinnerInfoDaoImpl extends GenericDaoHibernate<OrderDinnerInfo,
 		sql.append(" left join tb_dictionary_item di on di.id=m.mealCodeId ");
 		sql.append(" left join tb_dictionary_org_item doi on doi.id=m.mealCodeId ");
 		sql.append(" left join tb_department dl on dl.id=c.departmentId ");
-		sql.append(" where o.orgId  in (" + orgId + ")   and o.isEnabled='1' and date_format(o.dinnerTime,'%Y-%m-%d')=date_format(SYSDATE(),'%Y-%m-%d')  ");
+		sql.append(" where o.orgId  in (" + orgId + ")   and o.isEnabled='1' and date_format(o.dinnerTime,'%Y-%m-%d')=date_format('"+date+"','%Y-%m-%d')  ");
 		sql.append(" and o.status='1' ");
 		sql.append(" group by c.userName,ifnull((case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN doi.itemname else CONCAT(doi.itemname,':',od.stapleFoodStr) end ) ");
 		sql.append(" ,(case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN di.itemname else CONCAT(di.itemname,':',od.stapleFoodStr) end )) ");
@@ -148,7 +148,7 @@ public class OrderDinnerInfoDaoImpl extends GenericDaoHibernate<OrderDinnerInfo,
 	 */
 	@Override
 	public List<Map<String, Object>> getOrderExcelListByAddress(
-			String orgId) {
+			String orgId,String date) {
 		StringBuilder sql = new StringBuilder("");
 		sql.append("  select ifnull(dol.itemname,dl.itemname) other,(case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN  CONCAT(ifnull(doi.itemname,di.itemname),'*',sum(foodCount)) else CONCAT(CONCAT(ifnull(doi.itemname,di.itemname),':',od.stapleFoodStr),'*',SUM(foodCount)) end ) mName  ");
 		sql.append("  from tb_order_dinner_info od   ");
@@ -159,7 +159,7 @@ public class OrderDinnerInfoDaoImpl extends GenericDaoHibernate<OrderDinnerInfo,
 		sql.append(" left join tb_dictionary_org_item dol on dol.id=c.address ");
 		sql.append(" left join tb_dictionary_item di on di.id=m.mealCodeId ");
 		sql.append(" left join tb_dictionary_org_item doi on doi.id=m.mealCodeId ");
-		sql.append(" where o.orgId  in (" + orgId + ")   and o.isEnabled='1' and date_format(o.dinnerTime,'%Y-%m-%d')=date_format(SYSDATE(),'%Y-%m-%d')  ");
+		sql.append(" where o.orgId  in (" + orgId + ")   and o.isEnabled='1' and date_format(o.dinnerTime,'%Y-%m-%d')=date_format('"+date+"','%Y-%m-%d')  ");
 		sql.append(" and o.status='1' ");
 		sql.append(" group by ifnull(dol.itemname,dl.itemname),(case when od.stapleFoodStr='' or od.stapleFoodStr is NULL THEN ifnull(doi.itemname,di.itemname) else CONCAT(ifnull(doi.itemname,di.itemname),':',od.stapleFoodStr) end ) ");
 		sql.append(" order by ifnull(dol.orderno,dl.orderno)  ");

+ 5 - 0
src/main/java/com/palmnest/service/dinner/manager/MealManager.java

@@ -1,6 +1,7 @@
 package com.palmnest.service.dinner.manager;
 
 import com.palmnest.application.bean.Page;
+import com.palmnest.application.core.util.WeekDate;
 import com.palmnest.application.dto.input.MealSearchDto;
 import com.palmnest.model.dinner.Meal;
 import com.palmnest.service.GenericManager;
@@ -88,4 +89,8 @@ public interface MealManager extends GenericManager<Meal, Long> {
 	Map<String, Object> importMeal(InputStream ins, String orgId);
 
 	String saveImportMeal(List<Meal> list, String userId) throws RuntimeException;
+
+	List<WeekDate> getMealDate(Integer orgId);
+
+	String getNextMealDate(Integer orgId,String date, int type);
 }

+ 4 - 4
src/main/java/com/palmnest/service/dinner/manager/OrderDinnerInfoManager.java

@@ -39,7 +39,7 @@ public interface OrderDinnerInfoManager extends GenericManager<OrderDinnerInfo,
 	 * @param orgId
 	 * @return
 	 */
-	List<MealExcelDto> getOrderExcelListByMeal(String orgId);
+	List<MealExcelDto> getOrderExcelListByMeal(String orgId,String date);
 
 	/**
 	 * 根据部门汇总
@@ -47,7 +47,7 @@ public interface OrderDinnerInfoManager extends GenericManager<OrderDinnerInfo,
 	 * @param orgId
 	 * @return
 	 */
-	List<MealExcelDto> getOrderExcelListByDept(String orgId);
+	List<MealExcelDto> getOrderExcelListByDept(String orgId,String date);
 
 	/**
 	 * 根据用户名汇总
@@ -55,7 +55,7 @@ public interface OrderDinnerInfoManager extends GenericManager<OrderDinnerInfo,
 	 * @param orgId
 	 * @return
 	 */
-	List<Map<String, Object>> getOrderExcelListByUserName(String orgId);
+	List<Map<String, Object>> getOrderExcelListByUserName(String orgId,String date);
 
 
 	/**
@@ -64,7 +64,7 @@ public interface OrderDinnerInfoManager extends GenericManager<OrderDinnerInfo,
 	 * @param orgId
 	 * @return
 	 */
-	List<MealExcelDto> getOrderExcelListByAddress(String orgId);
+	List<MealExcelDto> getOrderExcelListByAddress(String orgId,String date);
 
 	/**
 	 * 获取所有

+ 1 - 1
src/main/java/com/palmnest/service/dinner/manager/OrderDinnerManager.java

@@ -145,7 +145,7 @@ public interface OrderDinnerManager extends GenericManager<OrderDinner, Long> {
 	 * @param orgId
 	 * @return
 	 */
-	List<Map<String, Object>> exportByAddress(String orgId);
+	List<Map<String, Object>> exportByAddress(String orgId,String date);
 
 	String[] getTitles(List<Map<String, Object>> mapList, String[] arr, int type);
 

+ 28 - 0
src/main/java/com/palmnest/service/dinner/manager/impl/MealManagerImpl.java

@@ -1,6 +1,8 @@
 package com.palmnest.service.dinner.manager.impl;
 
+import cn.superdesk.libs.common.util.BeanUtils;
 import com.palmnest.application.bean.Page;
+import com.palmnest.application.core.util.WeekDate;
 import com.palmnest.application.dto.input.MealSearchDto;
 import com.palmnest.application.dto.output.ElementDto;
 import com.palmnest.dao.dinner.MealDao;
@@ -15,6 +17,7 @@ import org.apache.poi.ss.usermodel.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import java.io.InputStream;
 import java.text.SimpleDateFormat;
@@ -312,4 +315,29 @@ public class MealManagerImpl extends GenericManagerImpl<Meal, Long> implements M
 		return res;
 	}
 
+	@Override
+	public List<WeekDate> getMealDate(Integer orgId) {
+		List<Map<String,Object>> list = mealDao.getMealDate(orgId);
+		List<WeekDate> resList = new ArrayList<>();
+		if(CollectionUtils.isEmpty(list)){
+			return resList;
+		}
+
+		for(int i=0;i<list.size();i++){
+			Map<String,Object> map = list.get(i);
+			WeekDate weekDate=new WeekDate();
+			weekDate.setWeekNo(Integer.parseInt(map.get("weekNo").toString()));
+			weekDate.setWeekName(map.get("weekName").toString());
+			weekDate.setDateTime(map.get("supplyTime").toString());
+			weekDate.setIsToday(Integer.parseInt(map.get("isToday").toString()));
+			resList.add(weekDate);
+		}
+		return resList;
+	}
+
+	@Override
+	public String getNextMealDate(Integer orgId, String date , int type) {
+		return mealDao.getNextMealDate(orgId,date,type);
+	}
+
 }

+ 8 - 8
src/main/java/com/palmnest/service/dinner/manager/impl/OrderDinnerInfoManagerImpl.java

@@ -73,20 +73,20 @@ public class OrderDinnerInfoManagerImpl extends GenericManagerImpl<OrderDinnerIn
 	}
 
 	@Override
-	public List<MealExcelDto> getOrderExcelListByMeal(String orgId) {
-		List<Map<String, Object>> list = orderDinnerInfoDao.getOrderExcelListByMeal(orgId);
+	public List<MealExcelDto> getOrderExcelListByMeal(String orgId,String date) {
+		List<Map<String, Object>> list = orderDinnerInfoDao.getOrderExcelListByMeal(orgId,date);
 		return getExcelList(list);
 	}
 
 	@Override
-	public List<MealExcelDto> getOrderExcelListByDept(String orgId) {
-		List<Map<String, Object>> list = orderDinnerInfoDao.getOrderExcelListByDept(orgId);
+	public List<MealExcelDto> getOrderExcelListByDept(String orgId,String date) {
+		List<Map<String, Object>> list = orderDinnerInfoDao.getOrderExcelListByDept(orgId,date);
 		return getExcelList(list);
 	}
 
 	@Override
-	public List<Map<String, Object>> getOrderExcelListByUserName(String orgId) {
-		List<Map<String, Object>> list = orderDinnerInfoDao.getOrderExcelListByUserName(orgId);
+	public List<Map<String, Object>> getOrderExcelListByUserName(String orgId,String date) {
+		List<Map<String, Object>> list = orderDinnerInfoDao.getOrderExcelListByUserName(orgId,date);
 		return list;
 	}
 
@@ -111,8 +111,8 @@ public class OrderDinnerInfoManagerImpl extends GenericManagerImpl<OrderDinnerIn
 	}
 
 	@Override
-	public List<MealExcelDto> getOrderExcelListByAddress(String orgId) {
-		List<Map<String, Object>> list = orderDinnerInfoDao.getOrderExcelListByAddress(orgId);
+	public List<MealExcelDto> getOrderExcelListByAddress(String orgId,String date) {
+		List<Map<String, Object>> list = orderDinnerInfoDao.getOrderExcelListByAddress(orgId,date);
 		return getExcelList(list);
 	}
 

+ 8 - 9
src/main/java/com/palmnest/service/dinner/manager/impl/OrderDinnerManagerImpl.java

@@ -403,7 +403,7 @@ public class OrderDinnerManagerImpl extends GenericManagerImpl<OrderDinner, Long
 	}
 
 	@Override
-	public List<Map<String, Object>> exportByAddress(String orgId) {
+	public List<Map<String, Object>> exportByAddress(String orgId,String date) {
 		List<Map<String, Object>> infoList = new ArrayList<Map<String, Object>>();
 		List<Map<String, Object>> mealList = getAllItemMeal(orgId);
 		Map<String, Object>       hejiMap  = new HashMap<String, Object>();
@@ -413,7 +413,7 @@ public class OrderDinnerManagerImpl extends GenericManagerImpl<OrderDinner, Long
 		Map<String, Object> rollMap  = getFoodItem(orgId, "stapleFood", "花卷");
 		int                 allCount = 0;
 		if (mealList != null && mealList.size() > 0) {
-			List<Map<String, Object>> mapList = getSysDateData(orgId, mealList);
+			List<Map<String, Object>> mapList = getSysDateData(orgId, mealList,date);
 			mealList.add(bunsMap);
 			mealList.add(rollMap);
 			infoList.addAll(mapList);
@@ -444,7 +444,7 @@ public class OrderDinnerManagerImpl extends GenericManagerImpl<OrderDinner, Long
 		return infoList;
 	}
 
-	private List<Map<String, Object>> getSysDateData(String orgId, List<Map<String, Object>> mealList) {
+	private List<Map<String, Object>> getSysDateData(String orgId, List<Map<String, Object>> mealList,String date) {
 		List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
 		List<ElementDto>          els     = elementGroupManager.getOrgElementGroupInfo(Integer.parseInt(orgId), "dinnerAddress");
 		Collections.sort(els, new Comparator<ElementDto>() {
@@ -465,7 +465,7 @@ public class OrderDinnerManagerImpl extends GenericManagerImpl<OrderDinner, Long
 					if (el != null) {
 						addressId = el.getId().toString();
 					}
-					List<Map<String, Object>> list = getAddressInfoList(orgId, addressId, addressOrgId);//getUserAndDeptByAddress(orgId, addressId,mealList);
+					List<Map<String, Object>> list = getAddressInfoList(orgId, addressId, addressOrgId,date);//getUserAndDeptByAddress(orgId, addressId,mealList);
 					mapList.addAll(list);
 				}
 			}
@@ -499,11 +499,11 @@ public class OrderDinnerManagerImpl extends GenericManagerImpl<OrderDinner, Long
 	 * @param addressId`
 	 * @return
 	 */
-	private List<Map<String, Object>> getAllInfoByAddress(String orgId, String addressId, String addressOrgId) {
+	private List<Map<String, Object>> getAllInfoByAddress(String orgId, String addressId, String addressOrgId,String date) {
 		//汇总领导、部门
 		//List<Map<String, Object>> userList = orderDinnerDao.getUserByOrgAddress(orgId, addressId, addressOrgId);//不取领导,把领导配置为部门 by qzy
 		List<Map<String, Object>> userList = new ArrayList<Map<String,Object>>();
-		List<Map<String, Object>> deptList = orderDinnerDao.getDeptByOrgAddress(orgId, addressId, addressOrgId);
+		List<Map<String, Object>> deptList = orderDinnerDao.getDeptByOrgAddress(orgId, addressId, addressOrgId,date);
 		userList.addAll(deptList);
 		return userList;
 	}
@@ -572,9 +572,9 @@ public class OrderDinnerManagerImpl extends GenericManagerImpl<OrderDinner, Long
 	 * @param addressOrgId
 	 * @return
 	 */
-	private List<Map<String, Object>> getAddressInfoList(String orgId, String addressId, String addressOrgId) {
+	private List<Map<String, Object>> getAddressInfoList(String orgId, String addressId, String addressOrgId,String date) {
 		List<Map<String, Object>> infoList = new ArrayList<Map<String, Object>>();
-		List<Map<String, Object>> mapList  = getAllInfoByAddress(orgId, addressId, addressOrgId);
+		List<Map<String, Object>> mapList  = getAllInfoByAddress(orgId, addressId, addressOrgId,date);
 		int                       rollsSum = 0;
 		int                       bunsSum  = 0;
 		if (mapList != null && mapList.size() > 0) {
@@ -742,7 +742,6 @@ public class OrderDinnerManagerImpl extends GenericManagerImpl<OrderDinner, Long
 	 *
 	 * @param list
 	 * @param formLiveMap
-	 * @param userList
 	 */
 	private void setPlatformData(String orgId, List<Map<String, Object>> list, Map<String, Map<String, Object>> formLiveMap, String dateString, List<MeetintDto> mapList) {
 		//将平台活跃度、时间内新增用户数放到list中

+ 2 - 0
src/main/java/com/palmnest/service/dinner/service/OrderDinnerService.java

@@ -197,4 +197,6 @@ public interface OrderDinnerService {
 	String setPath(String fileName);
 
 	void getOrderInfoTask(String orgId);
+
+	void getOrderInfoTask2(String orgId,String sysDate);
 }

+ 147 - 19
src/main/java/com/palmnest/service/dinner/service/impl/OrderDinnerServiceImpl.java

@@ -307,7 +307,6 @@ public class OrderDinnerServiceImpl implements OrderDinnerService {
 	 * 判断餐品是否有效
 	 * 然后根据当前登录用户将购物车中的餐品提交到餐品详情中
 	 *
-	 * @param openId
 	 * @return
 	 */
 	@Transactional
@@ -631,7 +630,6 @@ public class OrderDinnerServiceImpl implements OrderDinnerService {
 	/**
 	 * 保存订单详情
 	 *
-	 * @param consId
 	 * @param orderId
 	 * @return
 	 */
@@ -687,7 +685,8 @@ public class OrderDinnerServiceImpl implements OrderDinnerService {
 		int                 weekDate = cal.get(Calendar.DAY_OF_WEEK) - 1;
 		//首先获取周期,然后获取周期下对应的购物车中的数据,如果周期下没有数据,就不需要展示这个周期
 		List<WeekMealCarDto> weekDtoList = new ArrayList<WeekMealCarDto>();
-		List<WeekDate>       weekList    = DateUtils.getWeek();
+//		List<WeekDate>       weekList    = DateUtils.getWeek();//--------------------------20220526-----------------------------------
+		List<WeekDate>       weekList    = mealManager.getMealDate(Integer.parseInt(orgId));
 		List<MealCar>        mealcarList = mealCarManager.findMealCarListByUserId(userId);
 		int                  sumInt      = 0;//总积分
 		int                  sumCount    = 0;
@@ -702,7 +701,7 @@ public class OrderDinnerServiceImpl implements OrderDinnerService {
 					//没操作下单前只获取当天及之后购物车数据,已超过下单时间只获取今天之后的购物车数据
 					//当下单时间是今天的时候且并没有超过操作时间的数据可以加入到集合中;
 					//下单时间的周几大于当天的周几的时候,周三>周二(该为系统当前时间)也可以加入到集合中
-					if ((isOver == 0 && week.getWeekNo() == weekDate) || (week.getWeekNo() > weekDate)) {
+//					if ((isOver == 0 && week.getWeekNo() == weekDate) || (week.getWeekNo() > weekDate)) {//--------------------------20220526-----------------------------------
 						if (dtoList != null && dtoList.size() > 0) {
 							dto.setMealCarList(dtoList);
 							dto.setWeekDate(week);
@@ -720,7 +719,7 @@ public class OrderDinnerServiceImpl implements OrderDinnerService {
 						if (count > 0) {
 							sumInt = sumInt + reSet.getDayCount();
 						}
-					}
+//					}//--------------------------20220526-----------------------------------
 				}
 			}
 		}
@@ -1402,14 +1401,15 @@ public class OrderDinnerServiceImpl implements OrderDinnerService {
 	@Override
 	public AppResultDto exportExcel(String orgId) {
 		log.info("begin exportExcel:" + orgId);
+		String date = DateHelper.formatDate(new Date(),DateHelper.CURRENT_DATE);
 		HSSFWorkbook wb = new HSSFWorkbook();
 		try {
-			List<MealExcelDto>        mealList    = orderDinnerInfoManager.getOrderExcelListByMeal(orgId);
-			List<MealExcelDto>        deptList    = orderDinnerInfoManager.getOrderExcelListByDept(orgId);
-			List<Map<String, Object>> userList    = orderDinnerInfoManager.getOrderExcelListByUserName(orgId);
-			List<MealExcelDto>        addressList = orderDinnerInfoManager.getOrderExcelListByAddress(orgId);
+			List<MealExcelDto>        mealList    = orderDinnerInfoManager.getOrderExcelListByMeal(orgId,date);
+			List<MealExcelDto>        deptList    = orderDinnerInfoManager.getOrderExcelListByDept(orgId,date);
+			List<Map<String, Object>> userList    = orderDinnerInfoManager.getOrderExcelListByUserName(orgId,date);
+			List<MealExcelDto>        addressList = orderDinnerInfoManager.getOrderExcelListByAddress(orgId,date);
 //			List<Map<String,Object>> sysList=orderDinnerManager.exportExcelByAddress(orgId);
-			List<Map<String, Object>> sysList = orderDinnerManager.exportByAddress(orgId);
+			List<Map<String, Object>> sysList = orderDinnerManager.exportByAddress(orgId,date);
 			if (mealList == null || (mealList != null && mealList.size() == 0)) {
 				return AppResultUtil.createErrorDto("100", "今日没有订单,无法导出");
 			}
@@ -1470,6 +1470,84 @@ public class OrderDinnerServiceImpl implements OrderDinnerService {
 		}
 	}
 
+
+	public AppResultDto exportExcel2(String orgId,String date) {
+		log.info("begin exportExcel2:" + orgId+";date:"+date);
+		String nextDate = "";
+		if(StringUtils.isEmpty(date)){
+			date =  DateHelper.formatDate(new Date(),DateHelper.CURRENT_DATE);
+		}
+		log.info("begin exportExcel2:" + orgId+";date:"+date);
+		nextDate = mealManager.getNextMealDate(Integer.parseInt(orgId),date,1);
+		log.info("begin exportExcel2:" + orgId+";date:"+date+";nextDate:"+nextDate);
+		if(StringUtils.isEmpty(nextDate)){
+			nextDate = date;
+			log.info("begin exportExcel2:" + orgId+";date:"+date+";nextDate2:"+nextDate);
+		}
+
+		HSSFWorkbook wb = new HSSFWorkbook();
+		try {
+			List<MealExcelDto>        mealList    = orderDinnerInfoManager.getOrderExcelListByMeal(orgId,nextDate);
+			List<MealExcelDto>        deptList    = orderDinnerInfoManager.getOrderExcelListByDept(orgId,nextDate);
+			List<Map<String, Object>> userList    = orderDinnerInfoManager.getOrderExcelListByUserName(orgId,nextDate);
+			List<MealExcelDto>        addressList = orderDinnerInfoManager.getOrderExcelListByAddress(orgId,nextDate);
+			List<Map<String, Object>> sysList = orderDinnerManager.exportByAddress(orgId,nextDate);
+			if (mealList == null || (mealList != null && mealList.size() == 0)) {
+				return AppResultUtil.createErrorDto("100", "今日没有订单,无法导出");
+			}
+			//设置导出的excel路径
+			String path = setPath("upload/OrderExcel"+orgId+".xls");
+			File   file = new File(new ExcelUtils().getPath(path));
+			System.out.println("path:" + path);
+			String sheetName = "";
+			if (sysList != null && sysList.size() > 0) {
+				sheetName = "今日餐品汇总";
+				List<Map<String, Object>> mapList = orderDinnerManager.getAllMealName(orgId);
+				String[] titles     = {"地址", "部门/领导"};
+				String[] fieldNames = {"address", "deptname"};
+				titles = orderDinnerManager.getTitles(mapList, titles, 1);
+				titles = StringUtil.insert(titles, "换花卷");
+				titles = StringUtil.insert(titles, "换馒头");
+				titles = StringUtil.insert(titles, "合计");
+				fieldNames = orderDinnerManager.getTitles(mapList, fieldNames, 2);
+				fieldNames = StringUtil.insert(fieldNames, CodeConstants.ROLLS);
+				fieldNames = StringUtil.insert(fieldNames, CodeConstants.BUNS);
+				fieldNames = StringUtil.insert(fieldNames, "heji");
+				file = ExcelUtils.exportExcel(file, wb, sheetName, sysList, titles, fieldNames);
+			}
+			if (mealList != null && mealList.size() > 0) {
+				sheetName = "餐品和数量汇总";
+				String[] titles     = {"餐品", "数量"};
+				String[] fieldNames = {"mName", "other"};
+				file = ExcelUtils.exportExcel(file, wb, sheetName, mealList, titles, fieldNames);
+			}
+			if (addressList != null && addressList.size() > 0) {
+				sheetName = "餐品数量和送餐地址汇总";
+				String[] titles     = {"送餐地址", "餐品"};
+				String[] fieldNames = {"other", "mName"};
+				file = ExcelUtils.exportExcel(file, wb, sheetName, addressList, titles, fieldNames);
+			}
+			if (deptList != null && deptList.size() > 0) {
+				sheetName = "餐品数量和部门汇总";
+				String[] titles     = {"部门", "餐品"};
+				String[] fieldNames = {"other", "mName"};
+				file = ExcelUtils.exportExcel(file, wb, sheetName, deptList, titles, fieldNames);
+			}
+			if (userList != null && userList.size() > 0) {
+				sheetName = "餐品数量和预订人汇总";
+				String[] titles     = {"部门", "订餐人", "餐品"};
+				String[] fieldNames = {"deptname", "other", "mName"};
+				file = ExcelUtils.exportExcel(file, wb, sheetName, userList, titles, fieldNames);
+			}
+			log.info("导出地址:" + path);
+			return AppResultUtil.createSuccesDto(path);
+		} catch (Exception e) {
+			log.error("导出失败" + e.getMessage());
+			e.printStackTrace();
+			return AppResultUtil.createErrorDto("100", "导出失败:" + e.getMessage());
+		}
+	}
+
 	@Override
 	public OrderDinner getById(Long id) {
 		if (orderDinnerManager.exists(id)) {
@@ -1745,15 +1823,6 @@ public class OrderDinnerServiceImpl implements OrderDinnerService {
 			if (StringUtils.isNotEmpty(orgIds)) {
 				String[] orgArr = orgIds.split(",");
 				for (String org : orgArr) {
-//					TbOrganization org = organizationManager.getOrganizationById(Integer.parseInt(orgArr[i]));
-//					if (null == org) {
-//						continue;
-//					}
-//					log.info("getOrderInfoTask/orgName:" + org.getName());
-//					if ("飞亚达大厦".equals(org.getName())) {
-//						log.info("getOrderInfoTask/orgArr[i]:" + orgArr[i]);
-//						orgId = orgArr[i];
-//					}
 					log.info("getOrderInfoTask/orgId:" + org);
 					if (StringUtils.isNotEmpty(org)) {
 						String res = getOrderTime(org, "importTime");
@@ -1769,6 +1838,37 @@ public class OrderDinnerServiceImpl implements OrderDinnerService {
 		}
 	}
 
+	@Override
+	public void getOrderInfoTask2(String orgId,String sysDate) {
+		if (StringUtils.isNotEmpty(orgId)) {
+			String res = getOrderTime(orgId, "importTime");
+			log.info("getOrderInfoTask2-res:{}",res);
+			if (StringUtils.isEmpty(res)) {
+			} else {
+				exportExcel2(orgId,sysDate);
+			}
+		} else {
+			String orgIds = serviceProjectAllocationManager.getServiceProjectByServiceCode("DCFW");
+			log.info("getOrderInfoTask/orgIds:" + orgIds);
+			if (StringUtils.isNotEmpty(orgIds)) {
+				String[] orgArr = orgIds.split(",");
+				for (String org : orgArr) {
+					log.info("getOrderInfoTask/orgId:" + org);
+					if (StringUtils.isEmpty(org)) {
+						continue;
+					}
+					String res = getOrderTime(org, "importTime");
+					log.info("getOrderInfoTask/res:" + res);
+					if (StringUtils.isEmpty(res)) {
+					} else {
+						redisExport2(org,sysDate);
+					}
+				}
+
+			}
+		}
+	}
+
 	private void redisExport(String orgId) {
 		String time = DateHelper.formatDate(new Date(), DateHelper.DATE);
 		log.info("-------------redisExport---time:" + time + "--------------------------");
@@ -1795,4 +1895,32 @@ public class OrderDinnerServiceImpl implements OrderDinnerService {
 			log.info("-----------redisExport-----执行导出结束------------------------");
 		}
 	}
+
+
+	private void redisExport2(String orgId,String date) {
+		String time = DateHelper.formatDate(new Date(), DateHelper.DATE);
+		log.info("-------------redisExport---time:" + time + "--------------------------");
+		String key = "getOrder_" + orgId +"_"+ time;
+		log.info("-------------redisExport---key:" + key + "--------------------------");
+		String mealJson = baseRedisService.get(key);
+		log.info("-------------redisExport---mealJson:" + mealJson + "--------------------------");
+		int count = 0;
+		if (StringUtils.isNotEmpty(mealJson)) {
+			log.info("-------------redisExport---redis获取:" + mealJson + "--------------------------");
+			count = Integer.parseInt(mealJson);
+			count++;
+			baseRedisService.set(key, count + "");
+		} else {
+			count++;
+			log.info("-------------redisExport---设置redis---count:" + count + "-----------------------");
+			baseRedisService.set(key, count + "");
+			log.info("-------------redisExport---设置redis--------------------------");
+		}
+		log.info("-----------redisExport-----count:" + count + "--------------------------");
+		if (count <= 10) {
+			log.info("-----------redisExport-----执行导出开始------------------------");
+			exportExcel2(orgId,date);
+			log.info("-----------redisExport-----执行导出结束------------------------");
+		}
+	}
 }

+ 105 - 11
src/main/java/com/palmnest/service/dinner/service/impl/PlaceAnOrderServiceImpl.java

@@ -217,6 +217,103 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 		}
 		return AppResultUtil.createErrorDto("100", "暂无账号");
 	}
+//	@Override
+//	public AppResultDto getWeek(String orgId, String wxUserId) {
+//		long beginTime=System.currentTimeMillis();
+//		System.out.println("beginTime:"+beginTime);
+//		LOG.info("beginTime:"+beginTime);
+//		List<WeekDate> weekNewList=new ArrayList<WeekDate>();
+//		int isOver=orderDinnerManager.isOver(orgId,"orderTime");
+//		try {
+//			String mealJson = baseRedisService.get(CodeConstants.ORG_MEAL_LIST_KEY+orgId);
+//			if(StringUtils.isNotEmpty(mealJson)) {
+//				List<WeekDate> weekList=JSONArray.parseArray(mealJson, WeekDate.class);
+//				if(weekList!=null&&weekList.size()>0){
+//					for(int i=0;i<weekList.size();i++){
+//						WeekDate week=weekList.get(i);
+//						int count=mealCarManager.findByUserId(wxUserId, week.getDateTime());
+//						if(DateUtils.checkIsOver(week.getDateTime(), isOver)){
+//							week.setIsShow(0);
+//						}else{
+//							week.setIsShow(1);
+//						}
+//						if(count>0&&week.getIsShow()==1){
+//							week.setSumCount(count);
+//						}else{
+//							week.setSumCount(null);
+//						}
+//						String sysDate=DateUtils.formatDate(new Date(), "yyyy-MM-dd");
+//						if(sysDate.equals(week.getDateTime())){
+//							week.setIsToday(1);
+//						}else{
+//							week.setIsToday(0);
+//						}
+//						int blueCount=orderDinnerInfoManager.getOrderCount(wxUserId, week.getDateTime());
+//						if(blueCount>0){
+//							week.setIsBule(1);
+//						}else{
+//							week.setIsBule(0);
+//						}
+//						List<Meal> mealList=week.getMealList();
+//						if(mealList!=null&&mealList.size()>0){
+//							week.setMealList(mealList);
+//							weekNewList.add(week);
+//						}
+//					}
+//				}
+//			}else{
+//				List<WeekDate> weekList=DateUtils.getWeek();
+//				if(weekList!=null&&weekList.size()>0){
+//					for(int i=0;i<weekList.size();i++){
+//						WeekDate week=weekList.get(i);
+//						int count=mealCarManager.findByUserId(wxUserId, week.getDateTime());
+//						if(DateUtils.checkIsOver(week.getDateTime(), isOver)){
+//							week.setIsShow(0);
+//						}else{
+//							week.setIsShow(1);
+//						}
+//						if(count>0&&week.getIsShow()==1){
+//							week.setSumCount(count);
+//						}else{
+//							week.setSumCount(null);
+//						}
+//						int blueCount=orderDinnerInfoManager.getOrderCount(wxUserId, week.getDateTime());
+//						if(blueCount>0){
+//							week.setIsBule(1);
+//						}else{
+//							week.setIsBule(0);
+//						}
+//						List<Meal> mealList=mealManager.findMealList(orgId,week.getDateTime());
+//						List<Meal> mealLists=mealManager.getMealList(orgId,week.getDateTime());
+//						if(mealLists!=null&&mealLists.size()>0){
+//							week.setMealList(mealList);
+//							weekNewList.add(week);
+//						}
+//					}
+//				}
+//				baseRedisService.set(CodeConstants.ORG_MEAL_LIST_KEY+orgId,  JSONObject.toJSONString(weekNewList));
+//			}
+//			Collections.sort(weekNewList,new Comparator<WeekDate>() {
+//				public int compare(WeekDate o1, WeekDate o2) {
+//	                String name1 =String.valueOf(o1.getWeekNo());//name1是从你list里面拿出来的一个
+//	                String name2= String.valueOf(o2.getWeekNo()); //name1是从你list里面拿出来的第二个name
+//	                return name1.compareTo(name2);
+//	        }
+//			});
+//		} catch (Exception e) {
+//			LOG.error(e.getMessage());
+//			return AppResultUtil.createErrorDto("100", "获取餐品列表失败");
+//		}
+//		long endTime=System.currentTimeMillis();
+//		System.out.println("endTime:"+endTime+",间隔:"+(endTime-beginTime));
+//		LOG.info("endTime:"+endTime+",间隔:"+(endTime-beginTime));
+//		if(weekNewList!=null&&weekNewList.size()>0){
+//			return AppResultUtil.createSuccesDto(weekNewList);
+//		}
+//		return AppResultUtil.createErrorDto("100", "尚未维护餐品,请联系管理员");
+//	}
+
+
 	@Override
 	public AppResultDto getWeek(String orgId, String wxUserId) {
 		long beginTime=System.currentTimeMillis();
@@ -224,7 +321,6 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 		LOG.info("beginTime:"+beginTime);
 		List<WeekDate> weekNewList=new ArrayList<WeekDate>();
 		int isOver=orderDinnerManager.isOver(orgId,"orderTime");
-//		baseRedisService.dele(CodeConstants.ORG_MEAL_LIST_KEY+orgId);
 		try {
 			String mealJson = baseRedisService.get(CodeConstants.ORG_MEAL_LIST_KEY+orgId);
 			if(StringUtils.isNotEmpty(mealJson)) {
@@ -263,7 +359,7 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 					}
 				}
 			}else{
-				List<WeekDate> weekList=DateUtils.getWeek();
+				List<WeekDate> weekList=mealManager.getMealDate(Integer.parseInt(orgId));
 				if(weekList!=null&&weekList.size()>0){
 					for(int i=0;i<weekList.size();i++){
 						WeekDate week=weekList.get(i);
@@ -294,13 +390,13 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 				}
 				baseRedisService.set(CodeConstants.ORG_MEAL_LIST_KEY+orgId,  JSONObject.toJSONString(weekNewList));
 			}
-			Collections.sort(weekNewList,new Comparator<WeekDate>() {
-				public int compare(WeekDate o1, WeekDate o2) {  
-	                String name1 =String.valueOf(o1.getWeekNo());//name1是从你list里面拿出来的一个  
-	                String name2= String.valueOf(o2.getWeekNo()); //name1是从你list里面拿出来的第二个name      
-	                return name1.compareTo(name2);    
-	        }  
-			});
+//			Collections.sort(weekNewList,new Comparator<WeekDate>() {
+//				public int compare(WeekDate o1, WeekDate o2) {
+//					String name1 =String.valueOf(o1.getWeekNo());//name1是从你list里面拿出来的一个
+//					String name2= String.valueOf(o2.getWeekNo()); //name1是从你list里面拿出来的第二个name
+//					return name1.compareTo(name2);
+//				}
+//			});
 		} catch (Exception e) {
 			LOG.error(e.getMessage());
 			return AppResultUtil.createErrorDto("100", "获取餐品列表失败");
@@ -313,7 +409,6 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 		}
 		return AppResultUtil.createErrorDto("100", "尚未维护餐品,请联系管理员");
 	}
-	
 	@Override
 	public AppResultDto getWeekDate(String orgId, String wxUserId,
 			String dinnerTime) {
@@ -1240,7 +1335,6 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 	
 	/**
 	 * 封装查询到的通行次数、员工通行次数、访客通行次数、二维码通行次数、实体卡通行次数
-	 * @param orgId
 	 * @param dateType
 	 * @param date
 	 * @param endDate

+ 9 - 1
src/main/java/com/palmnest/webapp/controller/dinner/wechat/WechatPlaceAnOrderController.java

@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import java.text.SimpleDateFormat;
@@ -403,9 +404,16 @@ public class WechatPlaceAnOrderController extends BaseFormController {
 	 * @param orgId
 	 * @return
 	 */
+	@RequestMapping(value = "getOrderInfoTask2")
+	@ResponseBody
+	public AppResultDto getOrderInfoTask2(@RequestParam(value = "orgId",required = false) String orgId,@RequestParam(value = "date",required = false) String date) {
+		orderDinnerService.getOrderInfoTask2(orgId,date);
+		return AppResultUtil.createSuccesDto();
+	}
+
 	@RequestMapping(value = "getOrderInfoTask")
 	@ResponseBody
-	public AppResultDto getOrderInfoTask(String orgId) {
+	public AppResultDto getOrderInfoTask(@RequestParam(value = "orgId",required = false) String orgId) {
 		orderDinnerService.getOrderInfoTask(orgId);
 		return AppResultUtil.createSuccesDto();
 	}

+ 1 - 1
src/main/java/com/palmnest/webapp/quartz/OrderDinnerGetOrderInfoTask.java

@@ -17,7 +17,7 @@ public class OrderDinnerGetOrderInfoTask {
 
 	private void run() {
 		log.info("quartz into orderDinnerGetOrderInfoTask start ..." + new Date());
-		orderDinnerService.getOrderInfoTask("");
+		orderDinnerService.getOrderInfoTask2("","");
 		log.info("quartz into orderDinnerGetOrderInfoTask end ...");
 	}
 

+ 10 - 2
src/main/resources/quartz_job2.xml

@@ -339,11 +339,19 @@
         <property name="targetObject" ref="orderDinnerGetOrderInfoTask"/>
         <property name="targetMethod" value="run"/>
     </bean>
+<!--    <bean id="orderDinnerGetOrderInfoTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">-->
+<!--        <property name="jobDetail" ref="orderDinnerGetOrderInfoTimer"/>-->
+<!--        <property name="cronExpression">-->
+<!--            <value>0 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 10 * * ?</value>-->
+<!--            &lt;!&ndash; 从10点开始执行,每1分钟执行一次,只执行到10点30 &ndash;&gt;-->
+<!--        </property>-->
+<!--    </bean>-->
+
     <bean id="orderDinnerGetOrderInfoTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
         <property name="jobDetail" ref="orderDinnerGetOrderInfoTimer"/>
         <property name="cronExpression">
-            <value>0 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 10 * * ?</value>
-            <!-- 从10点开始执行,每1分钟执行一次,只执行到10点30 -->
+            <value>0 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58 16 * * ?</value>
+            <!-- 从16点40开始执行,每1分钟执行一次,只执行到16点50 -->
         </property>
     </bean>