@At("/dev/cbom-imporHours")
@Ok("jsp:pages.dev.cbom.cbom-ImportHoursExcel")
public Object imporHours(String path) throws InvalidFormatException, FileNotFoundException, IOException, IllegalAccessException, InvocationTargetException {
return cbomService.imporHours(path);
}
map.put("hoursData", hoursData);
map.put("hoursInsertData", hoursInsertData);
map.put("hoursUpdateData", hoursUpdateData);
//后台直接 转json 字符串
map.put("hoursInsertDataJson", Json.toJson(hoursInsertData, JsonFormat.compact()));
map.put("hoursUpdateDataJson", Json.toJson(hoursUpdateData, JsonFormat.compact()));
return map;
var ctx = '${base}';
var hoursInsertData = '${obj.hoursInsertData}';
var hoursUpdateData = '${obj.hoursUpdateData}';
var hoursInsertDataJson = '${obj.hoursInsertDataJson}';
var hoursUpdateDataJson = '${obj.hoursUpdateDataJson}';
alert($.toJSON({hoursInsertData:hoursInsertDataJson,hoursUpdateData:hoursUpdateDataJson}));
{"hoursInsertData":"[{"productId":2077,"stageId":6,"quarterId":50,"workHours":0.0,"trColor":"#FFF","kh":"15646569","quarterName":"16q4","stageName":"大货","seq":"1","state":0,"creater":"系统管理员","createTime":"2016-04-11 19:47:54","cutTime":888.0,"cutPrice":21.0,"sewTime":31.0,"sewPrice":41.0,"packTime":51.0,"packPrice":61.0,"totalTime":71.0,"totalPrice":8.5155}]","hoursUpdateData":"{}"}
//后台适配到的对象
[{productId=2077, stageId=6, quarterId=50, workHours=0.0, trColor=#FFF, kh=15646569, quarterName=16q4, stageName=大货, seq=1, state=0, creater=系统管理员, createTime=2016-04-11 19:42:50, cutTime=888.0, cutPrice=21.0, sewTime=31.0, sewPrice=41.0, packTime=51.0, packPrice=61.0, totalTime=71.0, totalPrice=8.5155}]
执行 dao().insert(hoursInsertData); //异常
2016-04-11 19:53:32,214 - org.nutz.mvc.impl.processor.FailProcessor -688269 [http-bio-8080-exec-10] WARN - Error@/dev/cbom-imporHoursData :
java.lang.RuntimeException: Can not insert map without key '.table' :
{
productId :2077,
stageId :6,
quarterId :50,
workHours :0.0,
trColor :"#FFF",
kh :"15646569",
quarterName :"16q4",
stageName :"大货",
seq :"1",
state :0,
creater :"系统管理员",
createTime :"2016-04-11 19:42:50",
cutTime :888.0,
cutPrice :21.0,
sewTime :31.0,
sewPrice :41.0,
packTime :51.0,
packPrice :61.0,
totalTime :71.0,
totalPrice :8.5155
}
at org.nutz.lang.Lang.makeThrow(Lang.java:99)
at org.nutz.dao.impl.EntityHolder.getEntityBy(EntityHolder.java:181)
at org.nutz.dao.impl.NutDao._optBy(NutDao.java:921)
at org.nutz.dao.impl.NutDao.insert(NutDao.java:136)