修改状态字段和导入

dongdingding
杜函宇 11 months ago
parent fcf24f0494
commit f7c78a8598

@ -133,10 +133,10 @@ public class JProjectController extends BaseController {
})
@PostMapping(value = "/importTemplateProject",consumes ="multipart/form-data")
public AjaxResult importTemplateProject(@RequestPart("file") MultipartFile file,
@RequestParam("projectClassify")String projectClassify,
@RequestParam("projectYear")String projectYear) throws Exception {
@RequestParam("projectClassify")String projectClassify
) throws Exception {
ProjectValueUtil<JProject> util = new ProjectValueUtil<>(JProject.class);
List<JProject> proList = util.importExcel(file.getInputStream(),projectClassify,projectYear);
List<JProject> proList = util.importExcel(file.getInputStream(),projectClassify);
StringBuilder successMsg = new StringBuilder();
if(proList == null && proList.isEmpty()){
throw new ServiceException("项目导入数据不能为空");

@ -23,4 +23,11 @@ public class JProjectExcel {
@Excel(name = "申报单位")
@ApiModelProperty("申报单位")
private String declareUnit;
/**
*
*/
@Excel(name = "年份")
@ApiModelProperty("年份")
private String projectYear;
}

@ -234,10 +234,10 @@ public class ProjectValueUtil<T> {
* @param is
* @return
*/
public List<T> importExcel(InputStream is,String projectClassify,String projectYear) {
public List<T> importExcel(InputStream is,String projectClassify) {
List<T> list = null;
try {
list = importExcel(is, 0,projectClassify,projectYear);
list = importExcel(is, 0,projectClassify);
} catch (Exception e) {
log.error("导入Excel异常{}", e.getMessage());
throw new UtilException(e.getMessage());
@ -254,8 +254,8 @@ public class ProjectValueUtil<T> {
* @param titleNum
* @return
*/
public List<T> importExcel(InputStream is, int titleNum,String projectClassify,String projectYear) throws Exception {
return importExcel(StringUtils.EMPTY, is, titleNum,projectClassify,projectYear);
public List<T> importExcel(InputStream is, int titleNum,String projectClassify) throws Exception {
return importExcel(StringUtils.EMPTY, is, titleNum,projectClassify);
}
/**
@ -266,7 +266,7 @@ public class ProjectValueUtil<T> {
* @param is
* @return
*/
public List<T> importExcel(String sheetName, InputStream is, int titleNum,String projectClassify,String projectYear) throws Exception {
public List<T> importExcel(String sheetName, InputStream is, int titleNum,String projectClassify) throws Exception {
this.type = Type.IMPORT;
this.wb = WorkbookFactory.create(is);
List<T> list = new ArrayList<T>();
@ -383,7 +383,6 @@ public class ProjectValueUtil<T> {
}
}
ReflectUtils.invokeSetter(entity, "projectClassify", projectClassify);
ReflectUtils.invokeSetter(entity, "projectYear", projectYear);
ReflectUtils.invokeSetter(entity, "status", 5);
cellMap.entrySet().removeIf(entry -> hasStr.contains(entry.getKey()));
StringBuilder str = new StringBuilder();

Loading…
Cancel
Save