| @@ -57,6 +57,7 @@ public enum EnumChart { | |||||
| INDEX_SHOP_RENT(49, "商铺出租数据"), | INDEX_SHOP_RENT(49, "商铺出租数据"), | ||||
| INDEX_BILL_RECE_RATE(50, "费用收缴数据"), | |||||
| ; | ; | ||||
| public static EnumChart getEnum(Integer code) { | public static EnumChart getEnum(Integer code) { | ||||
| @@ -18,6 +18,10 @@ public interface WxBillDepositMapper extends CommonMapper<WxBillDeposit, Long> { | |||||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | Map<String,Object> queryPayInfo(Map<String,Object> params); | ||||
| Map<String,Object> queryOweInfoAll(Map<String,Object> params); | |||||
| Map<String,Object> queryPayInfoAll(Map<String,Object> params); | |||||
| void updateNotPaidStatus(Map<String,Object> params); | void updateNotPaidStatus(Map<String,Object> params); | ||||
| void updateWaitPayStatus(Map<String,Object> params); | void updateWaitPayStatus(Map<String,Object> params); | ||||
| @@ -19,4 +19,7 @@ public interface WxBillOtherMapper extends CommonMapper<WxBillOther, Long> { | |||||
| List<Map<String,Object>> queryBillList(WxBillOther record); | List<Map<String,Object>> queryBillList(WxBillOther record); | ||||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | |||||
| Map<String,Object> queryOweInfo(Map<String,Object> params); | |||||
| } | } | ||||
| @@ -20,6 +20,8 @@ public interface WxBillPropertyMapper extends CommonMapper<WxBillProperty, Long> | |||||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | Map<String,Object> queryPayInfo(Map<String,Object> params); | ||||
| Map<String,Object> queryOweInfo(Map<String,Object> params); | |||||
| void updateNotPaidStatus(Map<String,Object> params); | void updateNotPaidStatus(Map<String,Object> params); | ||||
| void updateWaitPayStatus(Map<String,Object> params); | void updateWaitPayStatus(Map<String,Object> params); | ||||
| @@ -18,6 +18,8 @@ public interface WxBillRentMapper extends CommonMapper<WxBillRent, Long> { | |||||
| Map<String,Object> queryPayInfo(Map<String,Object> params); | Map<String,Object> queryPayInfo(Map<String,Object> params); | ||||
| Map<String,Object> queryOweInfo(Map<String,Object> params); | |||||
| void updateNotPaidStatus(Map<String,Object> params); | void updateNotPaidStatus(Map<String,Object> params); | ||||
| void updateWaitPayStatus(Map<String,Object> params); | void updateWaitPayStatus(Map<String,Object> params); | ||||
| @@ -63,6 +63,12 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| WxCouponService wxCouponService; | WxCouponService wxCouponService; | ||||
| @Autowired | @Autowired | ||||
| WxOrderGroupMapper wxOrderGroupMapper; | WxOrderGroupMapper wxOrderGroupMapper; | ||||
| @Autowired | |||||
| WxBillPropertyMapper wxBillPropertyMapper; | |||||
| @Autowired | |||||
| WxBillDepositMapper wxBillDepositMapper; | |||||
| @Autowired | |||||
| WxBillOtherMapper wxBillOtherMapper; | |||||
| @Override | @Override | ||||
| public ResultData queryData(Map<String, String> paramsMap) { | public ResultData queryData(Map<String, String> paramsMap) { | ||||
| @@ -279,6 +285,11 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| return getIndexShopRentData(tenantId, startdate); | return getIndexShopRentData(tenantId, startdate); | ||||
| } | } | ||||
| //首页商铺出租数据 | |||||
| if (chart.equals(EnumChart.INDEX_BILL_RECE_RATE.getCode())) { | |||||
| return getBillReceRate(tenantId, startdate); | |||||
| } | |||||
| return new ResultData(ErrorCode.REPORT_TYPE_UNKNOWN); | return new ResultData(ErrorCode.REPORT_TYPE_UNKNOWN); | ||||
| } | } | ||||
| @@ -2244,4 +2255,148 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| datamap.put("notRentTotalPoint",notRentTotalPoint); | datamap.put("notRentTotalPoint",notRentTotalPoint); | ||||
| return new ResultData(datamap); | return new ResultData(datamap); | ||||
| } | } | ||||
| /** | |||||
| * 费用收缴数据 | |||||
| * @param tenantId | |||||
| * @return | |||||
| */ | |||||
| private ResultData getBillReceRate(String tenantId, String startDateStr) { | |||||
| HashMap<String, Object> datamap = new HashMap<>(); | |||||
| Date startDate = DateUtils.getDateFromString(startDateStr+"-01","yyyy-MM-dd").getTime(); | |||||
| Date endDate = DateUtils.getLastDayForMonth(startDate); | |||||
| //租金收缴率 | |||||
| Map<String, Object> params = new HashMap<>(); | |||||
| params.put("tenantId", tenantId); | |||||
| params.put("startdate", startDateStr + " 00:00:00"); | |||||
| params.put("enddate", DateUtils.date2String(endDate,"yyyy-MM-dd") + " 23:59:59"); | |||||
| Map<String, Object> payinfo = wxBillRentMapper.queryPayInfo(params); | |||||
| if (payinfo != null) { | |||||
| BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); | |||||
| BigDecimal pay = (BigDecimal) 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(); | |||||
| datamap.put("rentysje", receivepay); | |||||
| datamap.put("rentssje", pay); | |||||
| datamap.put("rentzjsjl", zjcjl); | |||||
| } else { | |||||
| datamap.put("rentysje", 0); | |||||
| datamap.put("rentssje", 0); | |||||
| datamap.put("rentzjsjl", 0); | |||||
| } | |||||
| } else { | |||||
| datamap.put("rentysje", 0); | |||||
| datamap.put("rentssje", 0); | |||||
| datamap.put("rentzjsjl", 0); | |||||
| } | |||||
| //物业费收缴率 | |||||
| payinfo = wxBillPropertyMapper.queryPayInfo(params); | |||||
| if (payinfo != null) { | |||||
| BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); | |||||
| BigDecimal pay = (BigDecimal) 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(); | |||||
| datamap.put("propertyysje", receivepay); | |||||
| datamap.put("propertyssje", pay); | |||||
| datamap.put("propertyzjsjl", zjcjl); | |||||
| } else { | |||||
| datamap.put("propertyysje", 0); | |||||
| datamap.put("propertyssje", 0); | |||||
| datamap.put("propertyzjsjl", 0); | |||||
| } | |||||
| } else { | |||||
| datamap.put("propertyysje", 0); | |||||
| datamap.put("propertyssje", 0); | |||||
| datamap.put("propertyzjsjl", 0); | |||||
| } | |||||
| //押金收缴率 | |||||
| payinfo = wxBillDepositMapper.queryPayInfoAll(params); | |||||
| if (payinfo != null) { | |||||
| BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); | |||||
| BigDecimal pay = (BigDecimal) 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(); | |||||
| datamap.put("depositysje", receivepay); | |||||
| datamap.put("depositssje", pay); | |||||
| datamap.put("propertyzjsjl", zjcjl); | |||||
| } else { | |||||
| datamap.put("depositysje", 0); | |||||
| datamap.put("depositssje", 0); | |||||
| datamap.put("depositzjsjl", 0); | |||||
| } | |||||
| } else { | |||||
| datamap.put("depositysje", 0); | |||||
| datamap.put("depositssje", 0); | |||||
| datamap.put("depositzjsjl", 0); | |||||
| } | |||||
| //其他费用收缴率 | |||||
| payinfo = wxBillOtherMapper.queryPayInfo(params); | |||||
| if (payinfo != null) { | |||||
| BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); | |||||
| BigDecimal pay = (BigDecimal) 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(); | |||||
| datamap.put("otherysje", receivepay); | |||||
| datamap.put("otherssje", pay); | |||||
| datamap.put("otherzjsjl", zjcjl); | |||||
| } else { | |||||
| datamap.put("otherysje", 0); | |||||
| datamap.put("otherssje", 0); | |||||
| datamap.put("otherzjsjl", 0); | |||||
| } | |||||
| } else { | |||||
| datamap.put("otherysje", 0); | |||||
| datamap.put("otheryssje", 0); | |||||
| datamap.put("otherzjsjl", 0); | |||||
| } | |||||
| //欠缴数据 | |||||
| BigDecimal totalOwe = new BigDecimal(0); | |||||
| payinfo = wxBillRentMapper.queryOweInfo(params); | |||||
| if (payinfo != null) { | |||||
| BigDecimal owe = (BigDecimal) payinfo.get("owe"); | |||||
| totalOwe.add(owe); | |||||
| datamap.put("rentOwe", owe); | |||||
| } else { | |||||
| datamap.put("rentOwe", 0); | |||||
| } | |||||
| payinfo = wxBillPropertyMapper.queryOweInfo(params); | |||||
| if (payinfo != null) { | |||||
| BigDecimal owe = (BigDecimal) payinfo.get("owe"); | |||||
| totalOwe.add(owe); | |||||
| datamap.put("propertyOwe", owe); | |||||
| } else { | |||||
| datamap.put("propertyOwe", 0); | |||||
| } | |||||
| payinfo = wxBillOtherMapper.queryOweInfo(params); | |||||
| if (payinfo != null) { | |||||
| BigDecimal owe = (BigDecimal) payinfo.get("owe"); | |||||
| totalOwe.add(owe); | |||||
| datamap.put("otherOwe", owe); | |||||
| } else { | |||||
| datamap.put("otherOwe", 0); | |||||
| } | |||||
| payinfo = wxBillDepositMapper.queryOweInfoAll(params); | |||||
| if (payinfo != null) { | |||||
| BigDecimal owe = (BigDecimal) payinfo.get("owe"); | |||||
| totalOwe.add(owe); | |||||
| datamap.put("depositOwe", owe); | |||||
| } else { | |||||
| datamap.put("depositOwe", 0); | |||||
| } | |||||
| datamap.put("totalOwe", totalOwe); | |||||
| return new ResultData(datamap); | |||||
| } | |||||
| } | } | ||||
| @@ -610,18 +610,31 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| instance.setTime(firstDay); | instance.setTime(firstDay); | ||||
| //最后一期有余,加上残月,(不整除时,最后一个月有余,否则为0) | //最后一期有余,加上残月,(不整除时,最后一个月有余,否则为0) | ||||
| if(receivePeriod > 1) { | if(receivePeriod > 1) { | ||||
| instance.add(dayType, extralease); | |||||
| if(isLastYesr) { | |||||
| instance.add(dayType, extralease); | |||||
| }else{ | |||||
| instance.add(dayType, receivePeriod); | |||||
| } | |||||
| } | |||||
| if(isLastYesr) { | |||||
| instance.add(Calendar.DAY_OF_MONTH, rentStartDateInt - 1); | |||||
| } | } | ||||
| instance.add(Calendar.DAY_OF_MONTH, rentStartDateInt-1); | |||||
| instance.add(Calendar.DAY_OF_MONTH, -1); | instance.add(Calendar.DAY_OF_MONTH, -1); | ||||
| wxBillProperty.setEndtime(instance.getTime()); | wxBillProperty.setEndtime(instance.getTime()); | ||||
| //逻辑同计算endtime | |||||
| double needPayDouble = 0; | double needPayDouble = 0; | ||||
| double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxBillProperty.getEndtime()); | double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxBillProperty.getEndtime()); | ||||
| if(receivePeriod > 1) { | if(receivePeriod > 1) { | ||||
| needPayDouble += price * extralease; | |||||
| if(isLastYesr) { | |||||
| needPayDouble += price * extralease; | |||||
| }else{ | |||||
| needPayDouble += price * receivePeriod; | |||||
| } | |||||
| } | |||||
| if(isLastYesr) { | |||||
| needPayDouble += oneDayProce * endDateInt; | |||||
| } | } | ||||
| needPayDouble += oneDayProce * endDateInt; | |||||
| DecimalFormat format = new DecimalFormat("0"); | DecimalFormat format = new DecimalFormat("0"); | ||||
| needpay = Integer.parseInt(format.format(needPayDouble)); //分做四舍五入 | needpay = Integer.parseInt(format.format(needPayDouble)); //分做四舍五入 | ||||
| } | } | ||||
| @@ -945,18 +945,31 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| instance.setTime(firstDay); | instance.setTime(firstDay); | ||||
| //最后一期有余,加上残月,(不整除时,最后一个月有余,否则为0) | //最后一期有余,加上残月,(不整除时,最后一个月有余,否则为0) | ||||
| if(receivePeriod > 1) { | if(receivePeriod > 1) { | ||||
| instance.add(dayType, extralease); | |||||
| if(isLastYesr) { | |||||
| instance.add(dayType, extralease); | |||||
| }else{ | |||||
| instance.add(dayType, receivePeriod); | |||||
| } | |||||
| } | |||||
| if(isLastYesr) { | |||||
| instance.add(Calendar.DAY_OF_MONTH, rentStartDateInt - 1); | |||||
| } | } | ||||
| instance.add(Calendar.DAY_OF_MONTH, rentStartDateInt-1); | |||||
| instance.add(Calendar.DAY_OF_MONTH, -1); | instance.add(Calendar.DAY_OF_MONTH, -1); | ||||
| wxBillRent.setEndtime(instance.getTime()); | wxBillRent.setEndtime(instance.getTime()); | ||||
| //逻辑同计算endtime | |||||
| double needPayDouble = 0; | double needPayDouble = 0; | ||||
| double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxBillRent.getEndtime()); | double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxBillRent.getEndtime()); | ||||
| if(receivePeriod > 1) { | if(receivePeriod > 1) { | ||||
| needPayDouble += price * extralease; | |||||
| if(isLastYesr) { | |||||
| needPayDouble += price * extralease; | |||||
| }else{ | |||||
| needPayDouble += price * receivePeriod; | |||||
| } | |||||
| } | |||||
| if(isLastYesr) { | |||||
| needPayDouble += oneDayProce * endDateInt; | |||||
| } | } | ||||
| needPayDouble += oneDayProce * endDateInt; | |||||
| DecimalFormat format = new DecimalFormat("0"); | DecimalFormat format = new DecimalFormat("0"); | ||||
| needpay = Integer.parseInt(format.format(needPayDouble)); //分做四舍五入 | needpay = Integer.parseInt(format.format(needPayDouble)); //分做四舍五入 | ||||
| } | } | ||||
| @@ -96,7 +96,38 @@ | |||||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | ||||
| group by tenant_id | group by tenant_id | ||||
| </select> | </select> | ||||
| <select id="queryPayInfoAll" resultType="hashmap" parameterType="hashmap"> | |||||
| select sum(res.receivepay) receivepay,sum(res.pay) pay,res.tenant_id from | |||||
| ( | |||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent_deposit | |||||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||||
| union all | |||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property_deposit | |||||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||||
| union all | |||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_other_deposit | |||||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||||
| ) res | |||||
| group by res.tenant_id | |||||
| </select> | |||||
| <select id="queryOweInfoAll" resultType="hashmap" parameterType="hashmap"> | |||||
| select sum(res.owe) owe,res.tenant_id from | |||||
| ( | |||||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_rent_deposit | |||||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||||
| union all | |||||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_property_deposit | |||||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||||
| union all | |||||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_other_deposit | |||||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||||
| ) res | |||||
| group by res.tenant_id | |||||
| </select> | |||||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | <update id="updateNotPaidStatus" parameterType="hashmap"> | ||||
| update wx_bill_rent_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | update wx_bill_rent_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | ||||
| where tenant_id=#{tenantId} and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0 | where tenant_id=#{tenantId} and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0 | ||||
| @@ -96,9 +96,19 @@ | |||||
| update wx_bill_other set status=#{waitPay} where tenant_id=#{tenantId} | update wx_bill_other set status=#{waitPay} where tenant_id=#{tenantId} | ||||
| and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | ||||
| </update> | </update> | ||||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_other | |||||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | |||||
| group by tenant_id | |||||
| </select> | |||||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | |||||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_other | |||||
| where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||||
| group by tenant_id | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -117,6 +117,12 @@ | |||||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} and is_preview = 0 | where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} and is_preview = 0 | ||||
| group by tenant_id | group by tenant_id | ||||
| </select> | </select> | ||||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | |||||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_property | |||||
| where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||||
| group by tenant_id | |||||
| </select> | |||||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | <update id="updateNotPaidStatus" parameterType="hashmap"> | ||||
| update wx_bill_property set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | update wx_bill_property set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | ||||
| @@ -121,6 +121,12 @@ | |||||
| where tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | where tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | ||||
| group by tenant_id | group by tenant_id | ||||
| </select> | </select> | ||||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | |||||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_rent | |||||
| where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||||
| group by tenant_id | |||||
| </select> | |||||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | <update id="updateNotPaidStatus" parameterType="hashmap"> | ||||
| update wx_bill_rent set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | update wx_bill_rent set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | ||||
| @@ -161,4 +167,6 @@ | |||||
| and br.status = 1 and c.id = #{contractId} | and br.status = 1 and c.id = #{contractId} | ||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||