wuwen 4 роки тому
батько
коміт
4a11f118ed

+ 7 - 2
src/main/java/com/ssj/dao/sys/fx/dao/impl/FinanceQueryDaoImpl.java

@@ -511,7 +511,7 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
 	public Page<Map<String, Object>> balanceConsumeDetailList_New2(Map<String, Object> params, Pageable pageable) {
 		 StringBuilder selSql = new StringBuilder();
          List<Object> queryParams = new ArrayList<Object>();
-         selSql.append(" SELECT tmp.id,tmp.pos_code,tmp.unit_name,tmp.meal_type,tmp.count_2,tmp.moid,IFNULL(tmo.price,0) as price,tmo.sign_type,? as balance_month  from ( ");
+         selSql.append(" SELECT tmp.id,tmp.pos_code,tmp.unit_name,tmp.meal_type,tmp.count_2,tmp.moid,IFNULL(tmo.unit_price,0) as price,tmp.pr_2 as price_1,tmo.sign_type,? as balance_month  from ( ");
          selSql.append(" SELECT t.id,t.pos_code,t.unit_name,t.meal_type,  ");
          selSql.append(" ( ");
 	         selSql.append(" SELECT mo.id from fx_merchant_meal me LEFT JOIN fx_merchant_meal_order mo ON me.order_id=mo.id  ");
@@ -520,7 +520,12 @@ public class FinanceQueryDaoImpl implements FinanceQueryDao {
          selSql.append(" ) as moid,  ");
          selSql.append(" ( ");
          selSql.append(" SELECT count(1) from fx_merchant_sign ms WHERE ms.merchant_id=t.id AND DATE_FORMAT(ms.sign_time,'%Y-%m')=? ");
-         selSql.append(" ) as count_2 ");
+         selSql.append(" ) as count_2, ");
+         selSql.append(" ( ");
+         selSql.append(" SELECT IFNULL(SUM(mso.unit_price),0) from fx_merchant_sign ms LEFT JOIN fx_merchant_sign_order mso ON ms.order_id=mso.id WHERE ms.merchant_id=t.id AND DATE_FORMAT(ms.sign_time,'%Y-%m')=? ");
+         selSql.append(" ) as pr_2");
+         
+         queryParams.add(params.get("startMonth"));
          queryParams.add(params.get("startMonth"));
          queryParams.add(params.get("startMonth"));
          queryParams.add(params.get("startMonth"));

+ 11 - 12
src/main/java/com/ssj/sys/controller/FinanceReportController.java

@@ -508,11 +508,11 @@ public class FinanceReportController extends BaseController {
         Page<Map<String,Object>> page = financeService.balanceConsumeDetailList_New2(params, initPage(pageNo, pageSize));
         List<Map<String,Object>> list=page.getContent();
         for (Map<String, Object> map : list) {
-        	if(Integer.parseInt(map.get("meal_type").toString())==4) {
-        		map.put("price_1", "0");
-        	}else {
-        		map.put("price_1", "350");
-        	}
+//        	if(Integer.parseInt(map.get("meal_type").toString())==4) {
+//        		map.put("price_1", "0");
+//        	}else {
+//        		map.put("price_1", "350");
+//        	}
           	map.put("sum_price_1", "0");
         	map.put("sum_price_2", "0");
         	map.put("sum_price_3", "0");
@@ -656,11 +656,11 @@ public class FinanceReportController extends BaseController {
             Page<Map<String,Object>> page = financeService.balanceConsumeDetailList_New2(params, initPage(1, 10000));
             List<Map<String,Object>> list=page.getContent();
             for (Map<String, Object> map : list) {
-            	if(Integer.parseInt(map.get("meal_type").toString())==4) {
-            		map.put("price_1", "0");
-            	}else {
-            		map.put("price_1", "350");
-            	}
+//            	if(Integer.parseInt(map.get("meal_type").toString())==4) {
+//            		map.put("price_1", "0");
+//            	}else {
+//            		map.put("price_1", "350");
+//            	}
               	map.put("sum_price_1", "0");
             	map.put("sum_price_2", "0");
             	map.put("sum_price_3", "0");
@@ -726,8 +726,7 @@ public class FinanceReportController extends BaseController {
             		if(Integer.parseInt(map.get("count_2").toString())>0) {
             			map.put("count_2_m", map.get("balance_month") );
             			map.put("sum_price_2", map.get("price_1")!=null && StringUtils.isNotEmpty(map.get("price_1").toString()) ? 
-            					new BigDecimal(map.get("price_1").toString()).doubleValue()*
-            					new BigDecimal(map.get("count_2").toString()).intValue()
+            					new BigDecimal(map.get("price_1").toString()).doubleValue()
             					*0.4 
             					: 0);
             		}else {