From b3af53df6770d5d231b8284537cd0fbb554b2d41 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Fri, 28 Jun 2019 14:04:20 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8D=A1=E8=AE=A2=E5=8D=95][=E4=BF=AE?= =?UTF-8?q?=E6=94=B9][=E5=AF=BC=E5=87=BA=E6=95=B0=E6=8D=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../market/WxCardPayController.java | 27 +++++++++++++++ .../com/iformall/domain/po/WxCardInfo.java | 17 +++++++++- .../java/com/iformall/domain/vo/WxCardVo.java | 34 +++++++++++++++++++ .../iformall/service/WxCardInfoService.java | 13 +++---- .../service/impl/WxCardInfoServiceImpl.java | 14 +++++++- 5 files changed, 95 insertions(+), 10 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardPayController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardPayController.java index 33039e32b..4401a14de 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardPayController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardPayController.java @@ -175,4 +175,31 @@ public class WxCardPayController extends BaseController { int remainShareAmount = wxCardSpendService.finishCard(tenantId, wxCardInfo.getId()); return new ResultData(remainShareAmount); } + + @ApiOperation("卡订单-导出数据") + @GetMapping("/exportCardOrder") + @SystemControllerLog(description = "卡订单-导出数据") + public void exportCardOrder(@ModelAttribute WxCardVo wxCardVo, HttpServletRequest request, HttpServletResponse response) { + logger.info("[" + getIpAddr() + "] cardPay/exportCardOrder"); + if (wxCardVo == null) { + wxCardVo = new WxCardVo(); + } else { + if (StringUtils.isBlank(wxCardVo.getOuPhone())) { + wxCardVo.setOuPhone(null); + } + } + wxCardVo.setTenantId(getTenantId()); + if (StringUtils.isNotBlank(wxCardVo.getStatusStr())) { + String[] statusAttr = wxCardVo.getStatusStr().split(","); + List tmpList = new ArrayList(); + for (String status : statusAttr) { + tmpList.add(Integer.valueOf(status)); + } + if (!tmpList.isEmpty()) { + wxCardVo.setStatusS(tmpList); + } + } + wxCardInfoService.exportData(wxCardVo, request, response); + } + } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java index 63ac1e002..81529ae73 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java @@ -1,11 +1,13 @@ package com.iformall.domain.po; +import cn.afterturn.easypoi.excel.annotation.Excel; import lombok.Data; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -13,7 +15,8 @@ import java.util.List; @Data public class WxCardInfo implements Serializable { private static final long serialVersionUID = 1L; - + + @Excel(name = "卡号", width = 20, orderNum = "1") @Id protected Long id; /**主键ID-与coupon_order_id一致*/ @@ -32,6 +35,16 @@ public class WxCardInfo implements Serializable { private Integer amount; @io.swagger.annotations.ApiModelProperty(value="购买总金额",name="saleAmount") private Integer saleAmount; + + public String getRemainingAmountStr() { + return new BigDecimal(remainingAmount == null ? 0 : remainingAmount).divide(new BigDecimal(100)).toPlainString(); + } + + @Excel(name = "余额(元)", width = 20, orderNum = "6") + @Transient + private String remainingAmountStr; + + @io.swagger.annotations.ApiModelProperty(value="剩余面额",name="remainingAmount") private Integer remainingAmount; @io.swagger.annotations.ApiModelProperty(value="分账总手续费",name="serviceFeeAmount") @@ -42,6 +55,8 @@ public class WxCardInfo implements Serializable { private Integer remainingShareFeeAmount; @io.swagger.annotations.ApiModelProperty(value="分账通道费差(购买时刻的通道费差,分账完结时使用)",name="rateAmount") private Integer rateAmount; + + @Excel(name = "购买时间 ", width = 20, orderNum = "9", format = "yyyy-MM-dd HH:mm:ss") @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") private Date createDate; @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxCardVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxCardVo.java index 18cfe006e..d728c03ce 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxCardVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxCardVo.java @@ -1,12 +1,14 @@ package com.iformall.domain.vo; +import cn.afterturn.easypoi.excel.annotation.Excel; import com.iformall.domain.po.WxCardInfo; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import javax.persistence.Transient; +import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -22,6 +24,8 @@ public class WxCardVo extends WxCardInfo { private String coverPicture; @io.swagger.annotations.ApiModelProperty(value="详情多图",name="detailPicture") private String detailPicture; + + @Excel(name = "卡名称", width = 20, orderNum = "4") @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") private String title; @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") @@ -33,12 +37,39 @@ public class WxCardVo extends WxCardInfo { @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") private String remark; + public String getPriceStr() { + return new BigDecimal(price == null ? 0 : price).divide(new BigDecimal(100)).toPlainString(); + } + + @Excel(name = "面额(元)", width = 20, orderNum = "5") + @Transient + private String priceStr; + + @io.swagger.annotations.ApiModelProperty(value = "面额", name = "price") private Integer price; + + public String getSalePriceStr() { + return new BigDecimal(salePrice == null ? 0 : salePrice).divide(new BigDecimal(100)).toPlainString(); + } + + @Excel(name = "售价(元)", width = 20, orderNum = "7") + @Transient + private String salePriceStr; + @io.swagger.annotations.ApiModelProperty(value = "购买金额", name = "salePrice") private Integer salePrice; @io.swagger.annotations.ApiModelProperty(value = "补贴类型", name = "subsidyType") private Integer subsidyType; + + public String getSubsidyNumStr() { + return new BigDecimal(subsidyNum == null ? 0 : subsidyNum).divide(new BigDecimal(100)).toPlainString(); + } + + @Excel(name = "补贴额(元)", width = 20, orderNum = "8") + @Transient + private String subsidyNumStr; + @io.swagger.annotations.ApiModelProperty(value = "补贴金额", name = "subsidyNum") private Integer subsidyNum; @@ -50,15 +81,18 @@ public class WxCardVo extends WxCardInfo { @io.swagger.annotations.ApiModelProperty(value = "该订单对应券的实际过期时间 ", name = "expiredTime") private Date expiredTime; + @Excel(name = "状态 ", width = 20, orderNum = "10", replace = {"使用中_4", "已过期_5", "已用完_6", "已线下退款_7"}) @io.swagger.annotations.ApiModelProperty(value = "状态", name = "status") private Integer status; + @Excel(name = "购买人", width = 20, orderNum = "2") @io.swagger.annotations.ApiModelProperty(value="购买人昵称",name="cnickName") private String cnickName; @io.swagger.annotations.ApiModelProperty(value="持有人昵称",name="onickName") private String onickName; + @Excel(name = "电话", width = 20, orderNum = "3") @io.swagger.annotations.ApiModelProperty(value="持有人绑定的手机号",name="ouPhone") private String ouPhone; diff --git a/mallinkService/src/main/java/com/iformall/service/WxCardInfoService.java b/mallinkService/src/main/java/com/iformall/service/WxCardInfoService.java index 5dc04a51d..711e4be3f 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCardInfoService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCardInfoService.java @@ -4,7 +4,8 @@ import com.github.pagehelper.PageInfo; import com.iformall.domain.po.WxCardInfo; import com.iformall.domain.vo.WxCardVo; -import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; public interface WxCardInfoService { @@ -39,12 +40,8 @@ public interface WxCardInfoService { * @param id */ void deleteById(Long id); - - - - - - - + + void exportData(WxCardVo wxCardVo, HttpServletRequest request, HttpServletResponse response); + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java index c3ac2869f..a488c5437 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java @@ -2,14 +2,17 @@ package com.iformall.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.iformall.common.IdWorker; import com.iformall.domain.po.WxCardInfo; import com.iformall.domain.vo.WxCardVo; import com.iformall.mapper.WxCardInfoMapper; +import com.iformall.service.ExcelService; import com.iformall.service.WxCardInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.iformall.common.IdWorker; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.List; @Service @@ -18,6 +21,8 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { @Autowired WxCardInfoMapper wxCardInfoMapper; + @Autowired + ExcelService excelService; @Override public PageInfo listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) { @@ -45,4 +50,11 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { public void deleteById(Long id) { wxCardInfoMapper.deleteByPrimaryKey(id); } + + @Override + public void exportData(WxCardVo wxCardVo, HttpServletRequest request, HttpServletResponse response) { + List list = wxCardInfoMapper.findVoList(wxCardVo); + excelService.exportExcel(list, null, "卡订单", WxCardVo.class, "卡订单.xlsx", response, false); + + } }