| 
					
				 | 
			
			
				@@ -5,18 +5,17 @@ import com.bz.smart_city.dao.pay.BaseClosingAccountInfoMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.bz.smart_city.dao.pay.PayChargeSurveyMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.bz.smart_city.dto.LoginUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.bz.smart_city.dto.pay.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.bz.smart_city.entity.pay.PayAccountSurvey; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.bz.smart_city.entity.pay.PayChargeSurvey; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.bz.smart_city.entity.pay.PayFeeSuevey; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.bz.smart_city.entity.pay.PayTransactionSurvey; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.bz.smart_city.entity.pay.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.bz.smart_city.service.pay.PayChargeSurveyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.poi.hssf.record.Record; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.annotation.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigInteger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.math.RoundingMode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.text.DecimalFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -55,12 +54,17 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           String a = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           System.out.println("收入费率:"+a);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          String a = "-90.89"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          /*String a = "-90.89"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           String b = "90.89"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           String a1 = a.split("-")[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           String b1 = b.split("-")[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          System.out.println("带负数转换:"+a1+";不带负数转换:"+b1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          System.out.println("带负数转换:"+a1+";不带负数转换:"+b1);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          /*BigDecimal bigDecima1 = new BigDecimal("194.60"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          BigDecimal bigDecima2 = new BigDecimal("600.00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          BigDecimal divide = bigDecima2.subtract(bigDecima1).divide(bigDecima1,3, RoundingMode.HALF_UP);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          //BigDecimal divide = bigDecima1 .divide(bigDecima2,2, RoundingMode.HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -86,48 +90,41 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     siteId,customerId,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(list.size() <=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 BaseClosingAccountInfoDto a = new BaseClosingAccountInfoDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Calendar cal = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                int year = cal.get(Calendar.YEAR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                int month = cal.get(Calendar.MONTH )+1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                a.setYear(year); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                a.setMonth(month); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                list.add(a); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for(int i=0; i<=1; i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Calendar cal = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    int year = cal.get(Calendar.YEAR); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    int month = cal.get(Calendar.MONTH )+1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    a.setYear(year); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    a.setMonth(month); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    a.setStartTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    list.add(a); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Date startTime = list.get(0).getStartTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String dateStart = format.format(startTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String dateEnd = format.format(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String startPeriod = list.get(0).getYear()+"-"+String.format("%02d", list.get(0).getMonth())+"-01"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String endPeriod = list.get(0).getYear()+"-"+String.format("%02d", list.get(0).getMonth())+"-31"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //取上一账期时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Calendar startDate = Calendar.getInstance();//起始年月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Calendar enddate = Calendar.getInstance();//起始年月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            startDate.setTime(sdf.parse(startPeriod)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            startDate.add(Calendar.MONTH, -1); //月份减1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            enddate.setTime(sdf.parse(endPeriod)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            enddate.add(Calendar.MONTH, -1); //月份减1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Date lastStartMonth = startDate.getTime(); //结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Date laseEndMonth = enddate.getTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String lastStart = sdf.format(lastStartMonth); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String lastEnd = sdf.format(laseEndMonth); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //System.out.println("当前账期:"+period+";上一账期:"+lastPeriod); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //上一账期汇总 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            PayAccountSurvey accountSurvey = payChargeSurveyMapper.getlastAccount(lastStart,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String lastDate = list.get(1).getYear() +"-"+String.format("%02d", list.get(1).getMonth())+"-01"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PayAccountSurvey accountSurvey = payChargeSurveyMapper.getlastAccount(null,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //客户总数计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //当前账期以内客户总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer sumAccount = payChargeSurveyMapper.getAccountNumber(null,endPeriod,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer sumAccount = payChargeSurveyMapper.getAccountNumber(null,null,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //当前账期客户总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer sumCurrentAccount = payChargeSurveyMapper.getAccountNumber(startPeriod,endPeriod,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer sumCurrentAccount = payChargeSurveyMapper.getAccountNumber(dateStart,dateEnd,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //上一期客户数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer sumLastAccount = accountSurvey != null && accountSurvey.getAccountNumber() != null ? accountSurvey.getAccountNumber() : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //客户总数较上月比率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String lastAccountRate = "0.0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            float num =(float)((sumCurrentAccount - sumLastAccount)/(sumLastAccount != null && sumLastAccount != 0 ? sumLastAccount : 1)*100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastAccountRate = df.format(num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer lastAccountIsUp = num > 0  ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastAccountRate = lastAccountRate.contains("-") ? lastAccountRate.split("-")[1] : lastAccountRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            RecordInfo info = this.calculationRate(sumAccount,sumLastAccount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            float num =info.getCount(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer lastAccountIsUp = info.getIsUp(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lastAccountRate = info.getRate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //赋值客户总数跟上月比率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             payChargeSurveyDto.setLastAccountIsUp(lastAccountIsUp); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -137,18 +134,18 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //水表总数计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //当前账期以内的水表总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer sumMeter = payChargeSurveyMapper.getMeterNumber(null,endPeriod,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer sumMeter = payChargeSurveyMapper.getMeterNumber(null,null,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //当前账期水表数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer sumCurrentMeter = payChargeSurveyMapper.getMeterNumber(startPeriod,endPeriod,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer sumCurrentMeter = payChargeSurveyMapper.getMeterNumber(dateStart,dateEnd,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //上一期水表数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer sumLastMeter = accountSurvey != null && accountSurvey.getMeterNumber() != null ? accountSurvey.getMeterNumber() :0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //水表总数较上月比率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String lastMeterRate = "0.0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            num =(float)((sumCurrentMeter - sumLastMeter)/(sumLastMeter != null && sumLastMeter != 0 ? sumLastMeter : 1)*100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastMeterRate = df.format(num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer lastMeterIsUp = num > 0  ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info = this.calculationRate(sumMeter,sumLastMeter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            num =info.getCount(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer lastMeterIsUp = info.getIsUp(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastMeterRate = lastMeterRate.contains("-") ? lastMeterRate.split("-")[1] : lastMeterRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lastMeterRate = info.getRate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //赋值水表总数跟上月比率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             payChargeSurveyDto.setLastMeterIsUp(lastMeterIsUp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             payChargeSurveyDto.setMeterNumber(sumMeter != null ? sumMeter : 0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -156,18 +153,18 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //开户总数计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer sumCustomer = payChargeSurveyMapper.getCustomerNumber(null,endPeriod,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer sumCustomer = payChargeSurveyMapper.getCustomerNumber(null,null,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //当前账期开户数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer sumCurrentCustomer = payChargeSurveyMapper.getCustomerNumber(startPeriod,endPeriod,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer sumCurrentCustomer = payChargeSurveyMapper.getCustomerNumber(dateStart,dateEnd,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //上一账期开户数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer sumLastCustomer = accountSurvey != null && accountSurvey.getCustomerNumber() != null ? accountSurvey.getCustomerNumber() : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //水表总数较上月比率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String lastCusstomerRate = "0.0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            num =(float)((sumCurrentCustomer - sumLastCustomer)/(sumLastCustomer != null && sumLastCustomer != 0 ? sumLastCustomer : 1)*100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastCusstomerRate = df.format(num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer lastCustomerIsUp = num > 0  ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info = this.calculationRate(sumCustomer,sumLastCustomer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            num =info.getCount(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer lastCustomerIsUp = info.getIsUp(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastCusstomerRate = lastCusstomerRate.contains("-") ? lastCusstomerRate.split("-")[1] : lastCusstomerRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lastCusstomerRate = info.getRate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //赋值开户总数跟上月比率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             payChargeSurveyDto.setLastCustomerIsUp(lastCustomerIsUp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             payChargeSurveyDto.setCustomerNumber(sumCustomer != null ? sumCustomer : 0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -176,7 +173,7 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //开户率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String customerRate = "0.0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            num =(float)(sumCurrentCustomer/(sumCurrentMeter != null && sumCurrentMeter != 0 ? sumCurrentMeter : 1)*100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            num =((float)sumCustomer/(sumMeter != null && sumMeter != 0 ? sumMeter : 1)*100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             customerRate = df.format(num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             customerRate = customerRate.contains("-") ? customerRate.split("-")[1] : customerRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             payChargeSurveyDto.setCustomerRate(customerRate != null && customerRate != "" ? customerRate : "0.0"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -215,13 +212,13 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     lastYear = lastYear; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     lastMonth = number; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                PayChangePeriodDto info = new PayChangePeriodDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                info.setYear(lastYear); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                info.setMonth(lastMonth); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                info.setMeterNumber(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                info.setCustomerNumber(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                info.setAccountNumber(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                pList.add(info); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                PayChangePeriodDto pinfo = new PayChangePeriodDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pinfo.setYear(lastYear); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pinfo.setMonth(lastMonth); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pinfo.setMeterNumber(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pinfo.setCustomerNumber(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pinfo.setAccountNumber(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pList.add(pinfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             accountList2.addAll(pList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             payChargeSurveyDto.setList(accountList2); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -271,6 +268,11 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal wechatIncome = defc;//微信支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal alipayIncome = defc; //支付宝 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal bankIncome = defc;//银行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal rececashIncome = defc;//现金 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal recewechatIncome = defc;//微信支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal recealipayIncome = defc; //支付宝 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal recebankIncome = defc;//银行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer lastYear = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer lastMonth = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(Integer.valueOf(month) == 1){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -285,6 +287,7 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if((year.equals(list.get(0).getYear())) && (month.equals(list.get(0).getMonth()))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //当前账期查询交易明细表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 List<PayTransactionSurvey> tranList = payChargeSurveyMapper.getCurrentTranRocord(year,month,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<PayTransactionSurvey> receList = payChargeSurveyMapper.getCurrentReceived(year,month,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for(int i=0; i<tranList.size(); i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Integer payway = tranList.get(i).getPayway(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if(payway == 1){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -301,6 +304,26 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         cashIncome = tranList.get(i).getIncomeNumber(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for(int i=0; i<receList.size(); i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Integer payway = receList.get(i).getPayway(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(payway == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //支付宝 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        recealipayIncome = receList.get(i).getIncomeNumber(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }else if(payway == 2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //微信 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        recewechatIncome = receList.get(i).getIncomeNumber(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }else if (payway == 3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //银行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        recebankIncome = receList.get(i).getIncomeNumber(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }else if (payway == 4) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //现金 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        rececashIncome = receList.get(i).getIncomeNumber(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                alipayIncome = alipayIncome.add(recealipayIncome); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                wechatIncome = wechatIncome.add(recewechatIncome); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bankIncome = bankIncome.add(recebankIncome); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cashIncome = cashIncome.add(rececashIncome); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 BigDecimal currentIncome = alipayIncome.add(wechatIncome).add(bankIncome).add(cashIncome);//当前账期收入总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //查找上月收入 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 PayTransactionSurvey lastTran = payChargeSurveyMapper.getLastTranRocord(lastYear,lastMonth,siteId,customerId); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -332,7 +355,6 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return payTransactionSurveyDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //计算交易比率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public PayTransactionSurveyDto tranCompute(PayTransactionSurvey transactionSurver){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PayTransactionSurveyDto payTransactionSurveyDto = new PayTransactionSurveyDto(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -360,49 +382,50 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal currentIncome = transactionSurver.getIncomeNumber();//本月收入总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal lastIncome = transactionSurver.getLastIncomeNumber();//上月收入总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BigDecimal income = currentIncome.subtract(lastIncome).divide((lastIncome != null && lastIncome.compareTo(BigDecimal.ZERO)==1 ? lastIncome : defb),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String lastIncomeRate = "0.0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastIncomeRate = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer lastIncomeIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastIncomeRate = lastIncomeRate.contains("-") ? lastIncomeRate.split("-")[1] : lastIncomeRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            RecordInfo info = this.calculationRate(currentIncome,lastIncome); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal income = info.getIncome(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String lastIncomeRate = info.getRate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer lastIncomeIsUp = info.getIsUp(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //按支付方式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             cashIncome = transactionSurver.getCashIncome();//本账期现金收入 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             lastcashIncome = transactionSurver.getLastCashIncome();//上期现金收入 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             wechatIncome = transactionSurver.getWechatIncome();//本账期微信 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             lastwechatIncome = transactionSurver.getLastWechatIncome();//上期微信 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             alipayIncome = transactionSurver.getAlipayIncome();//本账期支付宝 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             lastalipayIncome = transactionSurver.getLastAlipayIncome();//上期支付宝 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             bankIncome = transactionSurver.getBankIncome();//本账期银行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             lastbankIncome = transactionSurver.getLastBankIncome();//上期银行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info = this.calculationRate(cashIncome,lastcashIncome); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //现金 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            income = cashIncome.subtract(lastcashIncome).divide((lastcashIncome != null && lastcashIncome.compareTo(BigDecimal.ZERO)==1 ? lastcashIncome : defb),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastCashRate = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer lastCashIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastCashRate = lastCashRate.contains("-") ? lastCashRate.split("-")[1] : lastCashRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            income = info.getIncome(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lastCashRate = info.getRate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer lastCashIsUp = info.getIsUp(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //微信 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            income = wechatIncome.subtract(lastwechatIncome).divide((lastwechatIncome != null && lastwechatIncome.compareTo(BigDecimal.ZERO)==1 ? lastwechatIncome : defb),2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastWechatRate = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer lastWechatIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastWechatRate = lastWechatRate.contains("-") ? lastWechatRate.split("-")[1] : lastWechatRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info = this.calculationRate(wechatIncome,lastwechatIncome); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            income = info.getIncome(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer lastWechatIsUp = info.getIsUp(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lastWechatRate = info.getRate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //支付宝 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            income = alipayIncome.subtract(lastalipayIncome).divide((lastalipayIncome != null && lastalipayIncome.compareTo(BigDecimal.ZERO)==1 ? lastalipayIncome : defb), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastAlipayRate = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer lastAlipayIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastAlipayRate = lastAlipayRate.contains("-") ? lastAlipayRate.split("-")[1] : lastAlipayRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info = this.calculationRate(alipayIncome,lastalipayIncome); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            income = info.getIncome(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer lastAlipayIsUp = info.getIsUp(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lastAlipayRate = info.getRate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //银行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            income = bankIncome.subtract(lastbankIncome).divide((lastbankIncome != null && lastbankIncome.compareTo(BigDecimal.ZERO)==1 ? lastbankIncome : defb),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastBankRate = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer lastBankIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastBankRate = lastBankRate.contains("-") ? lastBankRate.split("-")[1] : lastBankRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info = this.calculationRate(bankIncome,lastbankIncome); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            income = info.getIncome(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer lastBankIsUp = info.getIsUp(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            lastBankRate = info.getRate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //饼状态占比率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal current = alipayIncome.add(wechatIncome).add(bankIncome).add(cashIncome); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -410,16 +433,16 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String alipayRate = "0.0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String wechatRate = "0.0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String bankRate = "0.0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            income = cashIncome.divide((current != null && current.compareTo(BigDecimal.ZERO)==1 ? current : defb),2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            income = cashIncome.divide((current != null && current.compareTo(BigDecimal.ZERO)==1 ? current : defb),3, RoundingMode.HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             CashRate = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            income = alipayIncome.divide((current != null && current.compareTo(BigDecimal.ZERO)==1 ? current : defb),2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            income = alipayIncome.divide((current != null && current.compareTo(BigDecimal.ZERO)==1 ? current : defb),3, RoundingMode.HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             alipayRate = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            income = wechatIncome.divide((current != null && current.compareTo(BigDecimal.ZERO)==1 ? current : defb),2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            income = wechatIncome.divide((current != null && current.compareTo(BigDecimal.ZERO)==1 ? current : defb),3, RoundingMode.HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             wechatRate = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            income = bankIncome.divide((current != null && current.compareTo(BigDecimal.ZERO)==1 ? current : defb),2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            income = bankIncome.divide((current != null && current.compareTo(BigDecimal.ZERO)==1 ? current : defb),3, RoundingMode.HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             bankRate = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //收入总数 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -454,7 +477,6 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return payTransactionSurveyDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 收费概况 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -568,13 +590,6 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //上一账期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer lastYear = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer lastMonth = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(Integer.valueOf(month) == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                lastYear = year-1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                lastMonth = 12; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                lastYear = year; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                lastMonth = month -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //先获取本年度结算水量(按自然年) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Calendar date = Calendar.getInstance(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -589,31 +604,61 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //去年同一时间累计用水量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             startDate = (currentYear - 1)+"-"+"01"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             endDate = (currentYear - 1)+"-"+String.format("%02d",month); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BigDecimal lastAmount = payChargeSurveyMapper.getAmountInfo(startDate,endDate,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //明天任务,查询汇总表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal lastAmount = payChargeSurveyMapper.getAmountSureyInfo(startDate+"-01"+" 00:00:00",endDate+"-01"+" 00:00:00",siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //BigDecimal lastAmount = payChargeSurveyMapper.getAmountInfo(startDate,endDate,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //计算年同比 = 当前总数-去年同期总数│/去年同期总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String lastYearRate = "0.0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BigDecimal number  = currentAmount.subtract(lastAmount).divide((lastAmount != null && lastAmount.compareTo(BigDecimal.ZERO)==1 ? lastAmount : defb),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //0下降  1商社 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer lastYearIsUp = number.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //保留一位小数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastYearRate = df.format(number); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastYearRate = lastYearRate.contains("-") ? lastYearRate.split("-")[1] : lastYearRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer lastYearIsUp = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal number = defc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //上期总数大于0则计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(lastAmount.compareTo(BigDecimal.ZERO) == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(currentAmount.subtract(lastAmount).compareTo(BigDecimal.ZERO) == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //本期减上期持平显示→ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastYearIsUp = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastYearRate = "→"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    number  = currentAmount.subtract(lastAmount).divide((lastAmount != null && lastAmount.compareTo(BigDecimal.ZERO)==1 ? lastAmount : defb),3, RoundingMode.HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastYearIsUp = number.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //保留一位小数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastYearRate = df.format(number); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastYearRate = lastYearRate.contains("-") ? lastYearRate.split("-")[1] : lastYearRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //小于=0不计算增长率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //0下降  1上升 2不计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lastYearIsUp = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lastYearRate = "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //计算月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //当前月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal currentMAmount = payChargeSurveyMapper.getAmountMonth(year,month,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //去年同月 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BigDecimal lastMAmount = payChargeSurveyMapper.getAmountMonth((year-1),month,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //计算月同比 = 当前总数-上月同期总数│/去年同期总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            number  = currentMAmount.subtract(lastMAmount).divide((lastMAmount != null && lastMAmount.compareTo(BigDecimal.ZERO)==1 ? lastMAmount : defb),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //0下降  1商社 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer lastMonthIsUp = number.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //保留一位小数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal lastMAmount = payChargeSurveyMapper.getAmountMonthSurvey((year-1),month,siteId,customerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer lastMonthIsUp = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String lastMonthRate = "0.0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastMonthRate = df.format(number); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            lastMonthRate = lastMonthRate.contains("-") ? lastMonthRate.split("-")[1] : lastMonthRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(lastMAmount.compareTo(BigDecimal.ZERO) == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(currentMAmount.subtract(lastMAmount).compareTo(BigDecimal.ZERO) == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastMonthIsUp = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastMonthRate = "→"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //计算月同比 = 当前总数-上月同期总数│/去年同期总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    number  = currentMAmount.subtract(lastMAmount).divide((lastMAmount != null && lastMAmount.compareTo(BigDecimal.ZERO)==1 ? lastMAmount : defb),3, RoundingMode.HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //0下降  1商社 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastMonthIsUp = number.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //保留一位小数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastMonthRate = df.format(number); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastMonthRate = lastMonthRate.contains("-") ? lastMonthRate.split("-")[1] : lastMonthRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lastMonthIsUp = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lastMonthRate = "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //最近一年数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<PayAmountSurveyListDto> cList = new ArrayList<PayAmountSurveyListDto>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -660,7 +705,88 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return payAmountSurveyDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 计算较上月 Integer 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param currentAmount 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param lastAmount 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public RecordInfo calculationRate(Integer currentAmount ,Integer lastAmount){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        RecordInfo info = new RecordInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer lastIncomeIsUp = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String lastIncomeRate = "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal income = new BigDecimal("0.0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DecimalFormat df = new DecimalFormat("0.0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        float num = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(lastAmount >0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(currentAmount - lastAmount <=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //本期减上期持平显示→ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastIncomeIsUp = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastIncomeRate = "→"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    num =((float)(currentAmount - lastAmount)/(lastAmount != null && lastAmount != 0 ? lastAmount : 1)*100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastIncomeRate = df.format(num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastIncomeIsUp = num > 0  ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastIncomeRate = lastIncomeRate.contains("-") ? lastIncomeRate.split("-")[1] : lastIncomeRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //小于=0不计算增长率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //0下降  1上升 2不计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lastIncomeIsUp = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lastIncomeRate = "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info.setCount(num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info.setIsUp(lastIncomeIsUp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info.setRate(lastIncomeRate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return info; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     *  计算较上月 BigDecimal 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param currentIncome 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param lastIncome 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public RecordInfo calculationRate(BigDecimal currentIncome,BigDecimal lastIncome){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        RecordInfo info = new RecordInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer lastIncomeIsUp = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String lastIncomeRate = "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal income = new BigDecimal("0.0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal defc = new BigDecimal("0.0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal defb = new BigDecimal("1.0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DecimalFormat df = new DecimalFormat("0.0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(lastIncome.compareTo(BigDecimal.ZERO) == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(currentIncome.subtract(lastIncome).compareTo(BigDecimal.ZERO) == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //本期减上期持平显示→ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastIncomeIsUp = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastIncomeRate = "→"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    income  = currentIncome.subtract(lastIncome).divide((lastIncome != null && lastIncome.compareTo(BigDecimal.ZERO)==1 ? lastIncome : defb),3, RoundingMode.HALF_UP).multiply(new BigDecimal("100")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastIncomeIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //保留一位小数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastIncomeRate = df.format(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //截取字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    lastIncomeRate = lastIncomeRate.contains("-") ? lastIncomeRate.split("-")[1] : lastIncomeRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //小于=0不计算增长率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //0下降  1上升 2不计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lastIncomeIsUp = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lastIncomeRate = "-"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info.setIncome(income); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info.setIsUp(lastIncomeIsUp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            info.setRate(lastIncomeRate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return info; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |