NutzCN Logo
问答 前台传过来的数据集,无法转换为list
发布于 2514天前 作者 qq_7fafbecc 1544 次浏览 复制 上一个帖子 下一个帖子
标签:

代码:

System.out.println(map.get("detailData"));
		detailList = (List)map.get("detailData");

控制台打印:

[{"projectCode":"P0004","projectCodeText":"全血","unit":"1","unitText":"ml","confirmStatus":"0","confirmStatusText":"未审核","amount":"22.00","projectMemo":"4444"},{"projectCode":"P0014","projectCodeText":"去白细胞全血","unit":"1","unitText":"ml","confirmStatus":"0","confirmStatusText":"未审核","amount":"33.00","projectMemo":"5555"}]

异常信息:

For the reason: java.lang.String cannot be cast to java.util.List
	at org.nutz.lang.Invoking.invoke(Invoking.java:195)
	at org.nutz.lang.Mirror.invoke(Mirror.java:1100)
	at com.shlx.blood.service.ComServices.ExcuteServices(ComServices.java:139)
	at com.shlx.blood.action.business.TicketInfoAction.saveTicketInfo(TicketInfoAction.java:70)
	at com.shlx.blood.action.business.TicketInfoAction$$FASTCLASS._invoke(TicketInfoAction.java:1)
	at org.nutz.lang.reflect.AbstractFastClass.invoke(AbstractFastClass.java:143)
	at org.nutz.lang.reflect.FastClassFactory.invoke(FastClassFactory.java:67)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at com.shlx.blood.mvc.SessionCheckProcessor.process(SessionCheckProcessor.java:56)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
	at com.shlx.blood.service.business.TicketInfoService.saveTicketInfo(TicketInfoService.java:120)
	at com.shlx.blood.service.business.TicketInfoService$$NUTZAOP._aop_invoke(TicketInfoService.java:2)
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
	at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at com.shlx.blood.aop.ServiceInterceptor.filter(ServiceInterceptor.java:48)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at com.shlx.blood.service.business.TicketInfoService$$NUTZAOP.saveTicketInfo(TicketInfoService.java:1)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.nutz.lang.Invoking$DefaultInvoker.invoke(Invoking.java:47)
	at org.nutz.lang.Invoking.invoke(Invoking.java:192)
	... 42 more
3 回复

所以detailData的确是个字符串

是啊,我在前台把他弄成一长串json,
问题是后台怎么解析成List来循环处理呢?

取出字符串,然后Json.fromJson

来自炫酷的 NutzCN

添加回复
请先登陆
回到顶部