easyexcel ExcelProperty解析字段错误

envsm3lx  于 2022-10-26  发布在  其他
关注(0)|答案(2)|浏览(220)

建议先去看文档

快速开始常见问题

触发场景描述

触发Bug的代码

这里写代码
 String fileName = "d:/岗位类风险-选厂.xlsx";
        List<AqyfBasRiskAssessmentJob> list = new ArrayList<>();
        EasyExcel.read(fileName, AqyfBasRiskAssessmentJob.class, new ReadListener<AqyfBasRiskAssessmentJob>() {

            int line = 0;

            @Override
            public void invoke(AqyfBasRiskAssessmentJob job, AnalysisContext analysisContext) {
                //需要翻译字段 事故类型,部门、岗位、
                System.out.println(job);
            }

            @Override
            public void doAfterAllAnalysed(AnalysisContext analysisContext) {

            }
        }).doReadAll();

        System.out.println(list.size());

public class AqyfBasRiskAssessmentJob extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /***/
    private String id;

    /**序号 */
    @ExcelProperty("序号")
   // @Excel(name = "序号")
    private Long iindex;

    /**工作任务 */
    @ExcelProperty("工作任务")
    @Excel(name = "工作任务")
    private String workTask;

    /**步骤 */
    @Excel(name = "步骤")
    @ExcelProperty("步骤")
    private String step;

    /**区域 */
    @Excel(name = "区域")
    @ExcelProperty("区域")
    private String area;

    /**危险有害因素 */
    @ExcelProperty("危险有害因素")
    @Excel(name = "危险有害因素")
    private String dangerousFactor;

    /**危险有害因素类别 */
    private String dangerousFactorType;

    @Excel(name = "危险有害因素类别")
    @ExcelProperty("危险有害因素类别")
    private String dangerousFactorTypeName;
    /**事故模式与后果 */
    @Excel(name = "事故模式与后果")
    @ExcelProperty("事故模式与后果")
    private String accidentResult;

    /**事故类型 */
    private String accidentType;
    @ExcelProperty("事故类型")
    @Excel(name = "事故类型")
    private String accidentTypeName;

    /**管理措施 */
    @ExcelProperty("管控措施")
    @Excel(name = "管控措施")
    private String managementMeasure;

    /**应急措施 */
    @ExcelProperty("应急措施")
    @Excel(name = "应急措施")
    private String emergencyMeasure;

    /**可能性 */
    @ExcelProperty("可能性")
    @Excel(name = "可能性")
    private BigDecimal ipossibilityVal;

    /**暴露性 */
    @ExcelProperty("暴露")
    @Excel(name = "暴露性")
    private BigDecimal ifrequencyVal;

    /**后果 */
    @ExcelProperty("后果")
    @Excel(name = "后果")
    private BigDecimal iaftermathVal;

    /**风险值 */
    @ExcelProperty("风险值")
    @Excel(name = "风险值")
    private BigDecimal iriskVal;

    /**风险等级 */
    private BigDecimal iriskLevel;

    @Excel(name = "风险等级")
    @ExcelProperty("风险等级")
    private String iriskLevelName;

    /**是否可接受0不接受,1表示接受 */

    @Excel(name = "是否可接受", readConverterExp="0=否,1=是")
    private Long iacceptable;

    @ExcelProperty("是/否可接受")
    private String iacceptableName;

    /**直接责任人 */
    private Long iliableMan;
    @ExcelProperty("直接责任人")
    @Excel(name = "直接责任人")
    private String iliableManName;

    /**直接管理人 */
    private Long imanager;
    @ExcelProperty("直接管理人")
    @Excel(name = "直接管理人")
    private String imanagerName;

    /**监管责任人 */
    private Long isupervisor;
    @ExcelProperty("监管责任人")
    @Excel(name = "监管责任人")
    private String isupervisorName;

    /**判断类型类型 0表示固定岗位,1表示通用风险,2表示管理岗位风险 */
  //  @Excel(name = "判断类型类型 0表示固定岗位,1表示通用风险,2表示管理岗位风险")
    private String stype;

    /**若是固定岗位,为岗位对应的编码 */

    private Long ipostId;

    @Excel(name = "岗位")
    @ExcelProperty("岗位")
    private String ipostName;

    private Long   ideptid;
    @ExcelProperty("部门")
    @Excel(name = "部门名称")
    private String ideptidName;

    /**Map标记点 */
    private Long imapmakerId;
    @Excel(name = "Map标记点")
    private String imapmakerName;

    /**年度 */
    @Excel(name = "年度")
    private Long iyears;

    /**删除标志 */
//    @Excel(name = "删除标志")
    private Integer idelFlag;

    /**工作流id */
//    @Excel(name = "工作流id")
    private String sworkflowInstanceId;

    /**工作流状态 */
//    @Excel(name = "工作流状态")
    private Long iworkflowState;

    private String data;
    private List<AqyfBasRiskAssessmentJob> selfList;
    private String keywords;

}
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
<head>

<meta name=Generator content="Microsoft Excel">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
x\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--.font0
	{color:#000000;
	font-size:10.5pt;
	font-family:Calibri;
	font-weight:400;
	font-style:normal;
	text-decoration:none;}
