Просмотр исходного кода

[excel模板导出][修改][带*字段为必填字段]

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
07844be850
15 измененных файлов: 47 добавлений и 44 удалений
  1. +2
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/mem/AsyncTask.java
  2. +2
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/mem/BillDailyAsyncTask.java
  3. +2
    -2
      mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java
  4. +1
    -2
      mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java
  5. +3
    -3
      mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyVo.java
  6. +14
    -5
      mallinkService/src/main/java/com/iformall/service/ExcelService.java
  7. +3
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java
  8. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java
  9. +3
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java
  10. +5
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  11. +5
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  12. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  13. +2
    -7
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantSubsidyServiceImpl.java
  14. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java
  15. +1
    -1
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml

+ 2
- 2
mallinkAdmin/src/main/java/com/iformall/controller/mem/AsyncTask.java Просмотреть файл

@@ -61,9 +61,9 @@ public class AsyncTask {
public void importExcelData(File file, MallUserInfo user, String importKey, String tenantId) {
ImportParams params = new ImportParams();
// 需要验证
params.setImportFields(new String[]{"姓名", "性别", "手机号", "微信昵称", "学历", "生日","积分", "地址", "上次活跃时间", "注册时间", "标签", "成长值"});
params.setImportFields(new String[]{"姓名", "性别", "手机号*", "微信昵称", "学历", "生日", "积分", "地址", "上次活跃时间", "注册时间", "标签", "成长值"});
IExcelDataHandler<CUserBaseInfoT> handler = new AsyncTask.UserExcelHandler();
handler.setNeedHandlerFields(new String[] { "手机号" });
handler.setNeedHandlerFields(new String[]{"手机号*"});
params.setNeedVerify(true);

ExcelImportResult<CUserBaseInfoT> datalist = null;


+ 2
- 2
mallinkAdmin/src/main/java/com/iformall/controller/mem/BillDailyAsyncTask.java Просмотреть файл

@@ -65,9 +65,9 @@ public class BillDailyAsyncTask {
public void importExcelData(File file, MallUserInfo user, String importKey, String tenantId) {
ImportParams params = new ImportParams();
// 需要验证
params.setImportFields(new String[]{"商铺号", "费用类型", "实际应收金额(元)", "实收金额(元)", "缴款截止日期"});
params.setImportFields(new String[]{"商铺号*", "费用类型*", "实际应收金额(元)*", "实收金额(元)*", "缴款截止日期*"});
IExcelDataHandler<WxBillDailyVo> handler = new BillDailyAsyncTask.BillDailyExcelHandler();
handler.setNeedHandlerFields(new String[]{"商铺号", "费用类型", "实际应收金额(元)", "实收金额(元)", "缴款截止日期"});
handler.setNeedHandlerFields(new String[]{"商铺号*", "费用类型*", "实际应收金额(元)*", "实收金额(元)*", "缴款截止日期*"});
params.setNeedVerify(true);

ExcelImportResult<WxBillDailyVo> datalist = null;


+ 2
- 2
mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java Просмотреть файл

@@ -37,7 +37,7 @@ public class WxBillDaily extends BaseEntity{
@Transient
private String merchantName;

@Excel(name = "费用类型", replace = {"水费_1", "电费_2"}, width = 10, orderNum = "2")
@Excel(name = "费用类型*", replace = {"水费_1", "电费_2"}, width = 10, orderNum = "2")
@NotNull
@io.swagger.annotations.ApiModelProperty(value="账单类型",name="type")
private Integer type;
@@ -49,7 +49,7 @@ public class WxBillDaily extends BaseEntity{
@io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay")
private Long pay;

@Excel(name = "缴款截止日期", orderNum = "5", width = 20, format = "yyyy-MM-dd")
@Excel(name = "缴款截止日期*", orderNum = "5", width = 20, format = "yyyy-MM-dd")
@NotNull
@SortColumn(column = "receiveDate")
@io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate")


+ 1
- 2
mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java Просмотреть файл

@@ -10,7 +10,6 @@ import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -45,7 +44,7 @@ public class WxCUserBasicInfo extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex")
private Integer sex;

@Excel(name="手机号",width = 20,orderNum = "3")
@Excel(name = "手机号*", width = 20, orderNum = "3")
@io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone")

@NotNull


+ 3
- 3
mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyVo.java Просмотреть файл

@@ -17,17 +17,17 @@ import javax.validation.constraints.NotNull;
@EqualsAndHashCode(callSuper = true)
public class WxBillDailyVo extends WxBillDaily {

@Excel(name = "商铺号", width = 20, orderNum = "1")
@Excel(name = "商铺号*", width = 20, orderNum = "1")
@NotNull
@io.swagger.annotations.ApiModelProperty(value = "商铺号", name = "shopNumber")
private String shopNumber;

@Excel(name = "实际应收金额(元)", orderNum = "3", width = 20, numFormat = "#.##")
@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 = "#.##")
@Excel(name = "实收金额(元)*", orderNum = "4", width = 20, numFormat = "#.##")
@NotNull
@io.swagger.annotations.ApiModelProperty(value = "实收金额", name = "payStr")
private String payStr;


+ 14
- 5
mallinkService/src/main/java/com/iformall/service/ExcelService.java Просмотреть файл

@@ -9,10 +9,9 @@ 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.apache.poi.ss.usermodel.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@@ -37,7 +36,7 @@ public class ExcelService {
defaultExport(list, pojoClass, fileName, response, exportParams);
}

public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass,String fileName, HttpServletResponse response)
public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, HttpServletResponse response, boolean template)
{
defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName, ExcelType.XSSF));
}
@@ -51,8 +50,18 @@ public class ExcelService {
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);
if (workbook != null) {
Sheet sheetAt = workbook.getSheetAt(0);
CellStyle cellStyle = workbook.createCellStyle();
Font font = workbook.createFont();
font.setColor(IndexedColors.RED.getIndex());
cellStyle.setFont(font);
Row row = sheetAt.createRow(sheetAt.getLastRowNum() + 2);
Cell cell = row.createCell(0);
cell.setCellValue("*为必填字段(此段文字导入数据时请删除)");
cell.setCellStyle(cellStyle);
}
downLoadExcel(fileName, response, workbook);
}

private static void defaultExport(List<Map<String, Object>> list, String fileName, HttpServletResponse response)


+ 3
- 3
mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java Просмотреть файл

@@ -256,7 +256,7 @@ public class WxBillAllServiceImpl implements WxBillAllService {
datalist.add(wxBillAllVo);
}
}
excelService.exportExcel(datalist, null, "账单数据", WxBillAllVo.class, "账单数据.xlsx", response);
excelService.exportExcel(datalist, null, "账单数据", WxBillAllVo.class, "账单数据.xlsx", response, false);
}

