Parcourir la source

修改年初始化多水表问题

luobo il y a 4 ans
Parent
commit
abc9a22b7f
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 4 2
      src/java/com/bus/dao/impl/BusOrgDaoImpl.java

+ 4 - 2
src/java/com/bus/dao/impl/BusOrgDaoImpl.java

@@ -203,7 +203,8 @@ public class BusOrgDaoImpl extends GenericDaoImpl<BusOrg, Long>
 //		Float v = (float) (1+GR/100);
 		//通过sql查询增长比例
 		String v = " (select 1+(growth_ratio/100) from base_org_type o where o.org_type_id = b.org_type_id) ";
-		String yearSql = "ROUND((ROUND(SUM(bm.`water`)/count(bm.`water`)) * 12 * "+v+")";
+        String s = " (select count(1) from bus_customer_meter c where c.`org_id` = b.`org_id` and c.`year` = b.`year`) ";
+		String yearSql = "ROUND((ROUND(SUM(bm.`water`)/count(bm.`water`)) * 12 * "+s+" * "+v+")";
 		String quarterSql = "ROUND("+yearSql+"/4)";
 		String montherSql = "ROUND("+yearSql+"/12)";
 
@@ -246,7 +247,8 @@ public class BusOrgDaoImpl extends GenericDaoImpl<BusOrg, Long>
 			Date eMonthEndTime) {
 		//通过sql查询增长比例
 		String v = " (select 1+(growth_ratio/100) from base_org_type o where o.org_type_id = b.org_type_id ) ";
-		String yearSql = "ROUND((ROUND(SUM(bm.`water`)/count(bm.`water`)) * 12 * "+v+")";
+        String s = " (select count(1) from bus_customer_meter c where c.`org_id` = b.`org_id` and c.`year` = b.`year`) ";
+		String yearSql = "ROUND((ROUND(SUM(bm.`water`)/count(bm.`water`)) * 12 * "+s+" * "+v+")";
 		String quarterSql = "ROUND("+yearSql+"/4)";
 		String montherSql = "ROUND("+yearSql+"/12)";
 		String sql =" INSERT INTO `bus_month_assessment`                                                                   "