起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: bex5chuxuezhe

[结贴] Excel导入时怎样根据条件修改某一单元格的值

[复制链接]

32

主题

133

帖子

237

积分

中级会员

Rank: 3Rank: 3

积分
237
QQ
 楼主| 发表于 2017-12-6 18:37:33 | 显示全部楼层
然后mapping.xml
是这样写的

<mapping>
  <default-config>
    <sheet all="false" start="1" end="1"/>  
    <row all="false" start="2" end="999999"/>
  </default-config>  
  <concept name="ORDER_INFO_TEMP">
    <relation name="CREATE_DATE" cell-number="1" check="true"  value-type="date" date-pattern="yyyy-MM-dd hh:mm:ss"/>  
    <relation name="CUSTOMER_NAME" cell-number="2"/>  
    <relation name="CUSTOMER_ID" cell-number="3"/>  
    <relation name="ORDER_ID" cell-number="4"/>  
    <relation name="SKU" cell-number="5"/>  
    <relation name="PRODUCT_NAME" cell-number="6"/>  
    <relation name="ADDRESS" cell-number="8"/>  
    <relation name="ZIP_CODE" cell-number="10"/>  
    <relation name="PHONE" cell-number="11"/>  
    <relation name="ORDER_BILL_NO" cell-number="12"/>
  </concept>
</mapping>
回复 支持 反对

使用道具 举报

32

主题

133

帖子

237

积分

中级会员

Rank: 3Rank: 3

积分
237
QQ
 楼主| 发表于 2017-12-6 18:39:03 | 显示全部楼层
我映射文件的ORDER_BILL_NO列,就是空的,我就想他是空的时候存成我生成的uuid,但是Java中获取这一列值得语句报了个空指针
回复 支持 反对

使用道具 举报

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
35942
发表于 2017-12-7 09:07:27 | 显示全部楼层
不是值为空的原因,getCell(10)是获取第11列的,你没有第11列
把10改为9
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

32

主题

133

帖子

237

积分

中级会员

Rank: 3Rank: 3

积分
237
QQ
 楼主| 发表于 2017-12-7 09:20:22 | 显示全部楼层
还是不行
回复

使用道具 举报

32

主题

133

帖子

237

积分

中级会员

Rank: 3Rank: 3

积分
237
QQ
 楼主| 发表于 2017-12-7 09:23:18 | 显示全部楼层
我要获取Excel中L行的值。他这一行都是空,我改成 9 后 获取的就都是 J行的数据了
N%}Z~(@_8RH3XHFVMAM@}EB.png
回复 支持 反对

使用道具 举报

32

主题

133

帖子

237

积分

中级会员

Rank: 3Rank: 3

积分
237
QQ
 楼主| 发表于 2017-12-7 10:31:16 | 显示全部楼层
我现在写的这一列都有值
for(int i=1;i<=sheet.getLastRowNum();i++){ //对行进行循环
                                 org.apache.poi.ss.usermodel.Row row=sheet.getRow(i);
                               Cell cell=row.getCell(18);
                                 
                                 System.out.println(cell.getStringCellValue());
                                
                                                       
                                          cell.setCellValue(uuid);

                                               
                }
还是包括空指针,他后台已经将19列的数据打印出来了
回复 支持 反对

使用道具 举报

32

主题

133

帖子

237

积分

中级会员

Rank: 3Rank: 3

