main
黄海 1 year ago
parent 656cd1f936
commit 67eef145ef

@ -12,6 +12,7 @@ import com.jfinal.ext.interceptor.POST;
import com.jfinal.kit.Kv;
import com.jfinal.kit.PathKit;
import com.jfinal.kit.PropKit;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.upload.UploadFile;
@ -47,7 +48,7 @@ public class DataShareController extends Controller {
@Before({POST.class})
@IsLoginInterface({})
@IsSysAdminInterface({"1"})
@EmptyInterface({"system_name","user_name"})
@EmptyInterface({"system_name", "user_name"})
public void addSystem(String system_name, String user_name) {
if (dm.isExistUserName(user_name)) {
Kv kv = Kv.by("success", false);
@ -109,8 +110,15 @@ public class DataShareController extends Controller {
@IsSysAdminInterface({"1"})
public void downloadXlsx(int system_id) {
Record record = dm.getSystemById(system_id);
String url = record.getStr("url");
if (StrKit.isBlank(url)) {
Kv kv = Kv.by("success", false);
kv.set("message", "此系统还没有上传说明文档,无法下载!");
renderJson(kv);
return;
}
String system_name = record.getStr("system_name");
String[] array = record.getStr("url").split("/");
String[] array = url.split("/");
String file_name = array[array.length - 1];
String basePath = PathKit.getWebRootPath() + "/upload/";
renderFile(new File(basePath + file_name), "【" + system_name + "】文档说明.xlsx");
@ -127,7 +135,15 @@ public class DataShareController extends Controller {
@IsSysAdminInterface({"1"})
public void previewXlsx(int system_id) {
Record record = dm.getSystemById(system_id);
String[] array = record.getStr("url").split("/");
String url = record.getStr("url");
if (StrKit.isBlank(url)) {
Kv kv = Kv.by("success", false);
kv.set("message", "此系统还没有上传说明文档,无法预览!");
renderJson(kv);
return;
}
String[] array = url.split("/");
String file_name = array[array.length - 1];
String basePath = PathKit.getWebRootPath() + "/upload/";
String realPath = basePath + file_name;

Loading…
Cancel
Save