|
|
|
@ -2,10 +2,9 @@ package com.dsideal.QingLong.DataShare.Controller;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import com.dsideal.QingLong.DataShare.Model.DataShareModel;
|
|
|
|
|
import com.dsideal.QingLong.Gtzz.Model.GtzzModel;
|
|
|
|
|
import com.dsideal.QingLong.Interceptor.*;
|
|
|
|
|
import com.dsideal.QingLong.Util.CommonUtil;
|
|
|
|
|
import com.dsideal.QingLong.Util.FileSizeUtil;
|
|
|
|
|
import com.dsideal.QingLong.Util.IpUtil;
|
|
|
|
|
import com.jfinal.aop.Before;
|
|
|
|
|
import com.jfinal.core.Controller;
|
|
|
|
|
import com.jfinal.ext.interceptor.GET;
|
|
|
|
@ -13,7 +12,6 @@ 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;
|
|
|
|
@ -49,7 +47,7 @@ public class DataShareController extends Controller {
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
@IsSysAdminInterface({"1"})
|
|
|
|
|
@EmptyInterface({"system_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);
|
|
|
|
@ -100,6 +98,50 @@ public class DataShareController extends Controller {
|
|
|
|
|
renderJson(kv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:下载EXCEL文档说明
|
|
|
|
|
*
|
|
|
|
|
* @param system_id
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
@IsNumericInterface({"system_id"})
|
|
|
|
|
@IsSysAdminInterface({"1"})
|
|
|
|
|
public void downloadXlsx(int system_id) {
|
|
|
|
|
Record record = dm.getSystemById(system_id);
|
|
|
|
|
String system_name = record.getStr("system_name");
|
|
|
|
|
String[] array = record.getStr("url").split("/");
|
|
|
|
|
String file_name = array[array.length - 1];
|
|
|
|
|
String basePath = PathKit.getWebRootPath() + "/upload/";
|
|
|
|
|
renderFile(new File(basePath + file_name), "【" + system_name + "】文档说明.xlsx");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:预览EXCEL文件
|
|
|
|
|
*
|
|
|
|
|
* @param system_id
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
@IsNumericInterface({"system_id"})
|
|
|
|
|
@IsSysAdminInterface({"1"})
|
|
|
|
|
public void previewXlsx(int system_id) {
|
|
|
|
|
Record record = dm.getSystemById(system_id);
|
|
|
|
|
String[] array = record.getStr("url").split("/");
|
|
|
|
|
String file_name = array[array.length - 1];
|
|
|
|
|
String basePath = PathKit.getWebRootPath() + "/upload/";
|
|
|
|
|
String realPath = basePath + file_name;
|
|
|
|
|
GtzzModel gm = new GtzzModel();
|
|
|
|
|
gm.uploadForPreview(realPath);
|
|
|
|
|
//获取预览地址
|
|
|
|
|
Kv kv = Kv.create();
|
|
|
|
|
String previewName = "https://ow365.cn/?i=14531&ssl=1&info=3&fname=" + file_name + "&furl=" + "https://video.edusoa.com/ccsjy-gtzz/" + file_name;
|
|
|
|
|
kv.set("forPrintUrl", previewName);
|
|
|
|
|
renderJson(kv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:根据系统ID获取系统信息
|
|
|
|
|