From e4bd5c35f7ced8854b1caa6defa342d35d337b5e Mon Sep 17 00:00:00 2001
From: 杜洪波 <1074825718@qq.com>
Date: 星期二, 04 十一月 2025 17:57:33 +0800
Subject: [PATCH] 图表配置优化

---
 src/main/java/com/product/server/report/controller/ReportDatasourceController.java |  119 +++++++----------------------------------------------------
 1 files changed, 15 insertions(+), 104 deletions(-)

diff --git a/src/main/java/com/product/server/report/controller/ReportDatasourceController.java b/src/main/java/com/product/server/report/controller/ReportDatasourceController.java
index f0d0fac..b5b0961 100644
--- a/src/main/java/com/product/server/report/controller/ReportDatasourceController.java
+++ b/src/main/java/com/product/server/report/controller/ReportDatasourceController.java
@@ -26,14 +26,16 @@
 import com.product.server.report.service.idel.IReportDatasourceService;
 import com.product.util.config.SystemParamSet;
 
-
+/**
+ *	閰嶇疆鎶ヨ〃鏁版嵁婧� 
+ *
+ */
 @RestController
 @RequestMapping("/api/report-datasource")
 public class ReportDatasourceController extends AbstractBaseController{
 
 	@Autowired
 	ReportDatasourceService reportDatasourceService;
-
 
 	/**
 	 * 	鎶ヨ〃鏁版嵁婧愬垪琛�
@@ -46,22 +48,8 @@
 	public String listDatasource(HttpServletResponse response,HttpServletRequest request) {
 		try {
 			//鑾峰彇鍙傛暟
-			FieldSetEntity fse=null;
-			Object bean=request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
-			if(bean != null){
-	            RequestParameterEntity reqp=(RequestParameterEntity)bean;
-	            fse = reqp.getFormData();
-	        }
-	        //鍒ゆ柇鍙傛暟鏄惁涓虹┖
-			if(bean == null || fse == null) {
-				return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
-			}
-			//鍒ゆ柇琛ㄥ悕鏄惁姝e父
-			if (!CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG.equals(fse.getTableName())) {
-				return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
-			}
-			DataTableEntity dt=reportDatasourceService.listDatasource(fse);
-			return OK_List(dt);
+			FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG);
+			return OK_List(reportDatasourceService.listDatasource(fse));
 		} catch (BaseException e) {
 			e.printStackTrace();
 			return this.error(e.getCode(),e.getMessage());
@@ -82,26 +70,12 @@
 	public String findDatasource(HttpServletResponse response,HttpServletRequest request) {
 		try {
 			//鑾峰彇鍙傛暟
-			FieldSetEntity fse=null;
-			Object bean=request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
-			if(bean != null){
-	            RequestParameterEntity reqp=(RequestParameterEntity)bean;
-	            fse = reqp.getFormData();
-	        }
-	        //鍒ゆ柇鍙傛暟鏄惁涓虹┖
-			if(bean == null || fse == null) {
-				return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
-			}
-			//鍒ゆ柇琛ㄥ悕鏄惁姝e父
-			if (!CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG.equals(fse.getTableName())) {
-				return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
-			}
+			FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG);
 			//鍒ゆ柇uuid鏄惁涓虹┖
 			if (StringUtils.isEmpty(fse.getUUID())) {
 				return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
 			}
-			FieldSetEntity dt=reportDatasourceService.findDatasource(fse.getUUID());
-			return OK_List(dt);
+			return OK_List(reportDatasourceService.findDatasource(fse.getUUID()));
 		} catch (BaseException e) {
 			e.printStackTrace();
 			return this.error(e.getCode(),e.getMessage());
@@ -122,20 +96,7 @@
 	public String updateDatasource(HttpServletRequest request) {
 		try {
 			//鑾峰彇鍙傛暟
-			FieldSetEntity fse=null;
-			Object bean=request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
-			if(bean != null){
-	            RequestParameterEntity reqp=(RequestParameterEntity)bean;
-	            fse = reqp.getFormData();
-	        }
-	        //鍒ゆ柇鍙傛暟鏄惁涓虹┖
-			if(bean == null || fse == null) {
-				return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
-			}
-			//鍒ゆ柇琛ㄥ悕鏄惁姝e父
-			if (!CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG.equals(fse.getTableName())) {
-				return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
-			}
+			FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG);
 			IReportDatasourceService service=(IReportDatasourceService)getProxyInstance(reportDatasourceService);
 			String uuid = service.saveDatasource(fse);
 			return OK_Add(uuid);
@@ -159,20 +120,7 @@
 	public String copyDatasource(HttpServletRequest request) {
 		try {
 			//鑾峰彇鍙傛暟
-			FieldSetEntity fse = null;
-			Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
-			if (bean != null) {
-				RequestParameterEntity reqp = (RequestParameterEntity) bean;
-				fse = reqp.getFormData();
-			}
-			//鍒ゆ柇鍙傛暟鏄惁涓虹┖
-			if (bean == null || fse == null) {
-				return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
-			}
-			//鍒ゆ柇琛ㄥ悕鏄惁姝e父
-			if (!CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG.equals(fse.getTableName())) {
-				return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
-			}
+			FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG);
 			return OK_List(reportDatasourceService.copyDatasource(fse));
 		} catch (BaseException e) {
 			e.printStackTrace();
@@ -194,20 +142,7 @@
 	public String deleteDatasource(HttpServletResponse response,HttpServletRequest request) {
 		try {
 			//鑾峰彇鍙傛暟
-			FieldSetEntity fse=null;
-			Object bean=request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
-			if(bean != null){
-	            RequestParameterEntity reqp=(RequestParameterEntity)bean;
-	            fse = reqp.getFormData();
-	        }
-	        //鍒ゆ柇鍙傛暟鏄惁涓虹┖
-			if(bean == null || fse == null) {
-				return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
-			}
-			//鍒ゆ柇琛ㄥ悕鏄惁姝e父
-			if (!CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG.equals(fse.getTableName())) {
-				return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
-			}
+			FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG);
 			//鍒ゆ柇uuid鏄惁涓虹┖
 			if (StringUtils.isEmpty(fse.getUUID())) {
 				return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
@@ -216,9 +151,8 @@
 			boolean succ=service.deleteDatasource(fse.getUUID());
 			if (succ) {
 				return OK();
-			}else {
-				return this.error(SystemCode.SYTEM_REPORT_DATASOURCE_DELETE_ERROR.getValue(), SystemCode.SYTEM_REPORT_DATASOURCE_DELETE_ERROR.getText());
 			}
+			return this.error(SystemCode.SYTEM_REPORT_DATASOURCE_DELETE_ERROR.getValue(), SystemCode.SYTEM_REPORT_DATASOURCE_DELETE_ERROR.getText());
 		} catch (BaseException e) {
 			e.printStackTrace();
 			return this.error(e.getCode(),e.getMessage());
@@ -239,16 +173,7 @@
 	public String sqlVerify(HttpServletResponse response,HttpServletRequest request) {
 		try {
 			//鑾峰彇鍙傛暟
-			FieldSetEntity fse=null;
-			Object bean=request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
-			if(bean != null){
-	            RequestParameterEntity reqp=(RequestParameterEntity)bean;
-	            fse = reqp.getFormData();
-	        }
-	        //鍒ゆ柇鍙傛暟鏄惁涓虹┖
-			if(bean == null || fse == null) {
-				return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
-			}
+			FieldSetEntity fse = BaseUtil.getFieldSetEntity(request);
 			//鍒ゆ柇uuid鏄惁涓虹┖
 			if (StringUtils.isEmpty(fse.getString(CmnConst.SQL_TEXT))) {
 				return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
@@ -335,26 +260,12 @@
 	public String getDataReouceOfField(HttpServletResponse response,HttpServletRequest request) {
 		try {
 			//鑾峰彇鍙傛暟
-			FieldSetEntity fse=null;
-			Object bean=request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
-			if(bean != null){
-	            RequestParameterEntity reqp=(RequestParameterEntity)bean;
-	            fse = reqp.getFormData();
-	        }
-	        //鍒ゆ柇鍙傛暟鏄惁涓虹┖
-			if(bean == null || fse == null) {
-				return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
-			}
-			//鍒ゆ柇琛ㄥ悕鏄惁姝e父
-			if (!CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG_FIELD.equals(fse.getTableName())) {
-				return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
-			}
+			FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG_FIELD);
 			//鍒ゆ柇uuid鏄惁涓虹┖
 			if (StringUtils.isEmpty(fse.getUUID())) {
 				return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
 			}
-			DataTableEntity dt=reportDatasourceService.getDataReouceOfField(fse.getUUID());
-			return OK_List(dt);
+			return OK_List(reportDatasourceService.getDataReouceOfField(fse.getUUID()));
 		} catch (BaseException e) {
 			e.printStackTrace();
 			return this.error(e.getCode(),e.getMessage());

--
Gitblit v1.9.2