|
@@ -4,6 +4,7 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import com.palmnest.application.Constants;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.openxmlformats.schemas.drawingml.x2006.chart.STScatterStyle;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -18,6 +19,7 @@ import com.palmnest.dao.dinner.OrderDinnerDao;
|
|
|
import com.palmnest.dao.hibernate.GenericDaoHibernate;
|
|
|
import com.palmnest.model.dinner.OrderDinner;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Repository("orderDinnerDao")
|
|
|
public class OrderDinnerDaoImpl extends GenericDaoHibernate<OrderDinner, Long> implements OrderDinnerDao {
|
|
|
private static Logger LOG = LoggerFactory.getLogger(OrderDinnerDaoImpl.class);
|
|
@@ -725,13 +727,13 @@ public class OrderDinnerDaoImpl extends GenericDaoHibernate<OrderDinner, Long> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int getCountByUserAndMealFood(String userId, String foodId, String foodOrgId) {
|
|
|
+ public int getCountByUserAndMealFood(String userId, String foodId, String foodOrgId,String date) {
|
|
|
StringBuilder sql = new StringBuilder(" select SUM(od.foodCount) sumCount from tb_order_dinner d ");
|
|
|
sql.append(" left join tb_order_dinner_info od on d.id=od.orderId ");
|
|
|
sql.append(" left join tb_meal m on m.id=od.mealId ");
|
|
|
sql.append(" where d.status=1 and d.consId=" + userId + " ");
|
|
|
sql.append(" and (od.stapleFood='" + foodId + "' or (od.stapleFood='" + foodOrgId + "' and m.spec>1 ) ) ");
|
|
|
- sql.append(" and date_format(d.dinnerTime,'%Y-%m-%d')=date_format(SYSDATE(),'%Y-%m-%d') ");
|
|
|
+ sql.append(" and date_format(d.dinnerTime,'%Y-%m-%d')=date_format('"+date+"','%Y-%m-%d') ");
|
|
|
sql.append(" GROUP BY d.consId ");
|
|
|
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql.toString());
|
|
|
int count = 0;
|
|
@@ -762,19 +764,20 @@ public class OrderDinnerDaoImpl extends GenericDaoHibernate<OrderDinner, Long> i
|
|
|
sql.append(" WHERE b.departmentId = d.id AND u.departmentId = d.id and u.organizationId="+orgId+" ");
|
|
|
sql.append(" AND ( u.address = '"+addressId+"' OR u.address = '"+addressOrgId+"') ");
|
|
|
sql.append(" ORDER BY d.orderNum ");
|
|
|
+ log.info("getDeptByOrgAddress-sql:{}",sql);
|
|
|
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql.toString());
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int getCountByDeptAndMeal(String deptId, String itemId, String itemOrgId) {
|
|
|
+ public int getCountByDeptAndMeal(String deptId, String itemId, String itemOrgId,String date) {
|
|
|
StringBuilder sql = new StringBuilder(" select SUM(od.foodCount) sumCount from tb_order_dinner d ");
|
|
|
sql.append(" left join tb_order_dinner_info od on d.id=od.orderId ");
|
|
|
sql.append(" left join tb_user u on u.id=d.consId ");
|
|
|
sql.append(" left join tb_department dept on dept.id=u.departmentId ");
|
|
|
sql.append(" left join tb_meal m on m.id=od.mealId ");
|
|
|
sql.append(" where d.status=1 and u.departmentId=" + deptId + " and (m.mealCodeId='" + itemId + "' or m.mealCodeId='" + itemOrgId + "' ) ");
|
|
|
- sql.append(" and date_format(d.dinnerTime,'%Y-%m-%d')=date_format(SYSDATE(),'%Y-%m-%d') ");
|
|
|
+ sql.append(" and date_format(d.dinnerTime,'%Y-%m-%d')=date_format('"+date+"','%Y-%m-%d') ");
|
|
|
sql.append(" and u.id not in (select us.id from tb_user us where us.organizationId=u.organizationId and us.isLeader=1) ");
|
|
|
sql.append(" GROUP BY u.departmentId,m.mealCodeId ");
|
|
|
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql.toString());
|
|
@@ -789,7 +792,7 @@ public class OrderDinnerDaoImpl extends GenericDaoHibernate<OrderDinner, Long> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int getCountByDeptAndMealFood(String addressId, String addressOrgId, String deptId, String foodId, String foodOrgId) {
|
|
|
+ public int getCountByDeptAndMealFood(String addressId, String addressOrgId, String deptId, String foodId, String foodOrgId,String date) {
|
|
|
StringBuilder sql = new StringBuilder(" select SUM(od.foodCount) sumCount from tb_order_dinner d ");
|
|
|
sql.append(" left join tb_order_dinner_info od on d.id=od.orderId ");
|
|
|
sql.append(" left join tb_user u on u.id=d.consId ");
|
|
@@ -800,7 +803,7 @@ public class OrderDinnerDaoImpl extends GenericDaoHibernate<OrderDinner, Long> i
|
|
|
sql.append(" where d.status=1 and u.departmentId=" + deptId + " ");
|
|
|
sql.append(" and (dl.id='" + addressId + "' or dol.id='" + addressOrgId + "') ");
|
|
|
sql.append(" and (od.stapleFood='" + foodId + "' or (od.stapleFood='" + foodOrgId + "' and m.spec>1 ) ) ");
|
|
|
- sql.append(" and date_format(d.dinnerTime,'%Y-%m-%d')=date_format(SYSDATE(),'%Y-%m-%d') ");
|
|
|
+ sql.append(" and date_format(d.dinnerTime,'%Y-%m-%d')=date_format('"+date+"','%Y-%m-%d') ");
|
|
|
sql.append(" and u.id not in (select us.id from tb_user us where us.organizationId=u.organizationId and us.isLeader=1) ");
|
|
|
sql.append(" GROUP BY u.departmentId ");
|
|
|
List<Map<String, Object>> list = getJdbcTemplate().queryForList(sql.toString());
|
|
@@ -816,7 +819,7 @@ public class OrderDinnerDaoImpl extends GenericDaoHibernate<OrderDinner, Long> i
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> getCountByUserOrDept(String orgId,
|
|
|
- String userId, String addressId, String addressOrgId, String deptId) {
|
|
|
+ String userId, String addressId, String addressOrgId, String deptId,String date) {
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
sql.append(" select m.mealCodeId,ifnull(di.itemname,doi.itemname) mealName,sum(od.foodCount) sumCount from tb_order_dinner_info od ");
|
|
|
sql.append(" left join tb_order_dinner o on o.id=od.orderId ");
|
|
@@ -827,7 +830,7 @@ public class OrderDinnerDaoImpl extends GenericDaoHibernate<OrderDinner, Long> i
|
|
|
sql.append(" left join tb_dictionary_item dl on dl.id=u.address ");
|
|
|
sql.append(" left join tb_dictionary_org_item dol on dol.id=u.address ");
|
|
|
sql.append(" left join tb_department d on d.id=u.departmentId ");
|
|
|
- sql.append(" where o.isEnabled=1 and date_format(o.dinnerTime,'%Y-%m-%d')=date_format(SYSDATE(),'%Y-%m-%d') ");
|
|
|
+ sql.append(" where o.isEnabled=1 and date_format(o.dinnerTime,'%Y-%m-%d')=date_format('"+date+"','%Y-%m-%d') ");
|
|
|
sql.append(" and o.status=1 and u.organizationId=" + orgId + " ");
|
|
|
if (StringUtil.isNotEmpty(userId)) {
|
|
|
sql.append(" and u.id=" + userId + " ");
|
|
@@ -842,7 +845,7 @@ public class OrderDinnerDaoImpl extends GenericDaoHibernate<OrderDinner, Long> i
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> getCountByAddress(String orgId,
|
|
|
- String addressId, String addressOrgId) {
|
|
|
+ String addressId, String addressOrgId,String date) {
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
sql.append(" select ifnull(doi.itemname,di.itemname) mealName,sum(od.foodCount) sumCount from tb_order_dinner_info od ");
|
|
|
sql.append(" left join tb_order_dinner o on o.id=od.orderId ");
|
|
@@ -850,7 +853,7 @@ public class OrderDinnerDaoImpl extends GenericDaoHibernate<OrderDinner, Long> i
|
|
|
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_user u on u.id=od.consId ");
|
|
|
- sql.append(" where o.isEnabled=1 and date_format(o.dinnerTime,'%Y-%m-%d')=date_format(SYSDATE(),'%Y-%m-%d') ");
|
|
|
+ sql.append(" where o.isEnabled=1 and date_format(o.dinnerTime,'%Y-%m-%d')=date_format('"+date+"','%Y-%m-%d') ");
|
|
|
sql.append(" and o.status=1 and o.orgId=" + orgId + " and (u.address='" + addressId + "' or u.address='" + addressOrgId + "' ) ");
|
|
|
sql.append(" group by ifnull(doi.itemname,di.itemname) ");
|
|
|
return getJdbcTemplate().queryForList(sql.toString());
|