|
@@ -47,12 +47,19 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
|
|
|
Date lastStartMonth = startDate.getTime(); //结果
|
|
|
String lastStart = sdf.format(lastStartMonth);
|
|
|
System.out.println("时间:"+lastStart);*/
|
|
|
- DecimalFormat df = new DecimalFormat("0.0");
|
|
|
+ /*DecimalFormat df = new DecimalFormat("0.0");
|
|
|
BigDecimal currentIncome = new BigDecimal("100");
|
|
|
BigDecimal lastIncome = new BigDecimal("80");
|
|
|
BigDecimal income = currentIncome.subtract(lastIncome).divide(lastIncome).multiply(new BigDecimal("100"));
|
|
|
String a = df.format(income);
|
|
|
- System.out.println("收入费率:"+a);
|
|
|
+ System.out.println("收入费率:"+a);*/
|
|
|
+
|
|
|
+ String a = "-90.89";
|
|
|
+ String b = "90.89";
|
|
|
+
|
|
|
+ String a1 = a.split("-")[1];
|
|
|
+ String b1 = b.split("-")[1];
|
|
|
+ System.out.println("带负数转换:"+a1+";不带负数转换:"+b1);
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -106,7 +113,13 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
|
|
|
String lastAccountRate = "";
|
|
|
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;
|
|
|
+
|
|
|
//赋值客户总数跟上月比率
|
|
|
+ payChargeSurveyDto.setLastAccountIsUp(lastAccountIsUp);
|
|
|
payChargeSurveyDto.setAccountNumber(sumAccount);
|
|
|
payChargeSurveyDto.setLastAccountRate(lastAccountRate);
|
|
|
|
|
@@ -122,7 +135,11 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
|
|
|
String lastMeterRate = "";
|
|
|
num =(float)((sumCurrentMeter - sumLastMeter)/(sumLastMeter != null && sumLastMeter != 0 ? sumLastMeter : 1)*100);
|
|
|
lastMeterRate = df.format(num);
|
|
|
+ Integer lastMeterIsUp = num > 0 ? 1 : 0;
|
|
|
+ //截取字符串
|
|
|
+ lastMeterRate = lastMeterRate.contains("-") ? lastMeterRate.split("-")[1] : lastMeterRate;
|
|
|
//赋值水表总数跟上月比率
|
|
|
+ payChargeSurveyDto.setLastMeterIsUp(lastMeterIsUp);
|
|
|
payChargeSurveyDto.setMeterNumber(sumMeter);
|
|
|
payChargeSurveyDto.setLastMeterRate(lastMeterRate);
|
|
|
|
|
@@ -137,7 +154,11 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
|
|
|
String lastCusstomerRate = "";
|
|
|
num =(float)((sumCurrentCustomer - sumLastCustomer)/(sumLastCustomer != null && sumLastCustomer != 0 ? sumLastCustomer : 1)*100);
|
|
|
lastCusstomerRate = df.format(num);
|
|
|
+ Integer lastCustomerIsUp = num > 0 ? 1 : 0;
|
|
|
+ //截取字符串
|
|
|
+ lastCusstomerRate = lastCusstomerRate.contains("-") ? lastCusstomerRate.split("-")[1] : lastCusstomerRate;
|
|
|
//赋值开户总数跟上月比率
|
|
|
+ payChargeSurveyDto.setLastCustomerIsUp(lastCustomerIsUp);
|
|
|
payChargeSurveyDto.setCustomerNumber(sumCustomer);
|
|
|
payChargeSurveyDto.setLastCustomerRate(lastCusstomerRate);
|
|
|
|
|
@@ -146,6 +167,7 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
|
|
|
String customerRate = "";
|
|
|
num =(float)(sumCurrentCustomer/(sumCurrentMeter != null && sumCurrentMeter != 0 ? sumCurrentMeter : 1)*100);
|
|
|
customerRate = df.format(num);
|
|
|
+ customerRate = customerRate.contains("-") ? customerRate.split("-")[1] : customerRate;
|
|
|
payChargeSurveyDto.setCustomerRate(customerRate);
|
|
|
|
|
|
|
|
@@ -318,6 +340,9 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
|
|
|
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 = "";
|
|
|
lastIncomeRate = df.format(income);
|
|
|
+ Integer lastIncomeIsUp = income.compareTo(BigDecimal.ZERO) == 1 ? 1 : 0;
|
|
|
+ //截取字符串
|
|
|
+ lastIncomeRate = lastIncomeRate.contains("-") ? lastIncomeRate.split("-")[1] : lastIncomeRate;
|
|
|
|
|
|
//按支付方式
|
|
|
cashIncome = transactionSurver.getCashIncome();//本账期现金收入
|
|
@@ -331,18 +356,30 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
|
|
|
//现金
|
|
|
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 = 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;
|
|
|
|
|
|
//支付宝
|
|
|
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;
|
|
|
|
|
|
//银行
|
|
|
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;
|
|
|
|
|
|
//饼状态占比率
|
|
|
BigDecimal current = alipayIncome.add(wechatIncome).add(bankIncome).add(cashIncome);
|
|
@@ -363,17 +400,22 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
|
|
|
bankRate = df.format(income);
|
|
|
|
|
|
//收入总数
|
|
|
+ payTransactionSurveyDto.setLastIncomeIsUp(lastIncomeIsUp);
|
|
|
payTransactionSurveyDto.setIncomeNumber(currentIncome);
|
|
|
payTransactionSurveyDto.setLastIncomeRate(lastIncomeRate);
|
|
|
//按支付方式
|
|
|
payTransactionSurveyDto.setCashIncome(cashIncome);
|
|
|
payTransactionSurveyDto.setLastCashRate(lastCashRate);
|
|
|
+ payTransactionSurveyDto.setLastCashIsUp(lastCashIsUp);
|
|
|
payTransactionSurveyDto.setWechatIncome(wechatIncome);
|
|
|
payTransactionSurveyDto.setLastWechatRate(lastWechatRate);
|
|
|
+ payTransactionSurveyDto.setLastWechatIsUp(lastWechatIsUp);
|
|
|
payTransactionSurveyDto.setAlipayIncome(alipayIncome);
|
|
|
payTransactionSurveyDto.setLastAlipayRate(lastAlipayRate);
|
|
|
+ payTransactionSurveyDto.setLastAlipayIsUp(lastAlipayIsUp);
|
|
|
payTransactionSurveyDto.setBankIncome(bankIncome);
|
|
|
payTransactionSurveyDto.setLastBankRate(lastBankRate);
|
|
|
+ payTransactionSurveyDto.setLastBankIsUp(lastBankIsUp);
|
|
|
//饼状图
|
|
|
payTransactionSurveyDto.setCashRate(CashRate);
|
|
|
payTransactionSurveyDto.setAlipayRate(alipayRate);
|
|
@@ -390,6 +432,10 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 收费概况
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public PayFeeSueveyDto feeSurvey(){
|
|
|
PayFeeSueveyDto payFeeSveveyDto = new PayFeeSueveyDto();
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
@@ -461,5 +507,119 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
|
|
|
return payFeeSveveyDto;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 水量概况
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public PayAmountSurveyDto amountSurver(){
|
|
|
+ PayAmountSurveyDto payAmountSurveyDto = new PayAmountSurveyDto();
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
|
|
|
+ BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
|
|
|
+ BigDecimal defb = new BigDecimal("1.0");
|
|
|
+ BigDecimal defc = new BigDecimal("0.0");
|
|
|
+ DecimalFormat df = new DecimalFormat("0.0");
|
|
|
+ try {
|
|
|
+ List<BaseClosingAccountInfoDto> closinList = baseClosingAccountInfoMapper.getList(null,null,
|
|
|
+ siteId,customerId,null);
|
|
|
+ Integer year = closinList.get(0).getYear();
|
|
|
+ Integer month = closinList.get(0).getMonth();
|
|
|
+ //上一账期
|
|
|
+ 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();
|
|
|
+ //当前年
|
|
|
+ Integer currentYear = Integer.valueOf(date.get(Calendar.YEAR));
|
|
|
+ //当前月
|
|
|
+ Integer currentMont = Integer.valueOf(date.get(Calendar.MONTH));
|
|
|
+ String startDate = currentYear+"-"+"01";
|
|
|
+ String endDate = currentYear+"-"+String.format("%02d",month);
|
|
|
+ //当前年月累计用水量
|
|
|
+ BigDecimal currentAmount = payChargeSurveyMapper.getAmountInfo(startDate,endDate,siteId,customerId);
|
|
|
+ //去年同一时间累计用水量
|
|
|
+ startDate = (currentYear - 1)+"-"+"01";
|
|
|
+ endDate = (currentYear - 1)+"-"+String.format("%02d",month);
|
|
|
+ BigDecimal lastAmount = payChargeSurveyMapper.getAmountInfo(startDate,endDate,siteId,customerId);
|
|
|
+ //计算年同比 = 当前总数-去年同期总数│/去年同期总数
|
|
|
+ String lastYearRate = "";
|
|
|
+ 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;
|
|
|
+
|
|
|
+ //计算月
|
|
|
+ //当前月
|
|
|
+ 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;
|
|
|
+ //保留一位小数
|
|
|
+ String lastMonthRate = "";
|
|
|
+ lastMonthRate = df.format(number);
|
|
|
+ //截取字符串
|
|
|
+ lastMonthRate = lastMonthRate.contains("-") ? lastMonthRate.split("-")[1] : lastMonthRate;
|
|
|
+
|
|
|
+ //最近一年数据
|
|
|
+ List<PayAmountSurveyListDto> cList = new ArrayList<PayAmountSurveyListDto>();
|
|
|
+ PayAmountSurveyListDto dto = new PayAmountSurveyListDto();
|
|
|
+ dto.setPeriodDate(currentYear+"-"+String.format("%02d",month));
|
|
|
+ dto.setYear(currentYear);
|
|
|
+ dto.setMonth(month);
|
|
|
+ dto.setSumAmount(currentMAmount);
|
|
|
+ cList.add(dto);
|
|
|
+ List<PayAmountSurveyListDto> list = payChargeSurveyMapper.getAmountGroupList(null,null,siteId,customerId);
|
|
|
+ cList.addAll(list);
|
|
|
+ PayAmountSurveyListDto a = cList.get(cList.size() - 1);
|
|
|
+ Integer num = a.getMonth();
|
|
|
+ lastYear = a.getYear();
|
|
|
+ lastMonth = a.getMonth();
|
|
|
+ for(int i=cList.size(); i<=11; i++ ){
|
|
|
+ num--;
|
|
|
+ if(num == 0){
|
|
|
+ lastYear = lastYear-1;
|
|
|
+ lastMonth = 12;
|
|
|
+ num = 12;
|
|
|
+ }else{
|
|
|
+ lastYear = lastYear;
|
|
|
+ lastMonth = num;
|
|
|
+ }
|
|
|
+ PayAmountSurveyListDto adto = new PayAmountSurveyListDto();
|
|
|
+ adto.setPeriodDate(lastYear+"-"+String.format("%02d",lastMonth));
|
|
|
+ adto.setYear(lastYear);
|
|
|
+ adto.setMonth(lastMonth);
|
|
|
+ adto.setSumAmount(defc);
|
|
|
+ cList.add(adto);
|
|
|
+ }
|
|
|
+ payAmountSurveyDto .setList(cList);
|
|
|
+ payAmountSurveyDto.setSumYearAmount(currentAmount);
|
|
|
+ payAmountSurveyDto.setLastYearIsUp(lastYearIsUp);
|
|
|
+ payAmountSurveyDto.setLastYearRate(lastYearRate);
|
|
|
+ payAmountSurveyDto.setSumMonthAmount(currentMAmount);
|
|
|
+ payAmountSurveyDto.setLastMonthRate(lastMonthRate);
|
|
|
+ payAmountSurveyDto.setLastMontIsUp(lastMonthIsUp);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ return payAmountSurveyDto;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|