private int updateBillOtherDeposit(Map<String, Object> bill) {
@@ -952,7 +952,7 @@ public class WxBillAllServiceImpl implements WxBillAllService {
list.add(oweMerchantVo);
}
String name = "欠缴商户列表";
excelService.exportExcel(list,null, name, OweMerchantVo.class,name+".xlsx",response);
excelService.exportExcel(list, null, name, OweMerchantVo.class, name + ".xlsx", response, false);
}

@Override
@@ -973,6 +973,6 @@ public class WxBillAllServiceImpl implements WxBillAllService {
list.add(oweMerchantVo);
}
String name = "待缴商户列表";
excelService.exportExcel(list,null, name, WaitMerchantVo.class,name+".xlsx",response);
excelService.exportExcel(list, null, name, WaitMerchantVo.class, name + ".xlsx", response, false);
}
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java Просмотреть файл

@@ -237,7 +237,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService {
v2.setExpiredDay(0L);
list.add(v2);

excelService.exportExcel(list, null, "水电费模板", WxBillDailyVo.class, "水电费模板.xlsx", response);
excelService.exportExcel(list, null, "水电费模板", WxBillDailyVo.class, "水电费模板.xlsx", response, true);

}



+ 3
- 3
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Просмотреть файл

@@ -624,7 +624,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
String tagNames = StringUtils.join(ids.stream().map(id->tagMap.get(id)).collect(Collectors.toList()),"/");
u.setTagNames(tagNames);
});
excelService.exportExcel(list,null,"会员信息",WxCUserBasicInfoVo.class,"会员信息数据.xlsx",response);
excelService.exportExcel(list, null, "会员信息", WxCUserBasicInfoVo.class, "会员信息数据.xlsx", response, false);
}

public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) {
@@ -699,7 +699,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
list.add(u2);
list.add(u3);

excelService.exportExcel(list,null,"会员信息模板",WxCUserBasicInfoVo.class,"会员信息模板.xlsx",response);
excelService.exportExcel(list, null, "会员信息模板", WxCUserBasicInfoVo.class, "会员信息模板.xlsx", response, true);
}


@@ -950,7 +950,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
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+".xlsx",response);
excelService.exportExcel(list, null, sheetName, WxCarPayRecord.class, sheetName + ".xlsx", response, false);
}

@Override


+ 5
- 6
mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java Просмотреть файл

