From 396c59db6f0052fb3121d242bf4aca60117ce4f7 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 9 May 2019 17:33:12 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=B0=B4=E7=94=B5=E8=B4=B9=E8=B4=A6=E5=8D=95]?= =?UTF-8?q?[=E4=BF=AE=E6=94=B9[=E5=AF=BC=E5=87=BA=E6=A8=A1=E6=9D=BF]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rent/WxBillDailyController.java | 9 +++ .../com/iformall/domain/po/WxBillDaily.java | 21 +++++-- .../com/iformall/domain/vo/WxBillDailyVo.java | 62 +++++++++++++++++++ .../iformall/service/WxBillDailyService.java | 4 ++ .../service/impl/WxBillDailyServiceImpl.java | 43 ++++++++++--- 5 files changed, 126 insertions(+), 13 deletions(-) create mode 100644 mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyVo.java diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDailyController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDailyController.java index 0073515b9..dfab310fe 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDailyController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDailyController.java @@ -15,6 +15,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.Map; /** @@ -87,5 +89,12 @@ public class WxBillDailyController extends BaseController { 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()); + + } } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java index 1bfa2c6c1..908c7f5c7 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java @@ -4,6 +4,10 @@ import com.iformall.common.SortColumn; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; + +import cn.afterturn.easypoi.excel.annotation.Excel; + +import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -50,6 +54,8 @@ public class WxBillDaily extends BaseEntity{ this.merchantName = merchantName; } + @Excel(name = "费用类型", replace = {"水费_1", "电费_2"}, width = 10, orderNum = "2") + @NotNull @io.swagger.annotations.ApiModelProperty(value="账单类型",name="type") private Integer type; @@ -61,25 +67,28 @@ public class WxBillDaily extends BaseEntity{ this.type = type; } - /*实际应收金额**/ @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") @SortColumn(column = "receivePay") private Long receivePay; - /*实收金额**/ + @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") private Long pay; - /*截止收款日期**/ + + @Excel(name = "截止收款日期", orderNum = "6", width = 20, format = "yyyy-MM-dd") + @NotNull @io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate") @SortColumn(column = "receiveDate") private Date receiveDate; - /*到账日期**/ + @io.swagger.annotations.ApiModelProperty(value="到账日期",name="payDate") @SortColumn(column = "payDate") private Date payDate; - /*创建时间**/ + @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") private Date createtime; - /*逾期天数**/ + + @Excel(name = "逾期天数", orderNum = "7", width = 20, numFormat = "#") + @NotNull @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") @SortColumn(column = "expiredDay") private Long expiredDay; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyVo.java new file mode 100644 index 000000000..7c97242f2 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyVo.java @@ -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; + } +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillDailyService.java b/mallinkService/src/main/java/com/iformall/service/WxBillDailyService.java index 82d9ce13f..a4033a2d7 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBillDailyService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBillDailyService.java @@ -5,6 +5,8 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxBillDaily; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.Map; /** @@ -50,4 +52,6 @@ public interface WxBillDailyService { ResultData updatePaid(Long id); + void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId); + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java index d1f6aadc2..62a006e3b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java @@ -10,10 +10,12 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxBillAction; import com.iformall.domain.po.WxBillDaily; import com.iformall.domain.po.WxShop; +import com.iformall.domain.vo.WxBillDailyVo; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxBillDailyMapper; import com.iformall.mapper.WxShopMapper; +import com.iformall.service.ExcelService; import com.iformall.service.WxBillActionService; import com.iformall.service.WxBillDailyService; import org.slf4j.Logger; @@ -22,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; import java.util.*; @@ -39,7 +43,8 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { WxShopMapper wxShopMapper; @Autowired WxBillActionService wxBillActionService; - + @Autowired + ExcelService excelService; @Override public PageInfo> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize) { //更新账单状态 @@ -202,10 +207,34 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { } return new ResultData(Result.SUCCESS, "日常账单结单成功"); } - - - - - - + + @Override + public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) { + List 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); + + } + + }