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/service/ChartPropertyConfigService.java | 58 ++--
src/main/java/com/product/server/report/config/CmnConst.java | 13
src/main/java/com/product/server/report/controller/ReportTypeController.java | 202 +----------------
src/main/java/com/product/server/report/controller/ReportDatasourceController.java | 119 +---------
src/test/java/com/product/server/report/ReportTypeTest.java | 2
src/main/java/com/product/server/report/service/idel/IGenerateEChartService.java | 2
src/main/java/com/product/server/report/service/GenerateEChartService.java | 181 ++++++++-------
src/main/java/com/product/server/report/service/idel/IReportTypeService.java | 1
src/main/java/com/product/server/report/controller/GenerateEChartController.java | 2
src/main/java/com/product/server/report/service/ReportTypeService.java | 69 +++--
10 files changed, 201 insertions(+), 448 deletions(-)
diff --git a/src/main/java/com/product/server/report/config/CmnConst.java b/src/main/java/com/product/server/report/config/CmnConst.java
index aa1d57c..bbbc491 100644
--- a/src/main/java/com/product/server/report/config/CmnConst.java
+++ b/src/main/java/com/product/server/report/config/CmnConst.java
@@ -22,11 +22,6 @@
public static final String PRODUCT_SYS_MENUS = "product_sys_menus";
public static final String PRODUCT_SYS_DATAMODEL_TABLE = "product_sys_datamodel_table";
- //鍒嗛〉甯搁噺瀹氫箟
- public static final String CPAGE = "cpage"; //椤垫暟
- public static final String PAGESIZE = "pagesize"; //姣忛〉鏉℃暟
-
-
//鐗规畩甯搁噺瀹氫箟
public static final String TYPE = "~type~";
public static final String DEL = "del";
@@ -34,7 +29,8 @@
public static final String ID = "id";
public static final String OPTION = "option";
public static final String TABLE_NAME = "table_name";
- //鏁版嵁搴撶被鍨�
+ public static final String CPAGE = "cpage"; //椤垫暟
+ public static final String PAGESIZE = "pagesize"; //姣忛〉鏉℃暟
public static final String MYSQL = "mysql";
//甯搁噺瀛楁瀹氫箟
@@ -118,6 +114,11 @@
public static final String ATTRIBUTE_NAME = "attribute_name";
public static final String UNPIVOT_INFO = "unpivot_info";
public static final String IS_UNPIVOT = "is_unpivot";
+ public static final String GROUP_SIGN = "group_sign";
+ public static final String PARENT_ATTRIBUTE_NAME = "parent_attribute_name";
+ public static final String PARENT_ATTRIBUTE_UUID = "parent_attribute_uuid";
+ public static final String SUBORDINATE_ELEMENT_TYPE = "subordinate_element_type";
+
public static final String REPORT_TYPE = "report_type";
public static final String REPORT_TYPE_COMMON = "鏅�氭暟鎹垪琛�";
diff --git a/src/main/java/com/product/server/report/controller/GenerateEChartController.java b/src/main/java/com/product/server/report/controller/GenerateEChartController.java
index dd575c9..54e0784 100644
--- a/src/main/java/com/product/server/report/controller/GenerateEChartController.java
+++ b/src/main/java/com/product/server/report/controller/GenerateEChartController.java
@@ -142,7 +142,7 @@
return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
}
IGenerateEChartService service=(IGenerateEChartService)getProxyInstance(generateEChartService);
- List<String> roleList = service.releaseConfig(fse,"207da368-38c4-468a-9dfe-2e57aa38507f");
+ List<String> roleList = service.releaseConfig(fse, "68efc4d7-c743-4872-bc04-cf8ad1991df6");
updateLoginUserInfoService.updateUserInfoByUpdateRole(roleList.toArray(),true);
return OK();
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());
diff --git a/src/main/java/com/product/server/report/controller/ReportTypeController.java b/src/main/java/com/product/server/report/controller/ReportTypeController.java
index 515867b..b15ecd7 100644
--- a/src/main/java/com/product/server/report/controller/ReportTypeController.java
+++ b/src/main/java/com/product/server/report/controller/ReportTypeController.java
@@ -2,11 +2,9 @@
import com.alibaba.fastjson.JSONObject;
import com.product.common.lang.StringUtils;
-import com.product.core.config.CoreConst;
import com.product.core.controller.support.AbstractBaseController;
import com.product.core.entity.DataTableEntity;
import com.product.core.entity.FieldSetEntity;
-import com.product.core.entity.RequestParameterEntity;
import com.product.core.exception.BaseException;
import com.product.module.sys.version.ApiVersion;
import com.product.server.report.config.CmnConst;
@@ -23,7 +21,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+/**
+ * 鎶ヨ〃绫诲瀷-鎶ヨ〃绫诲瀷灞炴��
+ *
+ */
@RestController
@RequestMapping("/api/report-type")
public class ReportTypeController extends AbstractBaseController{
@@ -43,20 +44,7 @@
public String listReportType(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_TYPE_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_TYPE_CONFIG);
DataTableEntity dt = reportTypeService.listReportType(fse);
return OK_List(dt);
} catch (BaseException e) {
@@ -79,20 +67,7 @@
public String findReportType(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_TYPE_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_TYPE_CONFIG);
//鍒ゆ柇uuid鏄惁涓虹┖
if (StringUtils.isEmpty(fse.getUUID())) {
return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
@@ -119,20 +94,7 @@
public String addReportType(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_TYPE_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_TYPE_CONFIG);
IReportTypeService service=(IReportTypeService)getProxyInstance(reportTypeService);
String uuid=service.addReportType(fse);
return OK_Add(uuid);
@@ -156,20 +118,7 @@
public String updateReportType(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_TYPE_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_TYPE_CONFIG);
//鍒ゆ柇uuid鏄惁涓虹┖
if (StringUtils.isEmpty(fse.getUUID())) {
return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
@@ -201,20 +150,7 @@
public String deleteReportType(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_TYPE_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_TYPE_CONFIG);
//鍒ゆ柇uuid鏄惁涓虹┖
if (StringUtils.isEmpty(fse.getUUID())) {
return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
@@ -246,20 +182,7 @@
public String listReportByGroup(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_TYPE_ATTRIBUTE.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_TYPE_ATTRIBUTE);
//鍒ゆ柇浼犲弬鏄惁姝g‘
if (StringUtils.isEmpty(fse.getString(CmnConst.TYPE_GROUP))) {
return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
@@ -286,20 +209,7 @@
public String listReportAttr(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_TYPE_ATTRIBUTE.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_TYPE_ATTRIBUTE);
//鍒ゆ柇浼犲弬鏄惁姝g‘
if (StringUtils.isEmpty(fse.getString(CmnConst.TYPE_UUID))) {
return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
@@ -327,20 +237,7 @@
public String getEChartsElement(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_TYPE_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_TYPE_CONFIG);
JSONObject object = reportTypeService.getEChartsElement(fse.getUUID());
return BaseUtil.success(object);
} catch (BaseException e) {
@@ -364,20 +261,7 @@
public String addEChartsMasterTable(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_TYPE_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_TYPE_CONFIG);
IReportTypeService service=(IReportTypeService)getProxyInstance(reportTypeService);
String uuid =service.saveEChartsMasterTable(fse);
return OK_Add(uuid);
@@ -404,20 +288,7 @@
public String saveEChartsElement(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_TYPE_ATTRIBUTE.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_TYPE_ATTRIBUTE);
IReportTypeService service=(IReportTypeService)getProxyInstance(reportTypeService);
String uuid =service.saveEChartsElement(fse);
return OK_Add(uuid);
@@ -442,20 +313,7 @@
public String delEChartsElement(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_TYPE_ATTRIBUTE.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_TYPE_ATTRIBUTE);
IReportTypeService service=(IReportTypeService)getProxyInstance(reportTypeService);
if(service.delEChartsElement(fse)){
return OK();
@@ -482,20 +340,7 @@
public String delEChartsTable(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_TYPE_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_TYPE_CONFIG);
IReportTypeService service=(IReportTypeService)getProxyInstance(reportTypeService);
if(service.delEChartsTable(fse)){
return OK();
@@ -523,20 +368,7 @@
public String referenceProperties(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_TYPE_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_TYPE_CONFIG);
IReportTypeService service=(IReportTypeService)getProxyInstance(reportTypeService);
JSONObject object =service.referenceProperties(fse);
return BaseUtil.success(object);
diff --git a/src/main/java/com/product/server/report/service/ChartPropertyConfigService.java b/src/main/java/com/product/server/report/service/ChartPropertyConfigService.java
index e5ac258..930b463 100644
--- a/src/main/java/com/product/server/report/service/ChartPropertyConfigService.java
+++ b/src/main/java/com/product/server/report/service/ChartPropertyConfigService.java
@@ -47,8 +47,6 @@
for (int j = 0; j < attributeData.getRows(); j++) {
FieldSetEntity attributeField = attributeData.getFieldSetEntity(j);
attributeField.setValue("report_config_uuid", chartsUuid);
- attributeField.setValue("`grouping`", attributeField.getString("grouping"));
- attributeField.remove("grouping");
String report_type_attr_value = attributeField.getString("report_type_attr_value");
if(!BaseUtil.strIsNull(report_type_attr_value) && report_type_attr_value.contains("{#") && report_type_attr_value.contains("#}")){
String field_name = report_type_attr_value.replace("{#", "").replace("#}", "");
@@ -116,8 +114,6 @@
for (int j = 0; j < attributeDataTable.getRows(); j++) {
FieldSetEntity fieldSetEntity = attributeDataTable.getFieldSetEntity(j);
fieldSetEntity.setValue("report_config_uuid", subChartsUuid);
- fieldSetEntity.setValue("`grouping`", fieldSetEntity.getString("grouping"));
- fieldSetEntity.remove("grouping");
String report_type_attr_value = fieldSetEntity.getString("report_type_attr_value");
if(!BaseUtil.strIsNull(report_type_attr_value) && report_type_attr_value.contains("{#") && report_type_attr_value.contains("#}")){
String field_name = report_type_attr_value.replace("{#", "").replace("#}", "");
@@ -232,9 +228,9 @@
if(children != null && children.size() > 0) {
for (int i = 0; i < children.size(); i++) {
JSONObject object = children.getJSONObject(i);
- String grouping = object.getString("grouping");
+ String groupSign = object.getString(CmnConst.GROUP_SIGN);
JSONArray subChildren = object.getJSONArray("children");
- if ("1".equals(grouping) && "1".equals(jsonObject.getString("subordinateElementType"))) {
+ if ("1".equals(groupSign) && "1".equals(jsonObject.getString(CmnConst.SUBORDINATE_ELEMENT_TYPE))) {
JSONObject group = new JSONObject();
group.put("children", JSONArray.parseArray(children.toJSONString()));
group.put("label", "缁勫悕");
@@ -244,10 +240,10 @@
jsonObject.put("children", newArray);
String reportConfigUuid = object.getString("report_config_uuid");
String reportTypeAttr = object.getString("report_type_attr");
- DataTableEntity dataTableEntity = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE, " report_type_attr = ? AND report_config_uuid = ? and `grouping` != 1 ", new String[]{reportTypeAttr, reportConfigUuid});
+ DataTableEntity dataTableEntity = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE, " report_type_attr = ? AND report_config_uuid = ? and group_sign != 1 ", new String[]{reportTypeAttr, reportConfigUuid});
for (int j = 0; j < dataTableEntity.getRows(); j++) {
JSONObject groupNew = JSONObject.parseObject(group.toJSONString());
- String key = dataTableEntity.getString(j, "grouping");
+ String key = dataTableEntity.getString(j, CmnConst.GROUP_SIGN);
groupNew.put("label", "缁勫悕");
groupNew.put("value", key);
newArray.add(this.addGroupAttributes(groupNew, key));
@@ -273,7 +269,7 @@
String reportConfigUuid = group.getString("report_config_uuid");
String reportTypeAttr = group.getString("report_type_attr");
if(!BaseUtil.strIsNull(reportConfigUuid) && !BaseUtil.strIsNull(reportTypeAttr)){
- FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE, " report_type_attr = ? AND report_config_uuid = ? AND grouping = ? ", new String[]{reportTypeAttr, reportConfigUuid, key}, false);
+ FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE, " report_type_attr = ? AND report_config_uuid = ? AND group_sign = ? ", new String[]{reportTypeAttr, reportConfigUuid, key}, false);
if(fieldSetEntity != null) {
group.put("config_attribute_uuid", fieldSetEntity.getString("uuid"));
//鍒楄〃鍏�.PRODUCT_SYS_report_config,鍥捐〃鍏�.PRODUCT_SYS_report_config_charts琛║UID
@@ -285,7 +281,7 @@
//灞炴�у��
group.put("report_type_attr_value", fieldSetEntity.getString("report_type_attr_value"));
//鍒嗙粍鏍囪瘑锛屽姞杞藉鏉℃暟鎹渶瑕佸姞鏍囪瘑
- group.put("grouping", key);
+ group.put("group_sign", key);
}
}
return group;
@@ -298,20 +294,20 @@
*/
public DataTableEntity getEChartsElementList(String uuid)throws BaseException{
StringBuffer sql = new StringBuffer();
- sql.append(" SELECT a.uuid auuid,a.detail adetail,a.attribute_name aname,a.subordinateElementType asubordinateElementType,a.is_commonly ais_commonly,a.prompt_name,a.default_value, ")
- .append(" b.uuid buuid,b.detail bdetail,b.attribute_name bname,b.subordinateElementType bsubordinateElementType,b.is_commonly bis_commonly, ")
- .append(" c.uuid cuuid,c.detail cdetail,c.attribute_name cname,c.subordinateElementType csubordinateElementType,c.is_commonly cis_commonly, ")
- .append(" d.uuid duuid,d.detail ddetail,d.attribute_name dname,d.subordinateElementType dsubordinateElementType,d.is_commonly dis_commonly, ")
- .append(" e.uuid euuid,e.detail edetail,e.attribute_name ename,e.subordinateElementType esubordinateElementType,e.is_commonly eis_commonly, ")
- .append(" f.uuid fuuid,f.detail fdetail,f.attribute_name fname,f.subordinateElementType fsubordinateElementType FROM ")
- .append("product_sys_report_type_attribute a LEFT JOIN ")
- .append("product_sys_report_type_attribute b on a.parentAttributeUuid = b.uuid LEFT JOIN ")
- .append("product_sys_report_type_attribute c on b.parentAttributeUuid = c.uuid LEFT JOIN ")
- .append("product_sys_report_type_attribute d on c.parentAttributeUuid = d.uuid LEFT JOIN ")
- .append("product_sys_report_type_attribute e on d.parentAttributeUuid = e.uuid LEFT JOIN ")
- .append("product_sys_report_type_attribute f on e.parentAttributeUuid = f.uuid ")
- .append(" WHERE a.config_properties = 1 ")
- .append(" AND a.type_uuid = ? ");
+ sql.append("\nSELECT a.uuid auuid,a.detail adetail,a.attribute_name aname,a.subordinate_element_type asubordinate_element_type,a.is_commonly ais_commonly,a.prompt_name,a.default_value, ");
+ sql.append("\n b.uuid buuid,b.detail bdetail,b.attribute_name bname,b.subordinate_element_type bsubordinate_element_type,b.is_commonly bis_commonly, ");
+ sql.append("\n c.uuid cuuid,c.detail cdetail,c.attribute_name cname,c.subordinate_element_type csubordinate_element_type,c.is_commonly cis_commonly, ");
+ sql.append("\n d.uuid duuid,d.detail ddetail,d.attribute_name dname,d.subordinate_element_type dsubordinate_element_type,d.is_commonly dis_commonly, ");
+ sql.append("\n e.uuid euuid,e.detail edetail,e.attribute_name ename,e.subordinate_element_type esubordinate_element_type,e.is_commonly eis_commonly, ");
+ sql.append("\n f.uuid fuuid,f.detail fdetail,f.attribute_name fname,f.subordinate_element_type fsubordinate_element_type,f.is_commonly fis_commonly, ");
+ sql.append("\nFROM product_sys_report_type_attribute a ");
+ sql.append("\nLEFT JOIN product_sys_report_type_attribute b on a.parent_attribute_uuid = b.uuid ");
+ sql.append("\nLEFT JOIN product_sys_report_type_attribute c on b.parent_attribute_uuid = c.uuid ");
+ sql.append("\nLEFT JOIN product_sys_report_type_attribute d on c.parent_attribute_uuid = d.uuid ");
+ sql.append("\nLEFT JOIN product_sys_report_type_attribute e on d.parent_attribute_uuid = e.uuid ");
+ sql.append("\nLEFT JOIN product_sys_report_type_attribute f on e.parent_attribute_uuid = f.uuid ");
+ sql.append("\nWHERE a.config_properties = 1 ");
+ sql.append("\nAND a.type_uuid = ? ");
return baseDao.listTable(sql.toString(), new String[]{uuid});
}
@@ -362,14 +358,14 @@
//鍏冪礌uuid
String uuid = fieldSetEntity.getString(parameter[paramIndex]+"uuid");
//鍏冪礌瀛愬厓绱犵被鍨�
- String subType = fieldSetEntity.getString(parameter[paramIndex]+"subordinateElementType");
+ String subType = fieldSetEntity.getString(parameter[paramIndex]+"subordinate_element_type");
// 鏄惁甯哥敤
String isCommonly = fieldSetEntity.getString(parameter[paramIndex]+"is_commonly");
JSONObject jsonObject = new JSONObject();
jsonObject.put("value",name);
jsonObject.put("label",detail);
jsonObject.put("uuid",uuid);
- jsonObject.put("subordinateElementType",subType);
+ jsonObject.put("subordinate_element_type",subType);
jsonObject.put("isCommonly", isCommonly);
jsonObject.put("config_properties",fieldSetEntity.getString("config_properties"));
paramIndex++;
@@ -388,8 +384,8 @@
if(dataTableEntity.getRows() > 1) {
for (int i = 0; i < dataTableEntity.getRows(); i++) {
FieldSetEntity fse = dataTableEntity.getFieldSetEntity(i);
- String grouping = fse.getString("grouping");
- if("1".equals(grouping)) {
+ String groupSign = fse.getString(CmnConst.GROUP_SIGN);
+ if("1".equals(groupSign)) {
jsonObject.put("config_attribute_uuid", fse.getString("uuid"));
//鍒楄〃鍏�.PRODUCT_SYS_report_config,鍥捐〃鍏�.PRODUCT_SYS_report_config_charts琛║UID
jsonObject.put("report_config_uuid", fse.getString("report_config_uuid"));
@@ -400,7 +396,7 @@
//灞炴�у��
jsonObject.put("report_type_attr_value", fse.getString("report_type_attr_value"));
//鍒嗙粍鏍囪瘑锛屽姞杞藉鏉℃暟鎹渶瑕佸姞鏍囪瘑
- jsonObject.put("grouping",grouping);
+ jsonObject.put("group_sign",groupSign);
}
}
}else if(dataTableEntity.getRows() == 1){
@@ -426,8 +422,8 @@
for (int i = 0; i < childrenArray.size(); i++) {
JSONObject o = childrenArray.getJSONObject(i);
JSONArray children = o.getJSONArray("children");
- if(!BaseUtil.strIsNull(o.getString("grouping"))){
- o.getInteger("grouping");
+ if(!BaseUtil.strIsNull(o.getString("group_sign"))){
+ o.getInteger("group_sign");
}else if(children != null && children.size() > 0){
this.addLayerOf(children);
}
diff --git a/src/main/java/com/product/server/report/service/GenerateEChartService.java b/src/main/java/com/product/server/report/service/GenerateEChartService.java
index c78d530..a462e17 100644
--- a/src/main/java/com/product/server/report/service/GenerateEChartService.java
+++ b/src/main/java/com/product/server/report/service/GenerateEChartService.java
@@ -21,9 +21,12 @@
import com.product.server.report.service.idel.IGenerateEChartService;
import com.product.util.BaseUtil;
import com.product.util.SystemParamReplace;
+
+import org.apache.bcel.generic.NEW;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.Arrays;
import java.util.List;
/**
@@ -49,6 +52,7 @@
public DataListReportService dataListReportService;
@Autowired
QueryFilterService queryFilterService;
+
@Override
public JSONArray generatePieEChartMaster(FieldSetEntity fse) throws BaseException {
String uuid = fse.getString(CmnConst.UUID);
@@ -77,101 +81,111 @@
@Override
public JSONObject generatePieEChart(FieldSetEntity fse) throws BaseException {
- //鏁版嵁婧恥uid
+ // 鑾峰彇鏁版嵁婧怳UID 鍜� 鎶ヨ〃绫诲瀷UUID
String report_datasource_uuid = fse.getString(CmnConst.REPORT_DATASOURCE_UUID);
- //绫诲瀷uuid
String report_type_config_uuid = fse.getString(CmnConst.REPORT_TYPE_CONFIG_UUID);
if(BaseUtil.strIsNull(report_datasource_uuid) || BaseUtil.strIsNull(report_type_config_uuid)){
return BaseUtil.fieldSetEntityToJson(fse);
}
- //鏌ヨ绫诲瀷琛�
- FieldSetEntity typeField = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_TYPE_CONFIG, report_type_config_uuid,false);
-
- //鑾峰彇閰嶇疆鎶ヨ〃鏁版嵁婧恉ata鏁版嵁琛� .PRODUCT_SYS_report_datasource_config瀛愯〃
- FieldSetEntity datasourceField = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG,report_datasource_uuid,true);
+ // 鑾峰彇鎶ヨ〃绫诲瀷
+ FieldSetEntity fseReportType = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_TYPE_CONFIG, report_type_config_uuid, false);
+ // 鑾峰彇鎶ヨ〃鏁版嵁婧愰厤缃〃鍜屽瓧娈佃〃
+ FieldSetEntity datasourceField = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_DATASOURCE_CONFIG, report_datasource_uuid, true);
//鑾峰彇鏌ヨ鐨勬暟鎹畇ql
String sql_text = datasourceField.getString(CmnConst.SQL_TEXT);
//瑙f瀽SQL閲岄潰鐨勭郴缁熷弬鏁�
sql_text = SystemParamReplace.systemParamsReplace(sql_text);
- String type_group = typeField.getString(CmnConst.TYPE_GROUP);
+ String typeGroup = fseReportType.getString(CmnConst.TYPE_GROUP);
//涓哄叧绯诲浘
- if("relationCharts".equals(type_group)){
+ if("relationCharts".equals(typeGroup)){
JSONObject obj = this.chooseRelationship(sql_text);
- String typeGroup = typeField.getString(CmnConst.TYPE_GROUP);
JSONObject object = new JSONObject();
- object.put(CmnConst.TYPE_GROUP,typeGroup);
+ object.put(CmnConst.TYPE_GROUP, typeGroup);
object.put(CmnConst.OPTION,obj);
// object.put("function",this.functionArray(uuid));
return object;
}
+ // 鑾峰彇鎶ヨ〃鏁版嵁婧愭暟鎹�
DataTableEntity valueData = baseDao.listTable(sql_text,new Object[]{});
//鑾峰彇鎶ヨ〃閰嶇疆灞炴�ц〃 鍔爀charts閰嶇疆灞炴��
- //鍙兘鏌ヨ鍒板叧鑱斿睘鎬у�肩殑灞炴�ц〃锛屽鏋滅埗绾у睘鎬т笅鏈夊涓浉鍚屽瓙灞炴�с�傞�氳繃grouping鍒嗙粍銆�
- DataTableEntity attributeData = baseDao.listTable("SELECT a.field_name,a.report_type_attr_value,a.uuid,a.grouping ,b.* FROM product_sys_report_config_attribute a LEFT JOIN product_sys_report_type_attribute b on a.report_type_attr = b.uuid WHERE a.report_config_uuid = ? ORDER BY a.grouping,b.parentAttributeUuid " ,new Object[]{fse.getString(CmnConst.UUID)});
+ //鍙兘鏌ヨ鍒板叧鑱斿睘鎬у�肩殑灞炴�ц〃锛屽鏋滅埗绾у睘鎬т笅鏈夊涓浉鍚屽瓙灞炴�с�傞�氳繃group_sign鍒嗙粍銆�
+ StringBuilder sql = new StringBuilder();
+ sql.append("SELECT a.uuid,a.field_name,a.report_type_attr_value,a.group_sign ,b.* \n");
+ sql.append("FROM product_sys_report_config_attribute a \n");
+ sql.append("LEFT JOIN product_sys_report_type_attribute b on a.report_type_attr = b.uuid \n");
+ sql.append("WHERE a.report_config_uuid = ? \n");
+ sql.append("ORDER BY a.group_sign,b.parent_attribute_uuid");
+ DataTableEntity attributeData = baseDao.listTable(sql.toString() ,new Object[]{fse.getString(CmnConst.UUID)});
+ if ("13081b93-bd02-4319-a423-e3000cd9e9b4".equals(fse.getUUID())) {
+ System.out.println("");
+ }
+ // 鍒涘缓鍥捐〃灞炴�у鍣�
JSONObject allProperties = new JSONObject();
- if(attributeData.getRows() > 0){
+ if(!BaseUtil.dataTableIsEmpty(attributeData)){
JSONObject propertyObject = new JSONObject();
- String parenUuid1 = attributeData.getString(0,"parentAttributeUuid");
- String grouping1 = attributeData.getString(0,"grouping");
- for (int i = 0,length = attributeData.getRows(); i < length; i++) {
- FieldSetEntity fieldSet = attributeData.getFieldSetEntity(i);
- //涓婄骇uuid
- String parenUuid2 = fieldSet.getString("parentAttributeUuid");
- //涓婄骇name
- String parenName = fieldSet.getString("parentAttributeName");
- //鍥捐〃灞炴�у��
- String attr_value = fieldSet.getString("report_type_attr_value");
- //涓虹┖浼犻粯璁ゅ��
- if(BaseUtil.strIsNull(attr_value)){
- attr_value = fieldSet.getString("default_value");
+ String preParenAttrUuid = attributeData.getString(0, CmnConst.PARENT_ATTRIBUTE_UUID);
+ String preGroupSign = attributeData.getString(0, CmnConst.GROUP_SIGN);
+ for (int i = 0, length = attributeData.getRows(); i < length; i++) {
+ FieldSetEntity fseAttr = attributeData.getFieldSetEntity(i);
+ // 鍥捐〃灞炴�у拰閰嶇疆鍊�
+ String attrName = fseAttr.getString(CmnConst.ATTRIBUTE_NAME);
+ if("show".equals(attrName)) {
+ System.out.println();
}
- //鍥捐〃灞�
- String attribute_name = fieldSet.getString("attribute_name");
- //閫氳繃鏁版嵁搴撴彃鍏ユ暟鎹�
- String fieldName = fieldSet.getString(CmnConst.FIELD_NAME);
- //閫氳繃鏁版嵁搴撴彃鍏ユ暟鎹�
- String grouping2 = fieldSet.getString("grouping");
+ String attrValue = fseAttr.getString(CmnConst.REPORT_TYPE_ATTR_VALUE);
+ if(BaseUtil.strIsNull(attrValue)){
+ // 閰嶇疆鍊间负绌哄垯鐢ㄩ粯璁ゅ��
+ attrValue = fseAttr.getString("default_value");
+ }
+ // 褰撳墠灞炴�х殑涓婄骇灞炴�uid鍜宯ame
+ String curParenAttrUuid = fseAttr.getString(CmnConst.PARENT_ATTRIBUTE_UUID);
+ String curParenAttrName = fseAttr.getString(CmnConst.PARENT_ATTRIBUTE_NAME);
+
+ // 鑾峰彇褰撳墠灞炴�ч厤缃瓧娈� 鍜� 鍒嗙粍鍊�
+ String fieldName = fseAttr.getString(CmnConst.FIELD_NAME);
+ String curGroupSign = fseAttr.getString(CmnConst.GROUP_SIGN);
+
//鏅�氬睘鎬ч兘鏈変笂绾у睘鎬э紝 鐗规畩鐨勯鑹查鏍煎睘鎬ф棤涓婄骇灞炴�э紝鏈韩灏辨槸椤剁骇灞炴�с��
- if(!BaseUtil.strIsNull(parenUuid2)) {
+ if(!BaseUtil.strIsNull(curParenAttrUuid)) {
//涔嬪墠涓婄骇uuid涓虹┖
- if(BaseUtil.strIsNull(parenUuid1)) {
- parenUuid1 = parenUuid2;
+ if(BaseUtil.strIsNull(preParenAttrUuid)) {
+ preParenAttrUuid = curParenAttrUuid;
//鏈変笉鍚岀殑灞炴�э紝鍏堟妸涔嬪墠鍚屾牱鐨勫睘鎬у皝瑁呫��
- }else if (!BaseUtil.strIsNull(parenUuid1) && !parenUuid2.equals(parenUuid1)) {
+ }else if (!BaseUtil.strIsNull(preParenAttrUuid) && !curParenAttrUuid.equals(preParenAttrUuid)) {
//灏佽涔嬪墠鐨刯son鏁版嵁
- this.getAllProperties(parenUuid1, propertyObject, allProperties);
- parenUuid1 = parenUuid2;
- } else if ((parenUuid2.equals(parenUuid1) && !BaseUtil.strIsNull(grouping2))) {
- if (!grouping2.equals(grouping1)) {
- this.getAllProperties(parenUuid1, propertyObject, allProperties);
+ this.getAllJSONAttrs(preParenAttrUuid, propertyObject, allProperties);
+ preParenAttrUuid = curParenAttrUuid;
+ } else if ((curParenAttrUuid.equals(preParenAttrUuid) && !BaseUtil.strIsNull(curGroupSign))) {
+ if (!curGroupSign.equals(preGroupSign)) {
+ this.getAllJSONAttrs(preParenAttrUuid, propertyObject, allProperties);
}
}
}else{
//涓婄骇灞炴�т负option锛岃鏄庝粬涓烘渶澶у睘鎬ф病鏈変笂绾� 鐩存帴娣诲姞杩沘llProperties
- if("option".equals(parenName)){
- allProperties.put(attribute_name,changeDataFormat(attr_value)[0]);
+ if("option".equals(curParenAttrName)){
+ allProperties.put(attrName, changeDataFormat(attrValue)[0]);
continue;
}
}
- grouping1 = grouping2;
+ preGroupSign = curGroupSign;
//楗肩姸鍥炬彃鍏ユ暟鎹悓灞炰竴涓埗鍏冪礌 澶氫釜鍏冪礌鍜屽搴旂殑鏁版嵁闇�鍏ㄩ儴鎵惧嚭鏉ヤ竴璧峰皝瑁卝son
if(!BaseUtil.strIsNull(fieldName)){
- String parentAttributeName = fieldSet.getString("parentAttributeName");
+ String parentAttributeName = fseAttr.getString(CmnConst.PARENT_ATTRIBUTE_NAME);
//涓嬬骇涓哄璞¤繕鏄暟缁�
- String type = fieldSet.getString("subordinateElementType");
+ String type = fseAttr.getString(CmnConst.SUBORDINATE_ELEMENT_TYPE);
List<String> keys = ListUtils.newArrayList();
List<String> keys2 = ListUtils.newArrayList();
keys.add(fieldName);
- keys2.add(attribute_name);
+ keys2.add(attrName);
//涓烘渶鍚庝竴浣�
while (i < length-1) {
FieldSetEntity fieldSet2 = attributeData.getFieldSetEntity(i+1);
- String parenUuid3 = fieldSet2.getString("parentAttributeUuid");
+ String parenUuid3 = fieldSet2.getString(CmnConst.PARENT_ATTRIBUTE_UUID);
String fieldName3 = fieldSet2.getString(CmnConst.FIELD_NAME);
- if(parenUuid2.equals(parenUuid3) && !BaseUtil.strIsNull(fieldName3)){
+ if(curParenAttrUuid.equals(parenUuid3) && !BaseUtil.strIsNull(fieldName3)){
keys.add(fieldName3);
- keys2.add(fieldSet2.getString("attribute_name"));
+ keys2.add(fieldSet2.getString(CmnConst.ATTRIBUTE_NAME));
}else {
break;
}
@@ -183,21 +197,21 @@
propertyObject.put(parentAttributeName, this.attributesAndValues(valueData, keys, keys2, type));
}
}else {
- propertyObject.put(attribute_name,changeDataFormat(attr_value)[0]);
+ propertyObject.put(attrName, changeDataFormat(attrValue)[0]);
}
if(i == (length - 1)){
//灏佽鏈�鍚庝竴缁勬暟鎹�
- this.getAllProperties(parenUuid1,propertyObject,allProperties);
+ this.getAllJSONAttrs(preParenAttrUuid, propertyObject, allProperties);
}
}
}
- JSONObject s=new JSONObject();
+
//鍥捐〃杈硅窛
+// JSONObject s=new JSONObject();
// s.put("bottom",30);
// s.put("left",30);
// s.put("right",0);
// allProperties.put("grid",s);
- String typeGroup = typeField.getString(CmnConst.TYPE_GROUP);
JSONObject object = BaseUtil.fieldSetEntityToJson(fse);
object.put(CmnConst.TYPE,typeGroup);
object.put(CmnConst.OPTION,allProperties);
@@ -207,38 +221,35 @@
/**
* 鑾峰彇涓婄骇鏁版嵁骞堕�掑綊鎷艰涓婄骇灞炴��
- * @param superiorUuid 涓婄骇uuid
- * @param obj
+ * @param superiorAttrUUID 涓婄骇灞炴�UID
+ * @param noSuperiorJsonAttr 鏈皝瑁呬笂绾х殑JSON灞炴��
+ * @param allProperties 鍥捐〃鎬籎SON灞炴��
* @return
* @throws BaseException
*/
@Override
- public void getAllProperties(String superiorUuid,JSONObject obj,JSONObject allProperties) throws BaseException {
- FieldSetEntity fieldSet = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE,superiorUuid,false);
- String attribute_name = fieldSet.getString("attribute_name");
+ public void getAllJSONAttrs(String superiorAttrUUID, JSONObject noSuperiorJsonAttr, JSONObject allProperties) throws BaseException {
+ // 鑾峰彇鏇撮珮绾х埗绾у睘鎬�
+ FieldSetEntity fseAttrInfo = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE, superiorAttrUUID, false);
+ String attribute_name = fseAttrInfo.getString(CmnConst.ATTRIBUTE_NAME);
JSONObject superiorObj = new JSONObject();
- JSONArray objSubArray = obj.getJSONArray(attribute_name);
- //纭畾浠栫殑瀛愬睘鎬ф椂(1)array 杩樻槸(0)object
-// if(objSubArray == null){
- if ("1".equals(fieldSet.getString("subordinateElementType"))) {
- JSONArray array = new JSONArray();
- array.add(obj);
- superiorObj.put(attribute_name, array);
- } else {
- superiorObj.put(attribute_name, obj);
- }
-// }else if(objSubArray != null){
-// superiorObj = obj;
-// }
- //涓婄骇灞炴�ame
- superiorUuid = fieldSet.getString("parentAttributeUuid");
- //涓婄骇鍚嶇О
- String parentAttributeName = fieldSet.getString("parentAttributeName");
+ // 鍒ゅ畾灞炴�у�兼槸Object鏁扮粍杩樻槸Object瀵硅薄锛堝嵆瀛愬睘鎬ф槸瀵硅薄杩樻槸鏁扮粍锛�0涓簅bj瀵硅薄锛�1涓篴rray鏁扮粍锛�
+ if ("1".equals(fseAttrInfo.getString(CmnConst.SUBORDINATE_ELEMENT_TYPE))) {
+ JSONArray array = new JSONArray();
+ array.add(noSuperiorJsonAttr);
+ superiorObj.put(attribute_name, array);
+// superiorObj.put(attribute_name, Arrays.asList(noSuperiorJsonAttr));
+ } else {
+ superiorObj.put(attribute_name, noSuperiorJsonAttr);
+ }
+ // 鑾峰彇褰撳墠灞炴�х埗绾у睘鎬UID 鍜� NAME
+ superiorAttrUUID = fseAttrInfo.getString(CmnConst.PARENT_ATTRIBUTE_UUID);
+ String parentAttributeName = fseAttrInfo.getString(CmnConst.PARENT_ATTRIBUTE_NAME);
//濡傛灉鐖跺厓绱爑uid涓虹┖
- if(BaseUtil.strIsNull(superiorUuid)){
+ if(BaseUtil.strIsNull(superiorAttrUUID)){
JSONArray allSubProperties = allProperties.getJSONArray(attribute_name);
if(allSubProperties != null){
- JSONObject subObj = JSONObject.parseObject(obj.toJSONString());
+ JSONObject subObj = JSONObject.parseObject(noSuperiorJsonAttr.toJSONString());
if(allSubProperties.size() > 0){
//鏄墿鍏呭綋鍓嶅瓙鍏冪礌 杩樻槸鍚岀骇鏂板涓�涓瓙鍏冪礌
Boolean is_extend = true;
@@ -258,23 +269,21 @@
for (String key :subObj.keySet()) {
subPropertiesJSONObject.put(key, subObj.get(key));
}
- obj.clear();
+ noSuperiorJsonAttr.clear();
return;
}
}
allSubProperties.add(subObj);
- obj.clear();
+ noSuperiorJsonAttr.clear();
return;
}
- //鍏嬮殕json
- JSONObject copy;
Object o = superiorObj.get(attribute_name);
if(o instanceof JSONArray){
JSONArray oar = (JSONArray) o;
JSONArray arr = JSONObject.parseArray(oar.toJSONString());
allProperties.put(attribute_name,arr);
}else {
- copy = JSONObject.parseObject(superiorObj.toJSONString());
+ JSONObject copy = JSONObject.parseObject(superiorObj.toJSONString());
allProperties.put(attribute_name,copy.getJSONObject(attribute_name));
}
}else {
@@ -295,7 +304,7 @@
}
}
}
- this.getAllProperties(superiorUuid,newObj,allProperties);
+ this.getAllJSONAttrs(superiorAttrUUID, newObj, allProperties);
}else {
JSONObject currentProperty = null;
if(o instanceof JSONArray) {
@@ -339,7 +348,7 @@
}
}
}
- obj.clear();
+ noSuperiorJsonAttr.clear();
}
/**
diff --git a/src/main/java/com/product/server/report/service/ReportTypeService.java b/src/main/java/com/product/server/report/service/ReportTypeService.java
index 26024ef..23855ea 100644
--- a/src/main/java/com/product/server/report/service/ReportTypeService.java
+++ b/src/main/java/com/product/server/report/service/ReportTypeService.java
@@ -220,18 +220,18 @@
public DataTableEntity getEChartsElementList(String uuid)throws BaseException{
StringBuffer sql = new StringBuffer();
sql.append("SELECT ");
- sql.append(" a.uuid auuid,a.detail adetail,a.attribute_name aname,a.subordinateElementType asubordinateElementType,a.is_commonly ais_commonly,a.prompt_name,a.default_value, ");
- sql.append(" b.uuid buuid,b.detail bdetail,b.attribute_name bname,b.subordinateElementType bsubordinateElementType,b.is_commonly bis_commonly, ");
- sql.append(" c.uuid cuuid,c.detail cdetail,c.attribute_name cname,c.subordinateElementType csubordinateElementType,c.is_commonly cis_commonly, ");
- sql.append(" d.uuid duuid,d.detail ddetail,d.attribute_name dname,d.subordinateElementType dsubordinateElementType,d.is_commonly dis_commonly, ");
- sql.append(" e.uuid euuid,e.detail edetail,e.attribute_name ename,e.subordinateElementType esubordinateElementType,e.is_commonly eis_commonly, ");
- sql.append(" f.uuid fuuid,f.detail fdetail,f.attribute_name fname,f.subordinateElementType fsubordinateElementType,f.is_commonly fis_commonly ");
+ sql.append(" a.uuid auuid,a.detail adetail,a.attribute_name aname,a.subordinate_element_type asubordinate_element_type,a.is_commonly ais_commonly,a.prompt_name,a.default_value, ");
+ sql.append(" b.uuid buuid,b.detail bdetail,b.attribute_name bname,b.subordinate_element_type bsubordinate_element_type,b.is_commonly bis_commonly, ");
+ sql.append(" c.uuid cuuid,c.detail cdetail,c.attribute_name cname,c.subordinate_element_type csubordinate_element_type,c.is_commonly cis_commonly, ");
+ sql.append(" d.uuid duuid,d.detail ddetail,d.attribute_name dname,d.subordinate_element_type dsubordinate_element_type,d.is_commonly dis_commonly, ");
+ sql.append(" e.uuid euuid,e.detail edetail,e.attribute_name ename,e.subordinate_element_type esubordinate_element_type,e.is_commonly eis_commonly, ");
+ sql.append(" f.uuid fuuid,f.detail fdetail,f.attribute_name fname,f.subordinate_element_type fsubordinate_element_type,f.is_commonly fis_commonly ");
sql.append("FROM product_sys_report_type_attribute a ");
- sql.append("LEFT JOIN product_sys_report_type_attribute b on a.parentAttributeUuid = b.uuid ");
- sql.append("LEFT JOIN product_sys_report_type_attribute c on b.parentAttributeUuid = c.uuid ");
- sql.append("LEFT JOIN product_sys_report_type_attribute d on c.parentAttributeUuid = d.uuid ");
- sql.append("LEFT JOIN product_sys_report_type_attribute e on d.parentAttributeUuid = e.uuid ");
- sql.append("LEFT JOIN product_sys_report_type_attribute f on e.parentAttributeUuid = f.uuid ");
+ sql.append("LEFT JOIN product_sys_report_type_attribute b on a.parent_attribute_uuid = b.uuid ");
+ sql.append("LEFT JOIN product_sys_report_type_attribute c on b.parent_attribute_uuid = c.uuid ");
+ sql.append("LEFT JOIN product_sys_report_type_attribute d on c.parent_attribute_uuid = d.uuid ");
+ sql.append("LEFT JOIN product_sys_report_type_attribute e on d.parent_attribute_uuid = e.uuid ");
+ sql.append("LEFT JOIN product_sys_report_type_attribute f on e.parent_attribute_uuid = f.uuid ");
sql.append("WHERE a.config_properties = 1 ");
sql.append("AND a.type_uuid = ? ");
sql.append("ORDER BY a.is_commonly DESC");
@@ -283,18 +283,18 @@
//鍏冪礌uuid
String uuid = fieldSetEntity.getString(parameter[paramIndex]+"uuid");
//鍏冪礌瀛愬厓绱犵被鍨�
- String subType = fieldSetEntity.getString(parameter[paramIndex]+"subordinateElementType");
+ String subType = fieldSetEntity.getString(parameter[paramIndex]+"subordinate_element_type");
//鍏冪礌鏄惁甯哥敤
String isCommonly = fieldSetEntity.getString(parameter[paramIndex] + "is_commonly");
JSONObject jsonObject = new JSONObject();
jsonObject.put("value",name);
jsonObject.put("label",detail);
jsonObject.put("uuid",uuid);
- jsonObject.put("subordinateElementType",subType);
+ jsonObject.put("subordinate_element_type",subType);
jsonObject.put("config_properties",fieldSetEntity.getString("config_properties"));
jsonObject.put("is_commonly", isCommonly);
jsonObject.put("is_commonly_label", "1".equals(isCommonly) ? "鏄�":"鍚�");
- jsonObject.put("subordinateElementType_label", "1".equals(subType) ? "鏁扮粍":"Object瀵硅薄");
+ jsonObject.put("subordinate_element_type_label", "1".equals(subType) ? "鏁扮粍":"Object瀵硅薄");
paramIndex++;
if(paramIndex < parameter.length) {
JSONArray childrenArray = new JSONArray();
@@ -356,10 +356,10 @@
fieldSetEntity.setValue(CmnConst.CREATED_BY,userId);
fieldSetEntity.setValue(CmnConst.CREATED_UTC_DATETIME,date);
fieldSetEntity.setValue(CmnConst.TYPE_UUID, type_uuid);
- fieldSetEntity.setValue("subordinateElementType", subFse.getString("subordinateElementType"));
+ fieldSetEntity.setValue("subordinate_element_type", subFse.getString("subordinate_element_type"));
if(!BaseUtil.strIsNull(parentAttributeName) && !BaseUtil.strIsNull(parentAttributeUuid)){
- fieldSetEntity.setValue("parentAttributeName", parentAttributeName);
- fieldSetEntity.setValue("parentAttributeUuid", parentAttributeUuid);
+ fieldSetEntity.setValue(CmnConst.PARENT_ATTRIBUTE_NAME, parentAttributeName);
+ fieldSetEntity.setValue(CmnConst.PARENT_ATTRIBUTE_UUID, parentAttributeUuid);
}
fieldSetEntity.setValue(CmnConst.TYPE_GROUP, type);
@@ -388,35 +388,35 @@
String attributeName = fse.getString(CmnConst.ATTRIBUTE_NAME);
//鏂板
if(BaseUtil.strIsNull(uuid)){
- String parentAttributeUuid = fse.getString("parentAttributeUuid");
+ String parentAttributeUuid = fse.getString(CmnConst.PARENT_ATTRIBUTE_UUID);
//濡傛灉涓婄骇灞炴�т笉涓虹┖
if(!BaseUtil.strIsNull(parentAttributeUuid)){
- DataTableEntity dataTableEntity = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE, " type_uuid = ? and parentAttributeUuid = ? and attribute_name = ?", new String[]{uuid, parentAttributeUuid, attributeName});
+ DataTableEntity dataTableEntity = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE, " type_uuid = ? and parent_attribute_uuid = ? and attribute_name = ?", new String[]{uuid, parentAttributeUuid, attributeName});
if(dataTableEntity.getRows() > 0){
throw new BaseException(ReportCode.SAVE_CHART_ATTRIBUTE_REPETITION_FAIL.getValue(),
ReportCode.SAVE_CHART_ATTRIBUTE_REPETITION_FAIL.getText(), this.getClass(), "public String saveEChartsElement(FieldSetEntity fse) throws BaseException");
}
FieldSetEntity parentElement = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE, parentAttributeUuid,false);
- if(BaseUtil.strIsNull(parentElement.getString("subordinateElementType"))){
- parentElement.setValue("subordinateElementType", 0);
+ if(BaseUtil.strIsNull(parentElement.getString(CmnConst.SUBORDINATE_ELEMENT_TYPE))){
+ parentElement.setValue(CmnConst.SUBORDINATE_ELEMENT_TYPE, 0);
}
- String parentUuid = parentElement.getString("parentAttributeUuid");
- String parentName = parentElement.getString("parentAttributeName");
+ String parentUuid = parentElement.getString(CmnConst.PARENT_ATTRIBUTE_UUID);
+ String parentName = parentElement.getString(CmnConst.PARENT_ATTRIBUTE_NAME);
if(BaseUtil.strIsNull(parentUuid) && !BaseUtil.strIsNull(parentName)){
- parentElement.setValue("parentAttributeName", null);
+ parentElement.setValue(CmnConst.PARENT_ATTRIBUTE_NAME, null);
}
parentElement.setValue("config_properties", 0);
baseDao.update(parentElement);
- fse.setValue("parentAttributeName", parentElement.getString("attribute_name"));
+ fse.setValue(CmnConst.PARENT_ATTRIBUTE_NAME, parentElement.getString(CmnConst.ATTRIBUTE_NAME));
}else {
DataTableEntity dataTableEntity = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE, "type_uuid = ? and attribute_name = ?", new String[]{typeUuid,attributeName});
if(dataTableEntity.getRows() > 0){
throw new BaseException(ReportCode.SAVE_CHART_ATTRIBUTE_REPETITION_FAIL.getValue(),
ReportCode.SAVE_CHART_ATTRIBUTE_REPETITION_FAIL.getText(), this.getClass(), "public String saveEChartsElement(FieldSetEntity fse) throws BaseException");
}
- fse.setValue("parentAttributeName", "option");
+ fse.setValue(CmnConst.PARENT_ATTRIBUTE_NAME, "option");
}
fse.setValue("config_properties", 1);
return baseDao.add(fse);
@@ -426,11 +426,11 @@
String attName = fieldSetEntity.getString("attribute_name");
String newAttName = fse.getString("attribute_name");
if(!attName.equals(newAttName)){
- DataTableEntity subElementData = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE, " parentAttributeUuid = ? ",
+ DataTableEntity subElementData = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE, " parent_attribute_uuid = ? ",
new String[]{uuid});
for (int i = 0; i < subElementData.getRows(); i++) {
FieldSetEntity subElementFse = subElementData.getFieldSetEntity(i);
- subElementFse.setValue("parentAttributeName", newAttName);
+ subElementFse.setValue(CmnConst.PARENT_ATTRIBUTE_NAME, newAttName);
baseDao.update(subElementFse);
}
}
@@ -450,14 +450,19 @@
public boolean delEChartsElement(FieldSetEntity fse) throws BaseException {
String uuid = fse.getString("uuid");
StringBuffer sql = new StringBuffer();
- sql.append(" SELECT * FROM product_sys_report_type_attribute WHERE parentAttributeUuid = ")
- .append(" (SELECT parentAttributeUuid FROM product_sys_report_type_attribute WHERE uuid = ?) ");
+ sql.append("\nSELECT * ");
+ sql.append("\nFROM product_sys_report_type_attribute ");
+ sql.append("\nWHERE parent_attribute_uuid = (");
+ sql.append("\n SELECT parent_attribute_uuid ");
+ sql.append("\n FROM product_sys_report_type_attribute ");
+ sql.append("\n WHERE uuid = ?");
+ sql.append("\n) ");
DataTableEntity dataTableEntity = baseDao.listTable(sql.toString(),new String[]{uuid});
//褰撳墠灞炴�х殑涓婄骇灞炴�� 鍙湁杩欎竴涓瓙灞炴��
if(dataTableEntity.getRows() == 1){
- String parentAttributeUuid = dataTableEntity.getString(0,"parentAttributeUuid");
+ String parentAttributeUuid = dataTableEntity.getString(0, CmnConst.PARENT_ATTRIBUTE_UUID);
FieldSetEntity parentField = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE, parentAttributeUuid,false);
- parentField.setValue("subordinateElementType", null);
+ parentField.setValue(CmnConst.SUBORDINATE_ELEMENT_TYPE, null);
parentField.setValue("config_properties", 1);
baseDao.update(parentField);
}
diff --git a/src/main/java/com/product/server/report/service/idel/IGenerateEChartService.java b/src/main/java/com/product/server/report/service/idel/IGenerateEChartService.java
index 4367a00..6b0d085 100644
--- a/src/main/java/com/product/server/report/service/idel/IGenerateEChartService.java
+++ b/src/main/java/com/product/server/report/service/idel/IGenerateEChartService.java
@@ -31,7 +31,7 @@
* @return
* @throws BaseException
*/
- void getAllProperties(String superiorUuid,JSONObject obj, JSONObject allProperties)throws BaseException;
+ void getAllJSONAttrs(String superiorUuid,JSONObject obj, JSONObject allProperties)throws BaseException;
/**
* 鑾峰彇涓婄骇鏁版嵁骞舵嫾瑁卝son
diff --git a/src/main/java/com/product/server/report/service/idel/IReportTypeService.java b/src/main/java/com/product/server/report/service/idel/IReportTypeService.java
index 9985a18..7cdd814 100644
--- a/src/main/java/com/product/server/report/service/idel/IReportTypeService.java
+++ b/src/main/java/com/product/server/report/service/idel/IReportTypeService.java
@@ -1,6 +1,5 @@
package com.product.server.report.service.idel;
-import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.product.core.entity.DataTableEntity;
import com.product.core.entity.FieldSetEntity;
diff --git a/src/test/java/com/product/server/report/ReportTypeTest.java b/src/test/java/com/product/server/report/ReportTypeTest.java
index cbd4d7d..505fd54 100644
--- a/src/test/java/com/product/server/report/ReportTypeTest.java
+++ b/src/test/java/com/product/server/report/ReportTypeTest.java
@@ -200,7 +200,7 @@
map.put("type_group", "Charts");
map.put("attribute_name", "title");
map.put("detail", "鏍囩");
- map.put("subordinateElementType", 0);
+ map.put("subordinate_element_type", 0);
testPost(map);
}
--
Gitblit v1.9.2