积分
237
QQ
 楼主| 发表于 2017-12-7 10:31:33 | 显示全部楼层
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
Retail order
2017-12-07 10:30:05 excute stream action, params:{"accept":"application/json","action":"importExcel","actionFlag":"__action_0__","activity":"mainActivity","contentType":"json","executeContext":"","executor":"","parameters":{"config":{"@type":"xml","xml":"<config use-default=\"true\" to=\"DB\" excel-file=\"E:\\hylogister\\apache-tomcat\\temp\\736ecbbb-15e7-405f-a457-698cc462258b.excel.tmp\" mapping-file=\"E:\\hylogister\\apache-tomcat\\temp\\a8579aea-15a3-4e22-bf6f-b9b4ed1c8a42.excel.tmp\"><data><concept name=\"ORDER_INFO_TEMP\"><relation name=\"ADDRESS\" type=\"String\"/><relation name=\"CREATED_BY\" type=\"String\"/><relation name=\"CREATE_DATE\" type=\"Date\"/><relation name=\"CREATION_DATE\" type=\"DateTime\"/><relation name=\"CUSTOMER_ID\" type=\"String\"/><relation name=\"CUSTOMER_NAME\" type=\"String\"/><relation name=\"LAST_UPDATED_BY\" type=\"String\"/><relation name=\"LAST_UPDATE_DATE\" type=\"DateTime\"/><relation name=\"LAST_UPDATE_IP\" type=\"String\"/><relation name=\"ORDER_BILL_NO\" type=\"String\"/><relation name=\"ORDER_ID\" type=\"String\"/><relation name=\"ORDER_INFO_TEMP\" type=\"String\"/><relation name=\"PHONE\" type=\"String\"/><relation name=\"PROCESS_FLAG\" type=\"String\"/><relation name=\"PRODUCT_NAME\" type=\"String\"/><relation name=\"REMARK\" type=\"String\"/><relation name=\"SKU\" type=\"String\"/><relation name=\"ZIP_CODE\" type=\"String\"/><relation name=\"version\" type=\"Integer\"/></concept></data></config>"},"createActionParam":{"action":"createORDER_INFO_TEMPAction","activity":"mainActivity","parameters":{"table":{"@type":"table","rows":[],"userdata":{"idColumnDefine":"ORDER_INFO_TEMP","idColumnName":"ORDER_INFO_TEMP","idColumnType":"String","model":"/hylogister/ORDER_INFO_TEMP/data","relationAlias":"ADDRESS,CREATED_BY,CREATE_DATE,CREATION_DATE,CUSTOMER_ID,CUSTOMER_NAME,LAST_UPDATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_IP,ORDER_BILL_NO,ORDER_ID,PHONE,PROCESS_FLAG,PRODUCT_NAME,REMARK,SKU,ZIP_CODE,version","relationTypes":"String,String,Date,DateTime,String,String,String,DateTime,String,String,String,String,String,String,String,String,String,Integer","relations":"ORDER_INFO_TEMP.ADDRESS,ORDER_INFO_TEMP.CREATED_BY,ORDER_INFO_TEMP.CREATE_DATE,ORDER_INFO_TEMP.CREATION_DATE,ORDER_INFO_TEMP.CUSTOMER_ID,ORDER_INFO_TEMP.CUSTOMER_NAME,ORDER_INFO_TEMP.LAST_UPDATED_BY,ORDER_INFO_TEMP.LAST_UPDATE_DATE,ORDER_INFO_TEMP.LAST_UPDATE_IP,ORDER_INFO_TEMP.ORDER_BILL_NO,ORDER_INFO_TEMP.ORDER_ID,ORDER_INFO_TEMP.PHONE,ORDER_INFO_TEMP.PROCESS_FLAG,ORDER_INFO_TEMP.PRODUCT_NAME,ORDER_INFO_TEMP.REMARK,ORDER_INFO_TEMP.SKU,ORDER_INFO_TEMP.ZIP_CODE,ORDER_INFO_TEMP.version","updateMode":"whereVersion"}}},"process":"/hylogister/ORDER_INFO_TEMP/process/ORDER_INFO_TEMP/oRDER_INFO_TEMPProcess"},"saveActionParam":{"action":"saveORDER_INFO_TEMPAction","activity":"mainActivity","parameters":{"table":{"@type":"table","rows":[],"userdata":{"idColumnDefine":"ORDER_INFO_TEMP","idColumnName":"ORDER_INFO_TEMP","idColumnType":"String","model":"/hylogister/ORDER_INFO_TEMP/data","relationAlias":"ADDRESS,CREATED_BY,CREATE_DATE,CREATION_DATE,CUSTOMER_ID,CUSTOMER_NAME,LAST_UPDATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_IP,ORDER_BILL_NO,ORDER_ID,PHONE,PROCESS_FLAG,PRODUCT_NAME,REMARK,SKU,ZIP_CODE,version","relationTypes":"String,String,Date,DateTime,String,String,String,DateTime,String,String,String,String,String,String,String,String,String,Integer","relations":"ORDER_INFO_TEMP.ADDRESS,ORDER_INFO_TEMP.CREATED_BY,ORDER_INFO_TEMP.CREATE_DATE,ORDER_INFO_TEMP.CREATION_DATE,ORDER_INFO_TEMP.CUSTOMER_ID,ORDER_INFO_TEMP.CUSTOMER_NAME,ORDER_INFO_TEMP.LAST_UPDATED_BY,ORDER_INFO_TEMP.LAST_UPDATE_DATE,ORDER_INFO_TEMP.LAST_UPDATE_IP,ORDER_INFO_TEMP.ORDER_BILL_NO,ORDER_INFO_TEMP.ORDER_ID,ORDER_INFO_TEMP.PHONE,ORDER_INFO_TEMP.PROCESS_FLAG,ORDER_INFO_TEMP.PRODUCT_NAME,ORDER_INFO_TEMP.REMARK,ORDER_INFO_TEMP.SKU,ORDER_INFO_TEMP.ZIP_CODE,ORDER_INFO_TEMP.version","sys.count":137,"sys.rowid":"ORDER_INFO_TEMP","updateMode":"whereVersion"}}},"process":"/hylogister/ORDER_INFO_TEMP/process/ORDER_INFO_TEMP/oRDER_INFO_TEMPProcess"}},"process":"/hylogister/ORDER_INFO_TEMP/process/ORDER_INFO_TEMP/oRDER_INFO_TEMPProcess"}
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.justep.system.action.Engine.invokeActions(Native Method)
        at com.justep.system.action.Engine.invokeActions(Unknown Source)
        at com.justep.business.server.BusinessServer.doAction(Unknown Source)
        at com.justep.business.server.BusinessServer.doExcute(Unknown Source)
        at com.justep.business.server.BusinessServer.excute(Unknown Source)
        at com.justep.business.server.BusinessServer.excute(Unknown Source)
        at com.justep.business.server.BusinessServerServlet.execService(Unknown Source)
        at com.justep.business.server.BusinessServerServlet.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
        at com.justep.x.bs.BusinessServerServlet.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.justep.system.action.Engine.invokeAction(Native Method)
        at com.justep.system.action.Engine.invokeAction(Unknown Source)
        at com.justep.model.impl.UtilImplementInstance.invokeAction(Unknown Source)
        at com.justep.system.action.ActionUtils.invokeAction(Unknown Source)
        at com.justep.excel.ImportGenerator.generate(ImportGenerator.java:121)
        at Excel.importExcel(Excel.java:88)
        ... 27 more
Caused by: java.lang.NullPointerException
        at ORDER_INFO_TEMPProcess.oRDER_INFO_TEMPProcessAfterImportExcelBeforeAction(ORDER_INFO_TEMPProcess.java:17)
        ... 37 more
回复 支持 反对

使用道具 举报

32

主题

133

帖子

237

积分

中级会员

Rank: 3Rank: 3

积分
237
QQ
 楼主| 发表于 2017-12-7 10:40:40 | 显示全部楼层
大神这是我的源码,帮忙看一下

hos.rar

45.95 KB, 下载次数: 73

回复 支持 反对

使用道具 举报

32

主题

133

帖子

237

积分

中级会员

Rank: 3Rank: 3

积分
237
QQ
 楼主| 发表于 2017-12-7 10:41:47 | 显示全部楼层
这个是要导入的Excel

1.rar

24.53 KB, 下载次数: 64

回复 支持 反对

使用道具 举报

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
35942
发表于 2017-12-7 14:10:07 | 显示全部楼层
到网上查找poi操作excel获取单元格时怎么判断空的问题
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-5-17 16:52 , Processed in 0.064858 second(s), 25 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表