| @@ -0,0 +1,45 @@ | |||||
| package com.iformall.controller; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxPropertyContract; | |||||
| import com.iformall.domain.vo.WxBillAll; | |||||
| import com.iformall.service.WxBillAllService; | |||||
| import com.iformall.service.WxPropertyContractService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("wxBillAll") | |||||
| public class WxBillAllController extends BaseController | |||||
| { | |||||
| @Autowired | |||||
| private WxBillAllService wxBillAllService; | |||||
| private Logger logger = LoggerFactory.getLogger(WxBillAllController.class); | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||||
| public ResultData list(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxBillAll){ | |||||
| wxBillAll = new WxBillAll(); | |||||
| } | |||||
| wxBillAll.setTenantId(getTenantId()); | |||||
| Map<String, Object> result = wxBillAllService.listAsPage(wxBillAll, pageNum, pageSize); | |||||
| return new ResultData(result); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,62 @@ | |||||
| package com.iformall.domain.vo; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public class WxBillAll { | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||||
| private String tenantId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户名称",name="merchantName") | |||||
| private String merchantName; | |||||
| @io.swagger.annotations.ApiModelProperty(value="账单类型",name="billTypeValue") | |||||
| private Integer billTypeValue; | |||||
| @io.swagger.annotations.ApiModelProperty(value="状态",name="status") | |||||
| private Integer status; | |||||
| @io.swagger.annotations.ApiModelProperty(value="日期",name="month") | |||||
| private String month; | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String tenantId) { | |||||
| this.tenantId = tenantId; | |||||
| } | |||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| public Integer getBillTypeValue() { | |||||
| return billTypeValue; | |||||
| } | |||||
| public void setBillTypeValue(Integer billTypeValue) { | |||||
| this.billTypeValue = billTypeValue; | |||||
| } | |||||
| public Integer getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(Integer status) { | |||||
| this.status = status; | |||||
| } | |||||
| public String getMonth() { | |||||
| return month; | |||||
| } | |||||
| public void setMonth(String month) { | |||||
| this.month = month; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,22 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.MallPermission; | |||||
| import com.iformall.domain.vo.WxBillAll; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public interface WxBillAllMapper extends CommonMapper<MallPermission, String> { | |||||
| List<Map<String,Object>> list(WxBillAll record); | |||||
| Map<String,Object> queryOweInfo(WxBillAll record); | |||||
| Map<String,Object> queryPaidInfo(WxBillAll record); | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.service; | |||||
| import com.iformall.domain.vo.WxBillAll; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public interface WxBillAllService { | |||||
| Map<String,Object> listAsPage(WxBillAll wxBillAll, Integer pageNum, Integer pageSize); | |||||
| } | |||||
| @@ -0,0 +1,57 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.vo.WxBillAll; | |||||
| import com.iformall.enums.EnumBillRentStatus; | |||||
| import com.iformall.enums.EnumRentContractStatus; | |||||
| import com.iformall.mapper.WxBillAllMapper; | |||||
| import com.iformall.service.WxBillAllService; | |||||
| import com.iformall.utils.DateUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| @Service | |||||
| public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| private Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxBillAllMapper wxBillAllMapper; | |||||
| @Override | |||||
| public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { | |||||
| String month=DateUtils.getSystemTime("yyyy-MM"); | |||||
| Object billInfo = getBillInfo(record.getTenantId(),month); | |||||
| record.setMonth(month); | |||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| List<Map<String, Object>> rentContractData = wxBillAllMapper.list(record); | |||||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(rentContractData); | |||||
| Map<String, Object> result = new HashMap<>(); | |||||
| result.put("billInfo", billInfo); | |||||
| result.put("pageInfo", pageInfo); | |||||
| return result; | |||||
| } | |||||
| private Object getBillInfo(String tenantId,String month) { | |||||
| WxBillAll record = new WxBillAll(); | |||||
| record.setTenantId(tenantId); | |||||
| record.setMonth(month); | |||||
| record.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); | |||||
| Map<String, Object> oweInfo = wxBillAllMapper.queryOweInfo(record); | |||||
| record.setStatus(EnumBillRentStatus.PAID.getCode()); | |||||
| Map<String, Object> paidInfo = wxBillAllMapper.queryPaidInfo(record); | |||||
| Map<String, Object> result = new HashMap<>(); | |||||
| result.putAll(oweInfo); | |||||
| result.putAll(paidInfo); | |||||
| return result; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,75 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxBillAllMapper"> | |||||
| <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | |||||
| select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | |||||
| bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate, | |||||
| bill.expired_day expiredDay,bill.status,bill.tenant_id tenantId,m.name merchantName,s.shop_number shopNumber from ( | |||||
| select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type, '' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=1 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=2 | |||||
| ) bill | |||||
| left join wx_merchant m on bill.merchant_id=m.id | |||||
| left join wx_shop s on bill.shop_id=s.id | |||||
| where date_format(bill.receive_date,'%Y-%m')=#{month} and bill.tenant_id=#{tenantId} | |||||
| <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if> | |||||
| <if test=" null != billTypeValue ">and bill.bill_type_value = #{billTypeValue}</if> | |||||
| <if test=" null != status ">and bill.`status` = #{status}</if> | |||||
| order by bill.id,bill.merchant_id | |||||
| </select> | |||||
| <select id="queryOweInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | |||||
| select count(bill.id) owncount,sum(bill.owe) owe from ( | |||||
| select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type, '' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=1 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=2 | |||||
| ) bill | |||||
| where date_format(bill.receive_date,'%Y-%m')=#{month} and bill.tenant_id=#{tenantId} | |||||
| and bill.status=#{status} | |||||
| </select> | |||||
| <select id="queryPaidInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | |||||
| select count(bill.id) paycount,sum(bill.pay) pay from ( | |||||
| select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property_deposit | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type, '' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=1 | |||||
| union | |||||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=2 | |||||
| ) bill | |||||
| where date_format(bill.receive_date,'%Y-%m')=#{month} and bill.tenant_id=#{tenantId} | |||||
| and bill.status=#{status} | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -150,6 +150,7 @@ | |||||
| and rc.id not in (select pc.rent_contract_id from ( | and rc.id not in (select pc.rent_contract_id from ( | ||||
| select rent_contract_id from wx_property_contract where status not in(1,6,7) and tenant_id=#{tenantId} | select rent_contract_id from wx_property_contract where status not in(1,6,7) and tenant_id=#{tenantId} | ||||
| ) pc) | ) pc) | ||||
| </select> | </select> | ||||