协会信息数据统计 导入导出 以及 导入公共方法完善
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
package com.adc.da.base.page;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
|
||||
public class BasePage {
|
||||
@TableField(exist = false)
|
||||
private Integer page = 1;
|
||||
@TableField(exist = false)
|
||||
private Integer pageSize = 20;
|
||||
@TableField(exist = false)
|
||||
private Integer startIndex;
|
||||
@TableField(exist = false)
|
||||
private Integer endIndex;
|
||||
@TableField(exist = false)
|
||||
private String orderBy;
|
||||
@TableField(exist = false)
|
||||
private String order;
|
||||
@TableField(exist = false)
|
||||
private String q;
|
||||
@TableField(exist = false)
|
||||
private Pager pager = new Pager();
|
||||
|
||||
public BasePage() {
|
||||
|
||||
+13
-7
@@ -3,6 +3,7 @@ package com.adc.da.slrs.processModel.utils;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.adc.da.slrs.processModel.entity.importExcelDTO;
|
||||
import com.adc.da.util.DateUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
@@ -17,10 +18,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
public class ExcelImportUtilByWk {
|
||||
@@ -75,16 +73,18 @@ public class ExcelImportUtilByWk {
|
||||
int rowEnd = sheet.getPhysicalNumberOfRows();
|
||||
|
||||
Map<Integer,Field> map=new HashMap<>();
|
||||
Map<Integer,Excel> mapExcel=new HashMap<>();
|
||||
Field[] fields=tClass.getDeclaredFields();
|
||||
for (Field field:fields) {
|
||||
field.setAccessible(true);
|
||||
Excel excel=field.getAnnotation(Excel.class);
|
||||
if (null!=excel) {
|
||||
map.put(Integer.valueOf(excel.orderNum()), field);
|
||||
mapExcel.put(Integer.valueOf(excel.orderNum()), excel);
|
||||
}
|
||||
}
|
||||
T o = tClass.getConstructor(new Class[]{}).newInstance(new Object[]{});
|
||||
for (int rowNum = rowStart; rowNum < rowEnd; rowNum++) {
|
||||
T o = tClass.getConstructor(new Class[]{}).newInstance(new Object[]{});
|
||||
Row row = sheet.getRow(rowNum);
|
||||
if (null == row) {
|
||||
continue;
|
||||
@@ -92,8 +92,14 @@ public class ExcelImportUtilByWk {
|
||||
for (Integer a:map.keySet()) {
|
||||
Cell cell=null;
|
||||
cell = row.getCell(a);
|
||||
String value = convertCellValueToString(cell);
|
||||
map.get(a).set(o,value);
|
||||
if (null!=mapExcel.get(a).exportFormat() && !"".equals(mapExcel.get(a).exportFormat())) {
|
||||
String value = convertCellValueToString(cell);
|
||||
Date date= DateUtils.stringToDate(value,mapExcel.get(a).exportFormat());
|
||||
map.get(a).set(o, date);
|
||||
}else {
|
||||
String value = convertCellValueToString(cell);
|
||||
map.get(a).set(o, value);
|
||||
}
|
||||
}
|
||||
resultDataList.add(o);
|
||||
}
|
||||
|
||||
+30
@@ -10,7 +10,9 @@ import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.msgDynamicInfo.common.ReadExcel;
|
||||
import com.adc.da.slrs.msgDynamicInfo.dto.MsgDynamicInfoExportDto;
|
||||
import com.adc.da.slrs.msgDynamicInfo.page.MsgDynamicInfoEOPage;
|
||||
import com.adc.da.slrs.processModel.entity.importExcelDTO;
|
||||
import com.adc.da.slrs.processModel.utils.ExcelExportUtilByWk;
|
||||
import com.adc.da.slrs.processModel.utils.ExcelImportUtilByWk;
|
||||
import com.adc.da.slrs.wgdCensusZ.service.IWgdAssocInfoService;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
@@ -23,6 +25,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import com.adc.da.slrs.wgdCensusZ.entity.WgdAssocInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import sun.plugin.util.UIUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -31,6 +35,7 @@ import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -86,6 +91,31 @@ public class WgdAssocInfoController extends BaseController<WgdAssocInfo> {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|SarFileSplitItemsEO|导入")
|
||||
@PostMapping(value = "/importAllAssocInfos")
|
||||
public ResponseMessage<List<WgdAssocInfo>> importSplitItemsZip(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
|
||||
List<WgdAssocInfo> res= ExcelImportUtilByWk.readExcelpublic(WgdAssocInfo.class,file);
|
||||
|
||||
QueryWrapper<WgdAssocInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select(WgdAssocInfo.class, info -> !info.getColumn().equals("id"));
|
||||
List<WgdAssocInfo> wgdAssocInfos=iWgdAssocInfoService.list(queryWrapper);
|
||||
List<WgdAssocInfo> remove=new ArrayList<>();
|
||||
res.forEach(wgdAssocInfo -> {
|
||||
if (wgdAssocInfos.contains(wgdAssocInfo)){
|
||||
remove.add(wgdAssocInfo);
|
||||
}
|
||||
});
|
||||
res.removeAll(remove);
|
||||
res.forEach(wgdAssocInfo -> {
|
||||
wgdAssocInfo.setId(String.valueOf(UUID.randomUUID()));
|
||||
});
|
||||
if (iWgdAssocInfoService.saveOrUpdateBatch(res)) {
|
||||
return Result.success();
|
||||
}else {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("查询")
|
||||
@GetMapping("queryAllAssocInfos")
|
||||
public ResponseMessage<Object> queryAllWgdAssocInfos(WgdAssocInfo wgdAssocInfo){//多条件查询
|
||||
|
||||
@@ -63,13 +63,14 @@ public class WgdAssocInfo extends BasePage {
|
||||
|
||||
@ApiModelProperty(value = "初始入会时间")
|
||||
@Excel(name = "初始入会时间", orderNum = "8",width = 20.0 , exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date iniTime;
|
||||
|
||||
@ApiModelProperty(value = "本届入会时间")
|
||||
@Excel(name = "本届入会时间", orderNum = "9",width = 20.0 , exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date curTime;
|
||||
|
||||
@ApiModelProperty(value = "费用标准")
|
||||
@@ -82,6 +83,7 @@ public class WgdAssocInfo extends BasePage {
|
||||
|
||||
@ApiModelProperty(value = "上次缴纳时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "上次缴纳时间", orderNum = "12",width = 20.0 , exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date lastPayTime;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user