杜洪波
6 天以前 e4bd5c35f7ced8854b1caa6defa342d35d337b5e
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表UUID
@@ -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.prompt_name,a.default_value, ")
                .append(" b.uuid buuid,b.detail bdetail,b.attribute_name bname,b.subordinateElementType bsubordinateElementType, ")
                .append(" c.uuid cuuid,c.detail cdetail,c.attribute_name cname,c.subordinateElementType csubordinateElementType, ")
                .append(" d.uuid duuid,d.detail ddetail,d.attribute_name dname,d.subordinateElementType dsubordinateElementType, ")
                .append(" e.uuid euuid,e.detail edetail,e.attribute_name ename,e.subordinateElementType esubordinateElementType, ")
                .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,12 +358,15 @@
        //元素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++;
        if(paramIndex < parameter.length) {
@@ -385,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表UUID
                                jsonObject.put("report_config_uuid", fse.getString("report_config_uuid"));
@@ -397,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){
@@ -423,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);
                }