| @@ -0,0 +1,39 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.service.WxBillAllService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @Api(description = "账单") | |||
| @RequestMapping("/api/bill") | |||
| public class WxBillController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxBillAllService wxBillAllService; | |||
| @ApiOperation("所有欠缴和待缴的数据") | |||
| @PostMapping("listBillOweAndWaitPay") | |||
| public ResultData listBillOweAndWaitPay(@RequestBody WxBillAll wxBillAll) { | |||
| List<Map<String,Object>> result=wxBillAllService.listBillOweAndWaitPay(wxBillAll); | |||
| return new ResultData(result); | |||
| } | |||
| } | |||
| @@ -1,5 +1,8 @@ | |||
| package com.iformall.domain.vo; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @@ -20,6 +23,83 @@ public class WxBillAll { | |||
| @io.swagger.annotations.ApiModelProperty(value="日期",name="month") | |||
| private String month; | |||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="starttime") | |||
| private Date starttime; | |||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") | |||
| private Date endtime; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户Id",name="merchantId") | |||
| private Long merchantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="多个状态",name="statusList") | |||
| private List<Integer> statusList; | |||
| @io.swagger.annotations.ApiModelProperty(value="多个账单类型",name="typeList") | |||
| private List<Integer> typeList; | |||
| @io.swagger.annotations.ApiModelProperty(value="页码",name="pageIndex") | |||
| private Integer pageIndex; | |||
| @io.swagger.annotations.ApiModelProperty(value="条数",name="pageSize") | |||
| private Integer pageSize; | |||
| public Integer getPageIndex() { | |||
| return pageIndex; | |||
| } | |||
| public void setPageIndex(Integer pageIndex) { | |||
| this.pageIndex = pageIndex; | |||
| } | |||
| public Integer getPageSize() { | |||
| return pageSize; | |||
| } | |||
| public void setPageSize(Integer pageSize) { | |||
| this.pageSize = pageSize; | |||
| } | |||
| public List<Integer> getStatusList() { | |||
| return statusList; | |||
| } | |||
| public void setStatusList(List<Integer> statusList) { | |||
| this.statusList = statusList; | |||
| } | |||
| public List<Integer> getTypeList() { | |||
| return typeList; | |||
| } | |||
| public void setTypeList(List<Integer> typeList) { | |||
| this.typeList = typeList; | |||
| } | |||
| public Date getStarttime() { | |||
| return starttime; | |||
| } | |||
| public void setStarttime(Date starttime) { | |||
| this.starttime = starttime; | |||
| } | |||
| public Date getEndtime() { | |||
| return endtime; | |||
| } | |||
| public void setEndtime(Date endtime) { | |||
| this.endtime = endtime; | |||
| } | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| public void setMerchantId(Long merchantId) { | |||
| this.merchantId = merchantId; | |||
| } | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| @@ -19,4 +19,6 @@ public interface WxBillAllMapper extends CommonMapper<MallPermission, String> { | |||
| Map<String,Object> queryPaidInfo(WxBillAll record); | |||
| List<Map<String,Object>> listData(WxBillAll wxBillAll); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| @@ -11,4 +12,6 @@ public interface WxBillAllService { | |||
| Map<String,Object> listAsPage(WxBillAll wxBillAll, Integer pageNum, Integer pageSize); | |||
| List<Map<String,Object>> listBillOweAndWaitPay(WxBillAll wxBillAll); | |||
| } | |||
| @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -65,6 +66,17 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| return result; | |||
| } | |||
| @Override | |||
| public List<Map<String, Object>> listBillOweAndWaitPay(WxBillAll wxBillAll) { | |||
| //更新各账单状态 | |||
| updateBillStatus(wxBillAll); | |||
| ArrayList<Integer> statusList = new ArrayList<>(); | |||
| statusList.add(EnumBillRentStatus.NOT_PAID.getCode()); | |||
| statusList.add(EnumBillRentStatus.WAIT_PAY.getCode()); | |||
| wxBillAll.setStatusList(statusList); | |||
| return wxBillAllMapper.listData(wxBillAll); | |||
| } | |||
| private void updateBillStatus(WxBillAll record) { | |||
| logger.info("更新各账单状态开始"); | |||
| //更新日常账单状态 | |||
| @@ -71,5 +71,46 @@ | |||
| </select> | |||
| <select id="listData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| 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 bill.tenant_id=#{tenantId} | |||
| <if test=" null != merchantId "> | |||
| and bill.merchant_id=#{merchantId} | |||
| </if> | |||
| <if test=" null != statusList "> | |||
| and bill.`status` in | |||
| <foreach collection="statusList" index="index" item="status" open="(" separator="," close=")"> | |||
| #{status} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != typeList "> | |||
| and bill.`bill_type_value` in | |||
| <foreach collection="typeList" index="index" item="type" open="(" separator="," close=")"> | |||
| #{type} | |||
| </foreach> | |||
| </if> | |||
| <if test="null!=starttime and null!=endtime"> | |||
| and bill.receive_date between #{starttime} and #{endtime} | |||
| </if> | |||
| order by bill.id,bill.merchant_id,bill.receive_date | |||
| </select> | |||
| </mapper> | |||