|
@@ -542,7 +542,7 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
|
|
|
|
|
|
|
|
|
selSql.append(" SELECT t.id,t.pos_code,t.unit_name,t.meal_type,me.sign_time,tmo.id as moid,IFNULL(tmo.unit_price,0) as price,tmo.lib_service ,tmo.sign_type, ? as balance_month from fx_merchant t ");
|
|
|
- selSql.append(" LEFT JOIN fx_merchant_meal me ON me.merchant_id=t.id AND me.type>1 AND DATE_FORMAT(me.sign_time,'%Y-%m')=? ");
|
|
|
+ selSql.append(" LEFT JOIN fx_merchant_meal me ON me.merchant_id=t.id AND me.type>2 AND DATE_FORMAT(me.sign_time,'%Y-%m')=? ");
|
|
|
selSql.append(" LEFT JOIN fx_merchant_meal_order tmo ON me.order_id=tmo.id ");
|
|
|
selSql.append(" WHERE t.`status`!=4 and t.sign_type>=1 and t.type in (5) ");
|
|
|
queryParams.add(params.get("startMonth"));
|
|
@@ -595,10 +595,10 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
|
|
|
selSql.append(" SELECT t.id,t.pos_code,t.unit_name,t.type, ");
|
|
|
|
|
|
selSql.append(" ( ");
|
|
|
- selSql.append(" SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>1 AND TO_DAYS( c.sign_time )< TO_DAYS( ? ) ");
|
|
|
+ selSql.append(" SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>2 AND TO_DAYS( c.sign_time )< TO_DAYS( ? ) ");
|
|
|
selSql.append(" ) AS init_1, ");
|
|
|
selSql.append(" ( ");
|
|
|
- selSql.append(" SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>1 AND TO_DAYS( c.sign_time )< TO_DAYS( ? ) ");
|
|
|
+ selSql.append(" SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>2 AND TO_DAYS( c.sign_time )< TO_DAYS( ? ) ");
|
|
|
selSql.append(" ) AS init_2, ");
|
|
|
selSql.append(" ( ");
|
|
|
selSql.append(" SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_sign c WHERE c.merchant_id = t.id AND TO_DAYS( c.sign_time )< TO_DAYS( ? ) ");
|
|
@@ -610,7 +610,7 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
|
|
|
selSql.append(" SELECT IFNULL( SUM( o.price ), 0 ) FROM fx_merchant_meal_order o WHERE o.merchant_id = t.id AND TO_DAYS( o.create_time )< TO_DAYS( ? ) ");
|
|
|
selSql.append(" ) AS ir_1, ");
|
|
|
selSql.append(" ( ");
|
|
|
- selSql.append(" SELECT IFNULL(o.price*count(1)/(o.buy_month+o.give_month), 0 ) FROM fx_merchant_meal c LEFT JOIN fx_merchant_meal_order o ON c.order_id=o.id WHERE c.merchant_id = t.id AND c.type>1 AND c.remarks is NULL AND TO_DAYS( c.sign_time )< TO_DAYS( ?) ");
|
|
|
+ selSql.append(" SELECT IFNULL(o.price*count(1)/(o.buy_month+o.give_month), 0 ) FROM fx_merchant_meal c LEFT JOIN fx_merchant_meal_order o ON c.order_id=o.id WHERE c.merchant_id = t.id AND c.type>2 AND c.remarks is NULL AND TO_DAYS( c.sign_time )< TO_DAYS( ?) ");
|
|
|
selSql.append(" ) AS ir_2, ");
|
|
|
selSql.append(" ( ");
|
|
|
selSql.append(" SELECT IFNULL( SUM( o.price ), 0 ) FROM fx_merchant_sign_order o WHERE o.merchant_id = t.id AND TO_DAYS( o.create_time )< TO_DAYS( ? ) ");
|
|
@@ -626,10 +626,10 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
|
|
|
selSql.append(" ) AS ir_6, ");
|
|
|
|
|
|
selSql.append(" ( ");
|
|
|
- selSql.append(" SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>1 AND TO_DAYS( c.sign_time )>= TO_DAYS( ? ) AND TO_DAYS( c.sign_time )<= TO_DAYS(? ) ");
|
|
|
+ selSql.append(" SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>2 AND TO_DAYS( c.sign_time )>= TO_DAYS( ? ) AND TO_DAYS( c.sign_time )<= TO_DAYS(? ) ");
|
|
|
selSql.append(" ) AS count_1, ");
|
|
|
selSql.append(" ( ");
|
|
|
- selSql.append(" SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>1 AND TO_DAYS( c.sign_time )>= TO_DAYS( ? ) AND TO_DAYS( c.sign_time )<= TO_DAYS(? ) ");
|
|
|
+ selSql.append(" SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_meal c WHERE c.merchant_id = t.id AND c.type>2 AND TO_DAYS( c.sign_time )>= TO_DAYS( ? ) AND TO_DAYS( c.sign_time )<= TO_DAYS(? ) ");
|
|
|
selSql.append(" ) AS count_2, ");
|
|
|
selSql.append(" ( ");
|
|
|
selSql.append(" SELECT IFNULL( SUM( c.lib_service ), 0 ) FROM fx_merchant_sign c WHERE c.merchant_id = t.id AND TO_DAYS( c.sign_time )>= TO_DAYS( ? ) AND TO_DAYS( c.sign_time )<= TO_DAYS(? ) ");
|
|
@@ -641,7 +641,7 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
|
|
|
selSql.append(" SELECT IFNULL( SUM( o.price ), 0 ) FROM fx_merchant_meal_order o WHERE o.merchant_id = t.id AND TO_DAYS( o.create_time )>= TO_DAYS( ? ) AND TO_DAYS( o.create_time )<= TO_DAYS(? ) ");
|
|
|
selSql.append(" ) AS pr_1, ");
|
|
|
selSql.append(" ( ");
|
|
|
- selSql.append(" SELECT IFNULL(sum(o.price/( o.buy_month + o.give_month)), 0 ) FROM fx_merchant_meal c LEFT JOIN fx_merchant_meal_order o ON c.order_id=o.id WHERE c.merchant_id = t.id AND c.type>1 AND (c.remarks <> '开始计费期' or c.remarks is null) AND TO_DAYS( c.sign_time )>= TO_DAYS( ?) AND TO_DAYS( c.sign_time )<= TO_DAYS(?) ");
|
|
|
+ selSql.append(" SELECT IFNULL(sum(o.price/( o.buy_month + o.give_month)), 0 ) FROM fx_merchant_meal c LEFT JOIN fx_merchant_meal_order o ON c.order_id=o.id WHERE c.merchant_id = t.id AND c.type>2 AND (c.remarks <> '开始计费期' or c.remarks is null) AND TO_DAYS( c.sign_time )>= TO_DAYS( ?) AND TO_DAYS( c.sign_time )<= TO_DAYS(?) ");
|
|
|
selSql.append(" ) AS pr_2, ");
|
|
|
selSql.append(" ( ");
|
|
|
selSql.append(" SELECT IFNULL( SUM( o.price ), 0 ) FROM fx_merchant_sign_order o WHERE o.merchant_id = t.id AND TO_DAYS( o.create_time )>= TO_DAYS( ? ) AND TO_DAYS( o.create_time )<= TO_DAYS(? ) ");
|