@@ -3,6 +3,7 @@ package com.iformall.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxSharingOrderDto;
@@ -14,20 +15,18 @@ import com.iformall.mapper.*;
import com.iformall.service.ExcelService;
import com.iformall.service.WxCardSpendService;
import com.iformall.service.WxProfitSharingOrderService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iformall.common.IdWorker;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class WxCardSpendServiceImpl implements WxCardSpendService {
@@ -499,7 +498,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
@Override
public void exportData(WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) {
List<WxCardSpendVo> list = wxCardSpendMapper.findCardSpendVoList(wxCardSpendVo);
excelService.exportExcel(list,null,"消费记录",WxCardSpendVo.class,"消费记录.xlsx",response);
excelService.exportExcel(list, null, "消费记录", WxCardSpendVo.class, "消费记录.xlsx", response, false);
}

}

+ 5
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Просмотреть файл

@@ -1,6 +1,5 @@
package com.iformall.service.impl;

import cn.binarywang.wx.miniapp.bean.WxMaTemplateData;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -11,7 +10,10 @@ import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxSharingOrderDto;
import com.iformall.domain.po.*;
import com.iformall.domain.po.msg.*;
import com.iformall.domain.po.msg.AppUniformMsg;
import com.iformall.domain.po.msg.FmInsideCouponVerifyMsg;
import com.iformall.domain.po.msg.MpAppMsg;
import com.iformall.domain.po.msg.SmartAppMsg;
import com.iformall.domain.vo.*;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
@@ -19,7 +21,6 @@ import com.iformall.mapper.*;
import com.iformall.mq.MqBaseProducer;
import com.iformall.service.*;
import com.iformall.utils.DateUtils;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -269,7 +270,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
wxMall = wxMallMapper.findList(wxMall).get(0);
String filename = wxMall.getName() + DateUtils.getSystemTime("yyyyMMDDHHmmss");
List<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder);
excelService.exportExcel(list, null, filename, WxCouponOrderBVo.class, filename + ".xlsx", response);
excelService.exportExcel(list, null, filename, WxCouponOrderBVo.class, filename + ".xlsx", response, false);
}

@Override


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Просмотреть файл

@@ -638,7 +638,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
}
});

excelService.exportExcel(list,null,"商户信息",WxMerchant.class,"商户信息数据.xlsx",response);
excelService.exportExcel(list, null, "商户信息", WxMerchant.class, "商户信息数据.xlsx", response, false);
}

@Override


+ 2
- 7
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantSubsidyServiceImpl.java Просмотреть файл

@@ -3,25 +3,20 @@ package com.iformall.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxMerchantSubsidy;
import com.iformall.domain.vo.WxMerchantSubsidyVo;

import com.iformall.mapper.WxMerchantSubsidyMapper;
import com.iformall.service.ExcelService;
import com.iformall.service.WxMerchantSubsidyService;

import org.apache.commons.lang3.StringUtils;

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.io.*;

import java.util.List;
import java.util.Map;

@@ -82,7 +77,7 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService {
@Override
public void exportData(WxMerchantSubsidy wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response) {
List<WxMerchantSubsidyVo> list = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy);
excelService.exportExcel(list,null,"补贴记录",WxMerchantSubsidyVo.class,"补贴记录.xlsx",response);
excelService.exportExcel(list, null, "补贴记录", WxMerchantSubsidyVo.class, "补贴记录.xlsx", response, false);
}




+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java Просмотреть файл

@@ -189,7 +189,7 @@ public class WxShopServiceImpl implements WxShopService {
public void exportShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response) {
List<WxShopVo> list = wxShopMapper.findListWithMerchantMap(wxShop);
String name = EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"店铺列表":"多经点位列表";
excelService.exportExcel(list,null, name, WxShopVo.class,name+".xlsx",response);
excelService.exportExcel(list, null, name, WxShopVo.class, name + ".xlsx", response, false);
}

@Override
@@ -212,6 +212,6 @@ public class WxShopServiceImpl implements WxShopService {
notRentShopVoList.add(notRentShopVo);
}
String name = "未出租商铺列表";
excelService.exportExcel(notRentShopVoList,null, name, WxNotRentShopVo.class,name+".xlsx",response);
excelService.exportExcel(notRentShopVoList, null, name, WxNotRentShopVo.class, name + ".xlsx", response, false);
}
}

+ 1
- 1
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Просмотреть файл

@@ -24,7 +24,7 @@
<sql id="allColumns">
`id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,
`create_date`,`update_date`,`tenant_id`,`name`,`nick_name`,`credit`,`active_time`
,(select level from wx_level_config where poins >= points order by points desc limit 1 ) level
,(select level from wx_level_config where poins >= points and tenant_id=#{tenantId} order by points desc limit 1 ) level
</sql>

<sql id="dynamicWhereConditions">


Загрузка…
Отмена
Сохранить