|
|
|
@ -15,19 +15,15 @@ import com.jfinal.ext.interceptor.GET;
|
|
|
|
|
import com.jfinal.ext.interceptor.POST;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Page;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
import io.github.yedaxia.apidocs.ApiDoc;
|
|
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
|
|
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
@ApiDoc
|
|
|
|
|
public class MetaDataController extends Controller {
|
|
|
|
|
//实例化model
|
|
|
|
|
MetaDataModel metaDataModel = new MetaDataModel();
|
|
|
|
@ -42,10 +38,6 @@ public class MetaDataController extends Controller {
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsNumericInterface({"task_id"})
|
|
|
|
|
public void downloadDataTemplate(int task_id) throws Exception{
|
|
|
|
|
|
|
|
|
|
HttpServletRequest request = getRequest();
|
|
|
|
|
HttpServletResponse response = getResponse();
|
|
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
|
|
|
|
String templatePath = CommonUtil.getClassPath() +
|
|
|
|
@ -66,10 +58,20 @@ public class MetaDataController extends Controller {
|
|
|
|
|
JSONObject titleObject = new JSONObject();
|
|
|
|
|
titleObject.put("task_id",task_id);
|
|
|
|
|
titleObject.put("template","metadataTemplate");
|
|
|
|
|
HSSFRow firstRow = sheet.createRow(0);
|
|
|
|
|
HSSFRow firstRow = null;
|
|
|
|
|
if (sheet != null) {
|
|
|
|
|
firstRow = sheet.createRow(0);
|
|
|
|
|
}
|
|
|
|
|
if (firstRow != null) {
|
|
|
|
|
firstRow.setHeight((short) 0);
|
|
|
|
|
HSSFCell firstCell = firstRow.createCell(0);
|
|
|
|
|
}
|
|
|
|
|
HSSFCell firstCell = null;
|
|
|
|
|
if (firstRow != null) {
|
|
|
|
|
firstCell = firstRow.createCell(0);
|
|
|
|
|
}
|
|
|
|
|
if (firstCell != null) {
|
|
|
|
|
firstCell.setCellValue(titleObject.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 空白单元格样式
|
|
|
|
|
HSSFCellStyle dataCellStyle = ImportExcelController.createCellColorStyle(workbook, IndexedColors.WHITE.getIndex());
|
|
|
|
@ -77,7 +79,7 @@ public class MetaDataController extends Controller {
|
|
|
|
|
metaDataModel.handleSheetData(sheetTable1, dataCellStyle);
|
|
|
|
|
metaDataModel.handleSheetData(sheetTable2, dataCellStyle);
|
|
|
|
|
|
|
|
|
|
ImportExcelController.downloadExcel(request, response, workbook, "元数据信息导入模板",false);
|
|
|
|
|
ImportExcelController.downloadExcel(getResponse(),workbook, "元数据信息导入模板",false);
|
|
|
|
|
renderNull();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -91,8 +93,7 @@ public class MetaDataController extends Controller {
|
|
|
|
|
*/
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
@IsNumericInterface({"task_id","system_id"})
|
|
|
|
|
public void importDataTemplate(int task_id, int system_id) throws URISyntaxException, ParseException {
|
|
|
|
|
|
|
|
|
|
public void importDataTemplate(int task_id, int system_id) throws ParseException {
|
|
|
|
|
//操作人
|
|
|
|
|
Record rPerson = JwtUtil.getPersonInfo(getRequest());
|
|
|
|
|
String person_id = rPerson.getStr("person_id");
|
|
|
|
@ -161,8 +162,6 @@ public class MetaDataController extends Controller {
|
|
|
|
|
|
|
|
|
|
JSONObject importToDBResult = metaDataModel.importMetadataToDB(dataMap, columns, task_id, system_id, supplier_id, person_id, bureau_id);
|
|
|
|
|
renderJson(importToDBResult);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -183,7 +182,7 @@ public class MetaDataController extends Controller {
|
|
|
|
|
String bureau_id = rPerson.getStr("bureau_id");
|
|
|
|
|
|
|
|
|
|
Page<Record> dt;
|
|
|
|
|
if (system_name == null || "".equals(system_name)) {
|
|
|
|
|
if (system_name == null || system_name.isEmpty()) {
|
|
|
|
|
dt = metaDataModel.getSystemList(bureau_id, page, limit);
|
|
|
|
|
} else {
|
|
|
|
|
dt = metaDataModel.getSystemListBySystemName(bureau_id, page, limit, system_name);
|
|
|
|
@ -235,7 +234,7 @@ public class MetaDataController extends Controller {
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsNumericInterface({"id"})
|
|
|
|
|
public void getSystemById(int id) {
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
Record record;
|
|
|
|
|
try {
|
|
|
|
|
record = metaDataModel.getSystemInfoBySystemId(id);
|
|
|
|
|
if (record != null) {
|
|
|
|
@ -301,7 +300,7 @@ public class MetaDataController extends Controller {
|
|
|
|
|
String bureau_id = rPerson.getStr("bureau_id");
|
|
|
|
|
|
|
|
|
|
Page<Record> dt;
|
|
|
|
|
if (supplier_name == null || "".equals(supplier_name)) {
|
|
|
|
|
if (supplier_name == null || supplier_name.isEmpty()) {
|
|
|
|
|
dt = metaDataModel.getSupplierList(bureau_id, page, limit);
|
|
|
|
|
} else {
|
|
|
|
|
dt = metaDataModel.getSupplierListBySupplierName(bureau_id, page, limit, supplier_name);
|
|
|
|
@ -337,10 +336,10 @@ public class MetaDataController extends Controller {
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (supplier_info_json == null || "".equals(supplier_info_json)) {
|
|
|
|
|
if (supplier_info_json == null || supplier_info_json.isEmpty()) {
|
|
|
|
|
supplier_info_json = "{}";
|
|
|
|
|
}
|
|
|
|
|
if (contact_person_json == null || "".equals(contact_person_json)) {
|
|
|
|
|
if (contact_person_json == null || contact_person_json.isEmpty()) {
|
|
|
|
|
contact_person_json = "{}";
|
|
|
|
|
}
|
|
|
|
|
// 供应商基本信息
|
|
|
|
@ -393,7 +392,7 @@ public class MetaDataController extends Controller {
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsNumericInterface({"id"})
|
|
|
|
|
public void getSupplierById(int id) {
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
Record record;
|
|
|
|
|
try {
|
|
|
|
|
record = metaDataModel.getSupplierInfoBySupplierId(id);
|
|
|
|
|
if (record != null) {
|
|
|
|
@ -459,7 +458,7 @@ public class MetaDataController extends Controller {
|
|
|
|
|
String bureau_id = rPerson.getStr("bureau_id");
|
|
|
|
|
|
|
|
|
|
Page<Record> dt;
|
|
|
|
|
if (task_name == null || "".equals(task_name)) {
|
|
|
|
|
if (task_name == null || task_name.isEmpty()) {
|
|
|
|
|
dt = metaDataModel.getTaskList(bureau_id, page, limit);
|
|
|
|
|
} else {
|
|
|
|
|
dt = metaDataModel.getTaskListByTaskName(bureau_id, page, limit, task_name);
|
|
|
|
@ -508,7 +507,7 @@ public class MetaDataController extends Controller {
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsNumericInterface({"id"})
|
|
|
|
|
public void getTaskById(int id) {
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
Record record;
|
|
|
|
|
try {
|
|
|
|
|
record = metaDataModel.getTaskInfoByTaskId(id);
|
|
|
|
|
if (record != null) {
|
|
|
|
@ -662,7 +661,7 @@ public class MetaDataController extends Controller {
|
|
|
|
|
int supplier_id = supplierRecord.getInt("id");
|
|
|
|
|
|
|
|
|
|
Page<Record> dt;
|
|
|
|
|
if (task_name == null || "".equals(task_name)) {
|
|
|
|
|
if (task_name == null || task_name.isEmpty()) {
|
|
|
|
|
dt = metaDataModel.getSupplierTaskList(bureau_id, supplier_id, page, limit);
|
|
|
|
|
} else {
|
|
|
|
|
dt = metaDataModel.getSupplierTaskListByTaskName(bureau_id, supplier_id, page, limit, task_name);
|
|
|
|
@ -955,26 +954,4 @@ public class MetaDataController extends Controller {
|
|
|
|
|
renderJson(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:【MetaData-Task-Collect-9】元数据采集-导出
|
|
|
|
|
* 作者:Kalman.CHENG ☆
|
|
|
|
|
* 日期:2025/6/18 14:44
|
|
|
|
|
* 备注:
|
|
|
|
|
**/
|
|
|
|
|
/*@Before({GET.class})
|
|
|
|
|
@IsNumericInterface({"task_id", "supplier_id"})
|
|
|
|
|
@EmptyInterface({"task_id"})
|
|
|
|
|
public void exportTaskCollectTableColumn(int task_id, int supplier_id) {
|
|
|
|
|
|
|
|
|
|
// supplier_id 为0的时候,表示管理员导出,整个任务的数据, 不为0的时候,表示供应商自己导出自己
|
|
|
|
|
JSONObject result = metaDataModel.createExportTaskInfo(task_id, supplier_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|