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 +++++++++++++++++++++++++++-------------------------------
1 files changed, 27 insertions(+), 31 deletions(-)
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);
}
--
Gitblit v1.9.2