| @@ -15,6 +15,8 @@ import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | /** | ||||
| @@ -87,5 +89,12 @@ public class WxBillDailyController extends BaseController { | |||||
| return wxBillDailyService.updatePaid(id); | return wxBillDailyService.updatePaid(id); | ||||
| } | } | ||||
| @RequestMapping("/exportTemplate") | |||||
| @SystemControllerLog(description = "日常账单-导出模板") | |||||
| public void exportTemplate(HttpServletRequest request, HttpServletResponse response) { | |||||
| logger.debug("[" + getIpAddr() + "] wxBillDailyService::exportTemplate"); | |||||
| wxBillDailyService.exportTemplate(request, response, getTenantId()); | |||||
| } | |||||
| } | } | ||||
| @@ -4,6 +4,10 @@ import com.iformall.common.SortColumn; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | import javax.persistence.Table; | ||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import javax.validation.constraints.NotNull; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -50,6 +54,8 @@ public class WxBillDaily extends BaseEntity{ | |||||
| this.merchantName = merchantName; | this.merchantName = merchantName; | ||||
| } | } | ||||
| @Excel(name = "费用类型", replace = {"水费_1", "电费_2"}, width = 10, orderNum = "2") | |||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value="账单类型",name="type") | @io.swagger.annotations.ApiModelProperty(value="账单类型",name="type") | ||||
| private Integer type; | private Integer type; | ||||
| @@ -61,25 +67,28 @@ public class WxBillDaily extends BaseEntity{ | |||||
| this.type = type; | this.type = type; | ||||
| } | } | ||||
| /*实际应收金额**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") | @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") | ||||
| @SortColumn(column = "receivePay") | @SortColumn(column = "receivePay") | ||||
| private Long receivePay; | private Long receivePay; | ||||
| /*实收金额**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") | @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") | ||||
| private Long pay; | private Long pay; | ||||
| /*截止收款日期**/ | |||||
| @Excel(name = "截止收款日期", orderNum = "6", width = 20, format = "yyyy-MM-dd") | |||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate") | @io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate") | ||||
| @SortColumn(column = "receiveDate") | @SortColumn(column = "receiveDate") | ||||
| private Date receiveDate; | private Date receiveDate; | ||||
| /*到账日期**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="到账日期",name="payDate") | @io.swagger.annotations.ApiModelProperty(value="到账日期",name="payDate") | ||||
| @SortColumn(column = "payDate") | @SortColumn(column = "payDate") | ||||
| private Date payDate; | private Date payDate; | ||||
| /*创建时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | ||||
| private Date createtime; | private Date createtime; | ||||
| /*逾期天数**/ | |||||
| @Excel(name = "逾期天数", orderNum = "7", width = 20, numFormat = "#") | |||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") | @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") | ||||
| @SortColumn(column = "expiredDay") | @SortColumn(column = "expiredDay") | ||||
| private Long expiredDay; | private Long expiredDay; | ||||
| @@ -0,0 +1,62 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.iformall.domain.po.WxBillDaily; | |||||
| import javax.validation.constraints.NotNull; | |||||
| public class WxBillDailyVo extends WxBillDaily { | |||||
| @Excel(name = "商铺号", width = 20, orderNum = "1") | |||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value = "商铺号", name = "shopNumber") | |||||
| private String shopNumber; | |||||
| @Excel(name = "实际应收金额", orderNum = "3", width = 20, numFormat = "#.##") | |||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value = "实际应收金额", name = "receivePayStr") | |||||
| private String receivePayStr; | |||||
| @Excel(name = "实收金额", orderNum = "4", width = 20, numFormat = "#.##") | |||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value = "实收金额", name = "payStr") | |||||
| private String payStr; | |||||
| @Excel(name = "欠缴金额", orderNum = "5", width = 20, numFormat = "#.##") | |||||
| @NotNull | |||||
| @io.swagger.annotations.ApiModelProperty(value = "欠缴金额", name = "oweStr") | |||||
| private String oweStr; | |||||
| public String getShopNumber() { | |||||
| return shopNumber; | |||||
| } | |||||
| public void setShopNumber(String shopNumber) { | |||||
| this.shopNumber = shopNumber; | |||||
| } | |||||
| public String getReceivePayStr() { | |||||
| return receivePayStr; | |||||
| } | |||||
| public void setReceivePayStr(String receivePayStr) { | |||||
| this.receivePayStr = receivePayStr; | |||||
| } | |||||
| public String getPayStr() { | |||||
| return payStr; | |||||
| } | |||||
| public void setPayStr(String payStr) { | |||||
| this.payStr = payStr; | |||||
| } | |||||
| public String getOweStr() { | |||||
| return oweStr; | |||||
| } | |||||
| public void setOweStr(String oweStr) { | |||||
| this.oweStr = oweStr; | |||||
| } | |||||
| } | |||||
| @@ -5,6 +5,8 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxBillDaily; | import com.iformall.domain.po.WxBillDaily; | ||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | /** | ||||
| @@ -50,4 +52,6 @@ public interface WxBillDailyService { | |||||
| ResultData updatePaid(Long id); | ResultData updatePaid(Long id); | ||||
| void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId); | |||||
| } | } | ||||
| @@ -10,10 +10,12 @@ import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxBillAction; | import com.iformall.domain.po.WxBillAction; | ||||
| import com.iformall.domain.po.WxBillDaily; | import com.iformall.domain.po.WxBillDaily; | ||||
| import com.iformall.domain.po.WxShop; | import com.iformall.domain.po.WxShop; | ||||
| import com.iformall.domain.vo.WxBillDailyVo; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxBillDailyMapper; | import com.iformall.mapper.WxBillDailyMapper; | ||||
| import com.iformall.mapper.WxShopMapper; | import com.iformall.mapper.WxShopMapper; | ||||
| import com.iformall.service.ExcelService; | |||||
| import com.iformall.service.WxBillActionService; | import com.iformall.service.WxBillActionService; | ||||
| import com.iformall.service.WxBillDailyService; | import com.iformall.service.WxBillDailyService; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -22,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.util.*; | import java.util.*; | ||||
| @@ -39,7 +43,8 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||||
| WxShopMapper wxShopMapper; | WxShopMapper wxShopMapper; | ||||
| @Autowired | @Autowired | ||||
| WxBillActionService wxBillActionService; | WxBillActionService wxBillActionService; | ||||
| @Autowired | |||||
| ExcelService excelService; | |||||
| @Override | @Override | ||||
| public PageInfo<Map<String, Object>> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize) { | public PageInfo<Map<String, Object>> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize) { | ||||
| //更新账单状态 | //更新账单状态 | ||||
| @@ -202,10 +207,34 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "日常账单结单成功"); | return new ResultData(Result.SUCCESS, "日常账单结单成功"); | ||||
| } | } | ||||
| @Override | |||||
| public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) { | |||||
| List<WxBillDailyVo> list = new ArrayList<>(); | |||||
| WxBillDailyVo v1 = new WxBillDailyVo(); | |||||
| WxBillDailyVo v2 = new WxBillDailyVo(); | |||||
| v1.setShopNumber("A0001"); | |||||
| v1.setType(1); | |||||
| v1.setReceivePayStr("1"); | |||||
| v1.setPayStr("0"); | |||||
| v1.setOweStr("0"); | |||||
| v1.setReceiveDate(new Date()); | |||||
| v1.setExpiredDay(0L); | |||||
| list.add(v1); | |||||
| v2.setShopNumber("A0002"); | |||||
| v2.setType(2); | |||||
| v2.setReceivePayStr("1000"); | |||||
| v2.setPayStr(""); | |||||
| v2.setOweStr("1000"); | |||||
| v2.setReceiveDate(new Date()); | |||||
| v2.setExpiredDay(0L); | |||||
| list.add(v2); | |||||
| excelService.exportExcel(list, null, "水电费模板", WxBillDailyVo.class, "水电费模板.xls", response); | |||||
| } | |||||
| } | } | ||||