| @@ -387,6 +387,13 @@ public enum ErrorCode{ | |||
| ORDER_GROUP_COOPERATING_ATTEND(28003, "您已参与拼团"), | |||
| ORDER_GROUP_COOPERATING_UNPAID(28004, "您有未支付的拼团订单"), | |||
| /** | |||
| * 导入导出 | |||
| */ | |||
| EXCEL_EXPORT_ERROR(29001, "Excel数据导出出错"), | |||
| EXCEL_IMPORT_ERROR(29002, "Excel数据导入出错"), | |||
| ; | |||
| private int code; | |||
| @@ -43,73 +43,86 @@ public class WxCUserBasicInfo implements Serializable { | |||
| public void setIds(List<Long> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /**用户姓名**/ | |||
| @Excel(name="姓名",width = 20,orderNum = "1") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | |||
| private String name; | |||
| /**性别:0:保密 1.男 2女**/ | |||
| @Excel(name="性别",width = 20,replace = { "保密_0", "男_1", "女_2"},orderNum = "2") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | |||
| private Integer sex; | |||
| /**微信用户绑定的手机号**/ | |||
| @Excel(name="手机号",width = 20,orderNum = "3") | |||
| @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") | |||
| @NotNull | |||
| private String phone; | |||
| /**出生日期**/ | |||
| @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "6") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") | |||
| private Date birthdate; | |||
| /**用户昵称**/ | |||
| @Excel(name="微信昵称",width = 20,orderNum = "4") | |||
| @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | |||
| private String nickName; | |||
| /**学历**/ | |||
| @Excel(name="学历",width = 20,orderNum = "5") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="学历",name="education") | |||
| private String education; | |||
| /**性别:0:保密 1.男 2女**/ | |||
| @Excel(name="性别",width = 20,replace = { "保密_0", "男_1","女_2"},orderNum = "2") | |||
| /**出生日期**/ | |||
| @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "6") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | |||
| private Integer sex; | |||
| /**邮箱**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="邮箱",name="email") | |||
| private String email; | |||
| /**地址**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") | |||
| private Date birthdate; | |||
| @Excel(name="地址",width = 20,orderNum = "7") | |||
| @Transient | |||
| private String addressStr; | |||
| /**更新时间**/ | |||
| @Excel(name="上次活跃时间",width = 20,format="yyyy-MM-dd", orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| /**创建时间**/ | |||
| @Excel(name="注册时间",width = 20,format="yyyy-MM-dd", orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /**成长值**/ | |||
| @Excel(name="成长值",width = 20, orderNum = "11") | |||
| @io.swagger.annotations.ApiModelProperty(value="成长值",name="poins") | |||
| private Integer poins; | |||
| /**地址**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="地址",name="address") | |||
| private String address; | |||
| /**积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="poins") | |||
| private Integer poins; | |||
| /**邮箱**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="邮箱",name="email") | |||
| private String email; | |||
| /**用户标签**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="用户标签",name="tagId") | |||
| private Long tagId; | |||
| /**创建时间**/ | |||
| @Excel(name="注册时间",width = 20,format="yyyy-MM-dd", orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /**更新时间**/ | |||
| @Excel(name="上次活跃时间",width = 20,format="yyyy-MM-dd", orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| /**租户id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | |||
| private String tenantId; | |||
| /**用户姓名**/ | |||
| @Excel(name="姓名",width = 20,orderNum = "1") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | |||
| private String name; | |||
| /**会员等级**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="会员等级",name="level") | |||
| private String level; | |||
| /**用户昵称**/ | |||
| @Excel(name="微信昵称",width = 20,orderNum = "4") | |||
| @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | |||
| private String nickName; | |||
| @Transient | |||
| private String tagIds; | |||
| @Transient | |||
| @Excel(name="标签",width = 20,orderNum = "10") | |||
| private String tagNames; | |||
| @Transient | |||
| private String tagIds; | |||
| @Transient | |||
| private List<WxTags> tagsList; | |||
| @@ -121,11 +134,11 @@ public class WxCUserBasicInfo implements Serializable { | |||
| @Transient | |||
| private Date startTime; | |||
| @Transient | |||
| private Date endTime; | |||
| @Transient | |||
| private String addressStr; | |||
| public String getLevel() { | |||
| return level; | |||
| @@ -1,5 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| @@ -11,16 +13,28 @@ public class WxCarPayRecord implements Serializable { | |||
| private static final long serialVersionUID = 1243232432423L; | |||
| @Id | |||
| private Long id; | |||
| @Excel(name="车牌",width = 20,orderNum = "1") | |||
| private String plateNumber; | |||
| @Excel(name="车主电话",width = 20,orderNum = "2") | |||
| private String phone; | |||
| @Excel(name="进场时间",width = 20,orderNum = "3",format="yyyy-MM-dd HH:mm") | |||
| private Date entranceTime; | |||
| @Excel(name="出场时间",width = 20,orderNum = "4",format="yyyy-MM-dd HH:mm") | |||
| private Date exitTime; | |||
| @Excel(name="停车时长(分钟)",width = 20,orderNum = "5") | |||
| private Long stayedTime; | |||
| @Excel(name="缴费金额(元)",width = 20,orderNum = "6") | |||
| private String fee; | |||
| private String tenantId; | |||
| private Integer vendorType; | |||
| private String synId; | |||
| private String parkId; | |||
| private String parkName; | |||
| private String userType; | |||
| private String plateNumber; | |||
| private Date entranceTime; | |||
| private Date exitTime; | |||
| private String fee; | |||
| private Date feeTime; | |||
| private String coupon; | |||
| private String couponCode; | |||
| @@ -28,10 +42,10 @@ public class WxCarPayRecord implements Serializable { | |||
| private String remainingDays; | |||
| private String discountAmount; | |||
| private String paidServiceFee; | |||
| private String phone; | |||
| private Date createDate; | |||
| private Date updateDate; | |||
| private Long stayedTime; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value="开始日期",name="startDate") | |||
| @@ -1,7 +1,9 @@ | |||
| package com.iformall.domain.po; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| import javax.persistence.*; | |||
| import java.math.BigDecimal; | |||
| import java.util.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| @@ -14,6 +16,7 @@ public class WxCardSpend implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| @Excel(name="交易编号",width = 20,orderNum = "1") | |||
| protected Long id; | |||
| @Transient | |||
| @@ -62,6 +65,7 @@ public class WxCardSpend implements Serializable { | |||
| private Integer cardBeforeRealAmount; | |||
| /**创建时间*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| @Excel(name="交易时间",width = 20,orderNum = "6",format="yyyy-MM-dd HH:mm") | |||
| private Date createDate; | |||
| /**更新时间*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| @@ -69,11 +73,22 @@ public class WxCardSpend implements Serializable { | |||
| /**支付状态*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="支付状态(0:未分帐, 1:已分账, 2:已人工分账)",name="payStatus") | |||
| @Excel(name="补贴状态",width = 20,orderNum = "10",replace = { "未支付_0", "已分账_1","已人工分账_2"}) | |||
| private Integer payStatus; | |||
| @Transient | |||
| protected List<Integer> payStatusS; | |||
| @Excel(name="消费金额",width = 20,orderNum = "7") | |||
| private String deductionAmountStr; | |||
| @Transient | |||
| @Excel(name="收款金额",width = 20,orderNum = "8") | |||
| private String paymentStr; | |||
| @Transient | |||
| @Excel(name="收款实际金额",width = 20,orderNum = "9") | |||
| private String realPaymentStr; | |||
| @Transient | |||
| protected List<Integer> payStatusS; | |||
| @Transient | |||
| protected String payStatusStr; | |||
| @@ -85,6 +100,39 @@ public class WxCardSpend implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="enddate") | |||
| private Date enddate; | |||
| public String getDeductionAmountStr() { | |||
| if(getDeductionAmountStr()!=null) { | |||
| deductionAmountStr = new BigDecimal(getDeductionAmountStr()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return deductionAmountStr; | |||
| } | |||
| public void setDeductionAmountStr(String deductionAmountStr) { | |||
| this.deductionAmountStr = deductionAmountStr; | |||
| } | |||
| public String getPaymentStr() { | |||
| if(getPaymentStr()!=null) { | |||
| paymentStr = new BigDecimal(getPaymentStr()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return paymentStr; | |||
| } | |||
| public void setPaymentStr(String paymentStr) { | |||
| this.paymentStr = paymentStr; | |||
| } | |||
| public String getRealPaymentStr() { | |||
| if(getRealPaymentStr()!=null) { | |||
| realPaymentStr = new BigDecimal(getRealPaymentStr()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return realPaymentStr; | |||
| } | |||
| public void setRealPaymentStr(String realPaymentStr) { | |||
| this.realPaymentStr = realPaymentStr; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| @@ -1,7 +1,9 @@ | |||
| package com.iformall.domain.po; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| import javax.persistence.*; | |||
| import java.math.BigDecimal; | |||
| import java.util.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| @@ -12,7 +14,8 @@ import java.io.Serializable; | |||
| @Data | |||
| public class WxMerchantSubsidy implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @@ -28,12 +31,16 @@ public class WxMerchantSubsidy implements Serializable { | |||
| /**租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /**订单ID*/ | |||
| @Excel(name="交易单号",width = 20,orderNum = "1") | |||
| @io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId") | |||
| private Long orderId; | |||
| /**订单支付类型(0:券1:付款码支付,2:C扫码支付,3,储值卡)*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="订单支付类型(0:券1:付款码支付,2:C扫码支付,3,储值卡)",name="orderType") | |||
| private Integer orderType; | |||
| /**商户ID*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||
| private Long merchantId; | |||
| @@ -43,25 +50,39 @@ public class WxMerchantSubsidy implements Serializable { | |||
| /**券包类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,100.消费卡)*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券包类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,100.消费卡)",name="couponType") | |||
| private Integer couponType; | |||
| /**订单金额*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="订单金额",name="orderPayment") | |||
| private Integer orderPayment; | |||
| /**接收金额(包含通道费)*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="接收金额(包含通道费)",name="receiverPayment") | |||
| private Integer receiverPayment; | |||
| /**订单金额*/ | |||
| @Transient | |||
| @Excel(name="本次消费(元)",width = 20,orderNum = "4") | |||
| private String orderPaymentStr; | |||
| /**接收金额(包含通道费)*/ | |||
| @Transient | |||
| @Excel(name="商户应收(元)",width = 20,orderNum = "5") | |||
| private String receiverPaymentStr; | |||
| /** 实收金额(不包含通道费)*/ | |||
| @io.swagger.annotations.ApiModelProperty(value=" 实收金额(不包含通道费)",name="realPayment") | |||
| private Integer realPayment; | |||
| /**补贴额(包含通道费)*/ | |||
| @Excel(name="补贴(元)",width = 20,orderNum = "6") | |||
| @io.swagger.annotations.ApiModelProperty(value="补贴额(包含通道费)",name="subsidy") | |||
| private Integer subsidy; | |||
| /**线上补贴额/实收补贴额(通道费扣除)*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="线上补贴额/实收补贴额(通道费扣除)",name="realSubsidy") | |||
| private Integer realSubsidy; | |||
| /**状态(0:未补贴, 1:已自动补贴, 2:已手工补贴)*/ | |||
| @Excel(name="补贴状态",width = 20,orderNum = "7",replace = { "未补贴_0", "已自动补贴_1","已手工补贴_2"}) | |||
| @io.swagger.annotations.ApiModelProperty(value="状态(0:未补贴, 1:已补贴, 2:已手工补贴)",name="status") | |||
| private Integer status; | |||
| /**创建时间*/ | |||
| @Excel(name="交易时间",width = 20,orderNum = "3",format="yyyy-MM-dd HH:mm") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /**更新时间*/ | |||
| @@ -80,6 +101,29 @@ public class WxMerchantSubsidy implements Serializable { | |||
| @Transient | |||
| protected String statusStr; | |||
| public String getOrderPaymentStr() { | |||
| if(getOrderPaymentStr()!=null) { | |||
| orderPaymentStr = new BigDecimal(getOrderPaymentStr()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return orderPaymentStr; | |||
| } | |||
| public void setOrderPaymentStr(String orderPaymentStr) { | |||
| this.orderPaymentStr = orderPaymentStr; | |||
| } | |||
| public String getReceiverPaymentStr() { | |||
| if(getReceiverPaymentStr()!=null) { | |||
| receiverPaymentStr = new BigDecimal(getReceiverPaymentStr()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return receiverPaymentStr; | |||
| } | |||
| public void setReceiverPaymentStr(String receiverPaymentStr) { | |||
| this.receiverPaymentStr = receiverPaymentStr; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import com.iformall.domain.po.WxCardSpend; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -16,10 +17,12 @@ public class WxCardSpendVo extends WxCardSpend { | |||
| /**卡信息*/ | |||
| /**券名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | |||
| @Excel(name="卡名",width = 20,orderNum = "4") | |||
| private String title; | |||
| /**使用商户名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="merchantName") | |||
| @Excel(name="商户",width = 20,orderNum = "5") | |||
| private String merchantName; | |||
| /**补贴额(包含通道费)*/ | |||
| @@ -34,10 +37,12 @@ public class WxCardSpendVo extends WxCardSpend { | |||
| /**持有人昵称*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="持有人昵称",name="onickName") | |||
| @Excel(name="消费者",width = 20,orderNum = "2") | |||
| private String onickName; | |||
| /**持有人绑定的手机号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="持有人绑定的手机号",name="ouPhone") | |||
| @Excel(name="手机号",width = 20,orderNum = "3") | |||
| private String ouPhone; | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import com.iformall.domain.po.WxMerchantSubsidy; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -32,6 +33,7 @@ public class WxMerchantSubsidyVo extends WxMerchantSubsidy { | |||
| private String remark; | |||
| /**使用商户名**/ | |||
| @Excel(name="消费商户",width = 20,orderNum = "2") | |||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | |||
| private String merchantName; | |||
| @@ -0,0 +1,115 @@ | |||
| package com.iformall.service; | |||
| import cn.afterturn.easypoi.excel.ExcelExportUtil; | |||
| import cn.afterturn.easypoi.excel.ExcelImportUtil; | |||
| import cn.afterturn.easypoi.excel.entity.ExportParams; | |||
| import cn.afterturn.easypoi.excel.entity.ImportParams; | |||
| import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.exception.MallinkException; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.net.URLEncoder; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.NoSuchElementException; | |||
| @Service | |||
| public class ExcelService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, boolean isCreateHeader, HttpServletResponse response) | |||
| { | |||
| ExportParams exportParams = new ExportParams(title, sheetName); | |||
| exportParams.setCreateHeadRows(isCreateHeader); | |||
| defaultExport(list, pojoClass, fileName, response, exportParams); | |||
| } | |||
| public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass,String fileName, HttpServletResponse response) | |||
| { | |||
| defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName)); | |||
| } | |||
| public static void exportExcel(List<Map<String, Object>> list, String fileName, HttpServletResponse response) | |||
| { | |||
| defaultExport(list, fileName, response); | |||
| } | |||
| private static void defaultExport(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams) | |||
| { | |||
| Workbook workbook = ExcelExportUtil.exportExcel(exportParams,pojoClass,list); | |||
| if (workbook != null); | |||
| downLoadExcel(fileName, response, workbook); | |||
| } | |||
| private static void defaultExport(List<Map<String, Object>> list, String fileName, HttpServletResponse response) | |||
| { | |||
| Workbook workbook = ExcelExportUtil.exportExcel(list, ExcelType.HSSF); | |||
| if (workbook != null); | |||
| downLoadExcel(fileName, response, workbook); | |||
| } | |||
| private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) | |||
| { | |||
| try { | |||
| response.setCharacterEncoding("UTF-8"); | |||
| response.setHeader("content-Type", "application/vnd.ms-excel"); | |||
| response.setHeader("Content-Disposition", | |||
| "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); | |||
| workbook.write(response.getOutputStream()); } | |||
| catch (IOException e) | |||
| { | |||
| throw new MallinkException(ErrorCode.EXCEL_EXPORT_ERROR.getCode(),e.getMessage()); | |||
| } | |||
| } | |||
| public static <T> List<T> importExcel(String filePath,Integer titleRows,Integer headerRows, Class<T> pojoClass){ | |||
| if (StringUtils.isBlank(filePath)){ | |||
| return null; | |||
| } | |||
| ImportParams params = new ImportParams(); | |||
| params.setTitleRows(titleRows); | |||
| params.setHeadRows(headerRows); | |||
| List<T> list = null; | |||
| try { | |||
| list = ExcelImportUtil.importExcel(new File(filePath), pojoClass, params); | |||
| }catch (NoSuchElementException e){ | |||
| throw new MallinkException(ErrorCode.EXCEL_IMPORT_ERROR.getCode(),"模板不能为空"); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| throw new MallinkException(ErrorCode.EXCEL_IMPORT_ERROR.getCode(),e.getMessage()); | |||
| } | |||
| return list; | |||
| } | |||
| public static <T> List<T> importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class<T> pojoClass) { | |||
| if (file == null) { | |||
| return null; | |||
| } | |||
| ImportParams params = new ImportParams(); | |||
| params.setTitleRows(titleRows); | |||
| params.setHeadRows(headerRows); | |||
| List<T> list = null; | |||
| try { | |||
| list = ExcelImportUtil.importExcel(file.getInputStream(), pojoClass, params); | |||
| } catch (NoSuchElementException e) { | |||
| throw new MallinkException(ErrorCode.EXCEL_IMPORT_ERROR.getCode(),"excel文件不能为空"); | |||
| } catch (Exception e) { | |||
| throw new MallinkException(ErrorCode.EXCEL_IMPORT_ERROR.getCode(),e.getMessage()); | |||
| } | |||
| return list; | |||
| } | |||
| } | |||
| @@ -1,8 +1,12 @@ | |||
| package com.iformall.service.impl; | |||
| import cn.afterturn.easypoi.excel.ExcelExportUtil; | |||
| import cn.afterturn.easypoi.excel.entity.ExportParams; | |||
| import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.WxCUser; | |||
| @@ -14,7 +18,9 @@ import com.iformall.domain.vo.CUserBaseVo; | |||
| import com.iformall.domain.vo.CUserTagVo; | |||
| import com.iformall.domain.vo.WxCUserBasicInfoVo; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| @@ -24,6 +30,7 @@ import org.apache.commons.io.FileUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.poi.ss.usermodel.Cell; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.streaming.SXSSFSheet; | |||
| import org.apache.poi.xssf.streaming.SXSSFWorkbook; | |||
| import org.slf4j.Logger; | |||
| @@ -34,12 +41,10 @@ import org.springframework.stereotype.Service; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.*; | |||
| import java.net.URLEncoder; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.UUID; | |||
| import java.util.*; | |||
| import java.util.concurrent.TimeUnit; | |||
| @Service | |||
| @@ -70,6 +75,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| @Autowired | |||
| WxCarPayRecordMapper wxCarPayRecordMapper; | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Override | |||
| public PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(record)); | |||
| @@ -148,6 +158,12 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| return wxCUserBasicInfoMapper.countVoList(basicInfo); | |||
| } | |||
| public void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCUserBasicInfoVo> list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| excelService.exportExcel(list,null,"会员信息",WxCUserBasicInfoVo.class,"会员信息数据.xls",response); | |||
| } | |||
| /* | |||
| @Override | |||
| public void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCUserBasicInfoVo> memberlist = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| @@ -274,7 +290,81 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| */ | |||
| public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) { | |||
| List<WxCUserBasicInfoVo> list = new ArrayList<>(); | |||
| WxCUserBasicInfoVo u1 = new WxCUserBasicInfoVo(); | |||
| WxCUserBasicInfoVo u2 = new WxCUserBasicInfoVo(); | |||
| WxCUserBasicInfoVo u3 = new WxCUserBasicInfoVo(); | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| u1.setName("例子1"); | |||
| u1.setSex(0); | |||
| u1.setPhone("13900010001"); | |||
| u1.setNickName("昵称"); | |||
| u1.setEducation("本科"); | |||
| u1.setAddress("地址"); | |||
| try { | |||
| u1.setBirthdate(sdf.parse("2018-09-10")); | |||
| u1.setCreateDate(sdf.parse("2018-08-10")); | |||
| u1.setUpdateDate(sdf.parse("2018-08-10")); | |||
| } catch (Exception e){ | |||
| u1.setBirthdate(new Date()); | |||
| u1.setCreateDate(new Date()); | |||
| u1.setUpdateDate(new Date()); | |||
| } | |||
| u1.setTagNames("附近住户"); | |||
| u1.setPoins(100); | |||
| u2.setName("例子2"); | |||
| u2.setSex(1); | |||
| u2.setPhone("13900010002"); | |||
| u2.setNickName("昵称"); | |||
| u2.setEducation("本科"); | |||
| u2.setAddress("地址"); | |||
| try { | |||
| u2.setBirthdate(sdf.parse("2018-09-10")); | |||
| u2.setCreateDate(sdf.parse("2018-08-10")); | |||
| u2.setUpdateDate(sdf.parse("2018-08-10")); | |||
| } catch (Exception e){ | |||
| u2.setBirthdate(new Date()); | |||
| u2.setCreateDate(new Date()); | |||
| u2.setUpdateDate(new Date()); | |||
| } | |||
| u2.setTagNames("男/附近住户"); | |||
| u2.setPoins(200); | |||
| u3.setName("例子3"); | |||
| u3.setSex(2); | |||
| u3.setPhone("13900010003"); | |||
| u3.setNickName("昵称"); | |||
| u3.setEducation("本科"); | |||
| u3.setAddress("地址"); | |||
| try { | |||
| u3.setBirthdate(sdf.parse("2018-09-10")); | |||
| u3.setCreateDate(sdf.parse("2018-08-10")); | |||
| u3.setUpdateDate(sdf.parse("2018-08-10")); | |||
| } catch (Exception e){ | |||
| u3.setBirthdate(new Date()); | |||
| u3.setCreateDate(new Date()); | |||
| u3.setUpdateDate(new Date()); | |||
| } | |||
| u3.setTagNames("女/附近住户"); | |||
| u3.setPoins(110); | |||
| list.add(u1); | |||
| list.add(u2); | |||
| list.add(u3); | |||
| excelService.exportExcel(list,null,"会员信息模板",WxCUserBasicInfoVo.class,"会员信息模板.xls",response); | |||
| } | |||
| /* | |||
| @Override | |||
| public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) { | |||
| @@ -402,7 +492,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| } | |||
| } | |||
| */ | |||
| public WxCUserBasicInfo InitUserBaseInfo(CUserBaseInfoT uBase, String tenantId) { | |||
| if (StringUtils.isBlank(uBase.getPhone())) { | |||
| @@ -604,6 +694,14 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| return wxCUserBasicInfoMapper.findCount(dto); | |||
| } | |||
| @Override | |||
| public void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCarPayRecord> list = wxCarPayRecordMapper.findCarPayList(record); | |||
| String sheetName = (record.getIsPay()!=null && 1==record.getIsPay())?"线上缴费车辆列表":"进出车辆列表"; | |||
| excelService.exportExcel(list,null,sheetName,WxCarPayRecord.class,sheetName+".xls",response); | |||
| } | |||
| /* | |||
| @Override | |||
| public void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCarPayRecord> carPayList = wxCarPayRecordMapper.findCarPayList(record); | |||
| @@ -676,4 +774,5 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| */ | |||
| } | |||
| @@ -11,6 +11,7 @@ import com.iformall.domain.vo.WxCardSpendVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxCardSpendService; | |||
| import com.iformall.service.WxProfitSharingOrderService; | |||
| import com.iformall.utils.Constant; | |||
| @@ -69,6 +70,9 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| @Autowired | |||
| WxProfitSharingOrderService profitSharingOrderService; | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Override | |||
| public WxCouponMerchant checkMerchantInCoupon(WxCardInfo cardInfo, Long merchantId) { | |||
| WxCouponMerchant couponMerchant = null; | |||
| @@ -498,6 +502,12 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| profitSharingOrderService.finishSharingOrder(shareOrder); | |||
| } | |||
| @Override | |||
| public void exportData(WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCardSpendVo> list = wxCardSpendMapper.findCardSpendVoList(wxCardSpendVo); | |||
| excelService.exportExcel(list,null,"消费记录",WxCardSpendVo.class,"消费记录.xls",response); | |||
| } | |||
| /* | |||
| @Override | |||
| public void exportData(WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCardSpendVo> cardSpendVoList = wxCardSpendMapper.findCardSpendVoList(wxCardSpendVo); | |||
| @@ -590,7 +600,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| */ | |||
| public void downFile(String filePath, String filename, String exportFileName, | |||
| HttpServletResponse response, HttpServletRequest req) throws IOException { | |||
| try { | |||
| @@ -10,6 +10,7 @@ import com.iformall.domain.vo.WxMerchantSubsidyVo; | |||
| import com.iformall.enums.EnumMerchantSubsidyStatus; | |||
| import com.iformall.enums.EnumOrderType; | |||
| import com.iformall.mapper.WxMerchantSubsidyMapper; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxMerchantSubsidyService; | |||
| import com.iformall.utils.Constant; | |||
| import org.apache.commons.io.FileUtils; | |||
| @@ -37,12 +38,14 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||
| @Autowired | |||
| WxMerchantSubsidyMapper wxMerchantSubsidyMapper; | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Override | |||
| public Map<String, Object> sumForSubsidy(WxMerchantSubsidy record) { | |||
| return wxMerchantSubsidyMapper.sumVoList(record); | |||
| } | |||
| @Override | |||
| public PageInfo<WxMerchantSubsidyVo> listAsPage(WxMerchantSubsidy record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantSubsidyMapper.findVoList(record)); | |||
| @@ -82,6 +85,13 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||
| wxMerchantSubsidyMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void exportData(WxMerchantSubsidy wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxMerchantSubsidyVo> list = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy); | |||
| excelService.exportExcel(list,null,"补贴记录",WxMerchantSubsidyVo.class,"补贴记录.xls",response); | |||
| } | |||
| /* | |||
| @Override | |||
| public void exportData(WxMerchantSubsidy wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxMerchantSubsidyVo> subsidyVoList = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy); | |||
| @@ -163,6 +173,7 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| */ | |||
| public void downFile(String filePath, String filename, String exportFileName, | |||
| HttpServletResponse response, HttpServletRequest req) throws IOException { | |||