.font1
	{color:#000000;
	font-size:11.0pt;
	font-family:宋体;
	font-weight:400;
	font-style:normal;
	text-decoration:none;}
.font2
	{color:#000000;
	font-size:10.5pt;
	font-family:宋体;
	font-weight:400;
	font-style:normal;
	text-decoration:none;}
br
	{mso-data-placement:same-cell;}
td
	{padding-top:1px;
	padding-left:1px;
	padding-right:1px;
	mso-ignore:padding;
	color:#000000;
	font-size:11.0pt;
	font-weight:400;
	font-style:normal;
	text-decoration:none;
	font-family:宋体;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	mso-number-format:General;
	border:none;
	mso-background-source:auto;
	mso-pattern:auto;
	text-align:general;
	vertical-align:middle;
	white-space:nowrap;
	mso-rotate:0;
	mso-protection:locked visible;}
.et2
	{color:#000000;
	font-size:10.5pt;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	border:.5pt solid #000000;
	white-space:normal;}
.et3
	{color:#000000;
	font-size:10.5pt;
	font-family:Calibri;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	border-top:none;
	border-right:1.0pt solid #000000;
	border-bottom:1.0pt solid #000000;
	border-left:1.0pt solid #000000;
	text-align:center;
	white-space:normal;}
.et4
	{color:#000000;
	font-size:10.5pt;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	border-top:1.0pt solid #000000;
	border-right:1.0pt solid #000000;
	border-bottom:none;
	border-left:1.0pt solid #000000;
	text-align:center;
	white-space:normal;}
.et5
	{color:#000000;
	font-size:10.5pt;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	border-top:1.0pt solid #000000;
	border-right:1.0pt solid #000000;
	border-bottom:none;
	border-left:1.0pt solid #000000;
	text-align:justify;
	white-space:normal;}
.et6
	{color:#000000;
	font-size:10.5pt;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	border-top:none;
	border-right:1.0pt solid #000000;
	border-bottom:1.0pt solid #000000;
	border-left:none;
	text-align:center;
	white-space:normal;}
.et7
	{color:#000000;
	font-size:10.5pt;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	border-top:none;
	border-right:1.0pt solid #000000;
	border-bottom:1.0pt solid #000000;
	border-left:none;
	text-align:justify;
	white-space:normal;}
.et8
	{color:#000000;
	font-size:10.5pt;
	font-family:Calibri;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	border-top:none;
	border-right:1.0pt solid #000000;
	border-bottom:1.0pt solid #000000;
	border-left:none;
	text-align:justify;
	white-space:normal;}
.et9
	{color:#000000;
	font-size:10.5pt;
	font-family:Calibri;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	border-top:none;
	border-right:1.0pt solid #000000;
	border-bottom:1.0pt solid #000000;
	border-left:none;
	text-align:center;
	white-space:normal;}
.et10
	{color:#000000;
	font-size:10.5pt;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	border-top:1.0pt solid #000000;
	border-right:none;
	border-bottom:1.0pt solid #000000;
	border-left:1.0pt solid #000000;
	text-align:center;
	white-space:normal;}
-->
</style>
</head>
<body>
<!--StartFragment-->

部门 | 岗位 | 序号 | 工作任务 | 步骤 | 区域 | 危险有害因素 | 危险有害因素类别 | 事故模式与后果 | 事故类型 | 管控措施 | 应急措施 | 可能性 | 暴露 | 后果 | 风险值 | 风险等级 | 是/否可接受 | 直接责任人 | 直接管理人 | 监管责任人
-- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | --
选矿车间 | 破碎工 | 1 | 班前工作准备 | 岗位巡查 | 破碎车间 | 未佩戴安全帽 | 人 | 未佩戴安全帽被头顶上方运行的行车掉下物品砸伤及被运行的设备转动部件甩出击中头部受伤或行走时摔倒头部无防护受伤 | 起重伤害、机械伤害、其他伤害 | 1、每天对设备及行车进行点检2、进入作业工作场所必须佩戴安全帽3、 为员工配发安全帽 | 无 | 0.5 | 3 | 25 | 37.5 | 四级 | 是 | 破碎工 | 班组长 | 车间主任
选矿车间 | 破碎工 | 2 | 班前工作准备 | 岗位巡查 | 破碎车间 | 未穿戴防滑鞋 | 人 | 未穿戴防滑鞋上下楼梯及湿滑地面易摔伤 | 其他伤害,高处坠落 | 1、上岗前必须穿戴齐全安全劳动防护用品2、为员工配发防滑鞋 | 实施公司《生产安全事故应急预案》 | 1 | 3 | 15 | 45 | 四级 | 是 | 破碎工 | 班组长 | 车间主任

<!--EndFragment-->
</body>

</html>

提示的异常或者没有达到的效果

ezykj2lf

ezykj2lf1#

excel发出来看下

n7taea2i

n7taea2i2#

bug-excel.xlsx
@juzi214032
@zhuangjiaju
目前按加index指定哪一列处理的

相关问题