diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java index a418ad54b..9af69dc09 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -305,11 +305,6 @@ public class WxChartServiceImpl implements WxChartDataService { return getSaleDataHistory(tenantId, startdate, enddate); } - //商铺出租率走势 - if (chart.equals(EnumChart.RENT_RATE_HISTORY.getCode())) { - return getRentRateHistory(tenantId); - } - return new ResultData(ErrorCode.REPORT_TYPE_UNKNOWN); @@ -2256,23 +2251,6 @@ public class WxChartServiceImpl implements WxChartDataService { return map; } - public static Map getDateMap2(Date begin, Date end) { - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); - Map map = new LinkedHashMap<>(); - map.put(format.format(begin), "0"); - Calendar calBegin = Calendar.getInstance(); - calBegin.setTime(begin); - Calendar calEnd = Calendar.getInstance(); - calEnd.setTime(end); - calEnd.add(Calendar.DAY_OF_MONTH, -1); - end = calEnd.getTime(); - while (calBegin.getTime().before(end)) { - calBegin.add(Calendar.DAY_OF_MONTH, 1); - map.put(format.format(calBegin.getTime()), "0%"); - } - return map; - } - /** * 首页商铺出租数据 * @param tenantId @@ -2319,25 +2297,12 @@ public class WxChartServiceImpl implements WxChartDataService { datamap.put("notRentTotalPoint",notRentTotalPoint); double totalRentRate = rentTotal/total*100; -// datamap.put("totalPoint",su); - return new ResultData(datamap); - } + datamap.put("notRentTotal",formatDouble(totalRentRate)); + double rentTotalShopRate = rentTotalShop/totalShop*100; + datamap.put("rentTotalShopRate",formatDouble(rentTotalShopRate)); + double rentTotalPointRate = rentTotalPoint/totalPoint*100; + datamap.put("rentTotalPointRate",formatDouble(rentTotalPointRate)); - /** - * 首页商铺出租率走势 - * @param tenantId - * @return - */ - private ResultData getRentRateHistory(String tenantId) { - Map datamap = new LinkedHashMap<>(); - datamap.put("2018/10","10%"); - datamap.put("2018/11","20%"); - datamap.put("2018/12","10%"); - datamap.put("2019/01","10%"); - datamap.put("2019/02","30%"); - datamap.put("2019/03","40%"); - datamap.put("2019/04","10%"); - datamap.put("2019/05","20%"); return new ResultData(datamap); } @@ -2359,14 +2324,13 @@ public class WxChartServiceImpl implements WxChartDataService { params.put("enddate", DateUtils.date2String(endDate,"yyyy-MM-dd") + " 23:59:59"); Map payinfo = wxBillRentMapper.queryPayInfoTotal(params); if (payinfo != null) { - BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); - BigDecimal pay = (BigDecimal) payinfo.get("pay"); + Double receivepay = (Double) payinfo.get("receivepay"); + Double pay = (Double) payinfo.get("pay"); if (receivepay.doubleValue() > 0) { - BigDecimal divide = pay.divide(receivepay, 2, BigDecimal.ROUND_HALF_UP); - double zjcjl = divide.multiply(new BigDecimal(100)).doubleValue(); + Double divide = pay/receivepay*100; datamap.put("rentysje", receivepay); datamap.put("rentssje", pay); - datamap.put("rentzjsjl", zjcjl); + datamap.put("rentzjsjl", formatDouble(divide)); } else { datamap.put("rentysje", 0); datamap.put("rentssje", 0); @@ -2381,14 +2345,13 @@ public class WxChartServiceImpl implements WxChartDataService { //物业费收缴率 payinfo = wxBillPropertyMapper.queryPayInfoTotal(params); if (payinfo != null) { - BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); - BigDecimal pay = (BigDecimal) payinfo.get("pay"); + Double receivepay = (Double) payinfo.get("receivepay"); + Double pay = (Double) payinfo.get("pay"); if (receivepay.doubleValue() > 0) { - BigDecimal divide = pay.divide(receivepay, 2, BigDecimal.ROUND_HALF_UP); - double zjcjl = divide.multiply(new BigDecimal(100)).doubleValue(); + Double divide = pay/receivepay*100; datamap.put("propertyysje", receivepay); datamap.put("propertyssje", pay); - datamap.put("propertyzjsjl", zjcjl); + datamap.put("propertyzjsjl", formatDouble(divide)); } else { datamap.put("propertyysje", 0); datamap.put("propertyssje", 0); @@ -2403,14 +2366,13 @@ public class WxChartServiceImpl implements WxChartDataService { //押金收缴率 payinfo = wxBillDepositMapper.queryPayInfoAllTotal(params); if (payinfo != null) { - BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); - BigDecimal pay = (BigDecimal) payinfo.get("pay"); + Double receivepay = (Double) payinfo.get("receivepay"); + Double pay = (Double) payinfo.get("pay"); if (receivepay.doubleValue() > 0) { - BigDecimal divide = pay.divide(receivepay, 2, BigDecimal.ROUND_HALF_UP); - double zjcjl = divide.multiply(new BigDecimal(100)).doubleValue(); + Double divide = pay/receivepay* 100; datamap.put("depositysje", receivepay); datamap.put("depositssje", pay); - datamap.put("depositzjsjl", zjcjl); + datamap.put("depositzjsjl", formatDouble(divide)); } else { datamap.put("depositysje", 0); datamap.put("depositssje", 0); @@ -2425,14 +2387,13 @@ public class WxChartServiceImpl implements WxChartDataService { //其他费用收缴率 payinfo = wxBillOtherMapper.queryPayInfoTotal(params); if (payinfo != null) { - BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); - BigDecimal pay = (BigDecimal) payinfo.get("pay"); + Double receivepay = (Double) payinfo.get("receivepay"); + Double pay = (Double) payinfo.get("pay"); if (receivepay.doubleValue() > 0) { - BigDecimal divide = pay.divide(receivepay, 2, BigDecimal.ROUND_HALF_UP); - double zjcjl = divide.multiply(new BigDecimal(100)).doubleValue(); + Double divide = pay/receivepay*100; datamap.put("otherysje", receivepay); datamap.put("otherssje", pay); - datamap.put("otherzjsjl", zjcjl); + datamap.put("otherzjsjl",formatDouble(divide)); } else { datamap.put("otherysje", 0); datamap.put("otherssje", 0); @@ -2507,13 +2468,13 @@ public class WxChartServiceImpl implements WxChartDataService { return new ResultData(datamap); } - public static void main(String[] args) { - BigDecimal receivepay = new BigDecimal(33); - BigDecimal pay = new BigDecimal(11); - BigDecimal divide = pay.divide(receivepay, 2, BigDecimal.ROUND_UNNECESSARY); - System.out.println(divide); - double zjcjl = divide.multiply(new BigDecimal(100)).doubleValue(); - System.out.println(zjcjl); + public static double formatDouble(Double d){ + String s = d+""; + String lt = s.substring(s.indexOf("."),s.length()); + if(lt.length() >3){ + s = s.substring(0,s.indexOf(".")+3); + } + return Double.parseDouble(s); } /** @@ -2576,3 +2537,4 @@ public class WxChartServiceImpl implements WxChartDataService { } +