使用Db.tx提交事务,return false 事务回滚之后。为什么不执行后续代码,后台直接报错: java.io.FileNotFoundException: Template "/admin2/szfz/save.html"
public void wstkCx(BaseController cl,final long tkid) {
final String msg []= { "撤销失败!"};
boolean tx = Db.tx(new IAtom() {
boolean flag;
@Override
public boolean run() throws SQLException {
WstkFq wstkFq = WstkFq.dao.findById(tkid);
wstkFq.set("scbz", "1");
flag = wstkFq.update();
if(!flag) {
return flag;
}
//发送短信
String ajid = wstkFq.getStr("ajid");
String dsrid = String.valueOf(wstkFq.getInt("tkr"));
String lxdh = AjDsrxxZhywxt.dao.queryLxdhByLaoid(ajid,dsrid);
String dsrmc = AjDsrxxZhywxt.dao.queryDsrmcByLaoid(ajid,dsrid);
try {
String code = SendMessageMW.sendMsg(lxdh, "您好,由于款项问题不能退款!");
/*if(!"ok".equals(code)) {
msg[0] = "短信发送失败";
flag = false;
return flag;
}*/
} catch (HttpException e) {
e.printStackTrace();
flag = false;
msg[0] = "短信发送失败";
} catch (IOException e) {
e.printStackTrace();
flag = false;
msg[0] = "短信发送失败";
}
flag = WstkFqDx.dao.saveWstkFqDx(tkid,"您好,由于款项问题不能退款!",lxdh,dsrmc);
return flag;
}
});
if (tx==true) {
cl.setAttr("success", true);
cl.setAttr("msg", "撤销成功!");
}else {
cl.setAttr("success", false);
cl.setAttr("msg",msg[0]);
}
cl.renderJson();
}