fix:78298
This commit is contained in:
+9
-12
@@ -11,8 +11,8 @@ import com.jero.common.aspect.annotation.AutoLog;
|
|||||||
import com.jero.common.constant.CommonConstant;
|
import com.jero.common.constant.CommonConstant;
|
||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
import com.jero.common.system.base.controller.JeroController;
|
import com.jero.common.system.base.controller.JeroController;
|
||||||
|
import com.jero.common.util.ImportExcelUtil;
|
||||||
import com.jero.common.util.MessageUtils;
|
import com.jero.common.util.MessageUtils;
|
||||||
import com.jero.modules.activiti.util.ExcelUtils;
|
|
||||||
import com.jero.modules.laws.common.constant.ResultCommon;
|
import com.jero.modules.laws.common.constant.ResultCommon;
|
||||||
import com.jero.modules.sys.entity.LawsWorkingGroupUser;
|
import com.jero.modules.sys.entity.LawsWorkingGroupUser;
|
||||||
import com.jero.modules.sys.service.ILawsWorkingGroupUserService;
|
import com.jero.modules.sys.service.ILawsWorkingGroupUserService;
|
||||||
@@ -172,21 +172,18 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
|||||||
if (fileName.lastIndexOf(".") != -1 && !".xlsx".equals(fileName.substring(fileName.lastIndexOf(".")))) {
|
if (fileName.lastIndexOf(".") != -1 && !".xlsx".equals(fileName.substring(fileName.lastIndexOf(".")))) {
|
||||||
throw new JeroBootException(ResultCommon.PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLSX);
|
throw new JeroBootException(ResultCommon.PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLSX);
|
||||||
}
|
}
|
||||||
|
boolean b;
|
||||||
// 获取Excel的header
|
|
||||||
List<String> headers;
|
|
||||||
try {
|
try {
|
||||||
headers = ExcelUtils.getHeaderFromExcel(file.getInputStream(), 0);
|
b = ImportExcelUtil.checkTemplateTitle(file, LawsWorkingGroupUser.class, 0, 0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
e.printStackTrace();
|
||||||
throw new JeroBootException("导入模板错误");
|
throw new JeroBootException(ResultCommon.PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLSX);
|
||||||
|
}
|
||||||
|
// 校验excel 字段是否正确
|
||||||
|
if (!b) {
|
||||||
|
throw new JeroBootException(ResultCommon.HEADER_INCONSISTENT_WITH_TEMPLATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用静态方法验证header
|
|
||||||
boolean isMatched = headers.equals(ExcelUtils.getSortedHeadersFromClass(LawsWorkingGroupUser.class));
|
|
||||||
if (!isMatched) {
|
|
||||||
throw new JeroBootException("导入模板错误");
|
|
||||||
}
|
|
||||||
InputStream inputStream = file.getInputStream();
|
InputStream inputStream = file.getInputStream();
|
||||||
List<LawsWorkingGroupUser> all;
|
List<LawsWorkingGroupUser> all;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -73,17 +74,21 @@ public class LawsWorkingGroupUser implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "姓名")
|
@ApiModelProperty(value = "姓名")
|
||||||
|
@Excel(name = "姓名")
|
||||||
private String realname;
|
private String realname;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "工号")
|
@ApiModelProperty(value = "工号")
|
||||||
|
@Excel(name = "工号")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "角色")
|
@ApiModelProperty(value = "角色")
|
||||||
|
@Excel(name = "角色")
|
||||||
private String userRoleName;
|
private String userRoleName;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "岗位")
|
@ApiModelProperty(value = "岗位")
|
||||||
|
@Excel(name = "岗位")
|
||||||
private String userPostName;
|
private String userPostName;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user