代码如下
@Ok("json")
@At("/test")
public NutMap test(@Param("id") String id){
NutMap re=new NutMap();
DocumentFile docPdf = dao().fetch(DocumentFile.class, Cnd.where("subjectId", "=", formId).and("type", "=", Constants.DOCUMENT_FILE_TYPE_PDFGONGWEN));
if (docPdf != null) {
re.setv("result", false);
re.setv("pdfId", docPdf.getId());
re.setv("directoryDocument", FileUploadHelper.getAbsoluteFilePath(docPdf.getPath()));
return re;
}
前端js这样可以吗
$.ajax({
type: "POST",
url: HOST+'sealDocument/test?id=' + id,
dataType: 'json',
cache: false,
success: function(data) {
if (data.result == true){
jAlert(data.pdfId);
jAlert(data.directoryDocument);
jAlert("成功!");
} else {
jAlert("失败");
}
}
});