| | |
| | | public static final String TYPE_NAME = "type_name"; |
| | | public static final String SYSTEM_SENIOR_QUERY_STRING = "systemSeniorQueryString"; |
| | | public static final String REPORT_DATASOURCE_NAME = "report_datasource_name"; |
| | | 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"; |
| | | |
| | | // 属性-label |
| | | public static final String ATTR_COLSPAN = "colspan"; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | 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.server.report.config.ReportCode; |
| | | import com.product.server.report.config.CmnConst; |
| | |
| | | import com.product.server.report.service.ReportConfigService; |
| | | import com.product.server.report.service.idel.IReportConfigService; |
| | | |
| | | /** |
| | | * 配置报表 |
| | | * |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/report-config") |
| | | public class ReportConfigController extends AbstractBaseController { |
| | |
| | | @ApiVersion(1) |
| | | public String getButton(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = null; |
| | | Object bean = request.getAttribute("requestPara"); |
| | | if (bean != null) { |
| | | RequestParameterEntity reqp = (RequestParameterEntity) bean; |
| | | fse = reqp.getFormData(); |
| | | } |
| | | if (bean == null || fse == null || fse.getString("uuid") == null) { |
| | | return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_SYS_REPORT_CONFIG); |
| | | if (StringUtils.isEmpty(fse.getUUID())) { |
| | | return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); |
| | | } |
| | | DataTableEntity dt = DataPoolCacheImpl.getInstance().getCacheData("所有按钮按功能分组", new String[]{fse.getUUID()}); |
| | | return OK_List(dt); |
| | |
| | | @ApiVersion(1) |
| | | public String listReportConfig(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | DataTableEntity dt = reportConfigService.listReportConfig(fse.getInteger("cpage"), fse.getInteger("pageSize"), fse); |
| | | return OK_List(dt); |
| | | } catch (BaseException e) { |
| | |
| | | @ApiVersion(1) |
| | | public String findReportConfig(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | //uuid是否为空 |
| | | if (StringUtils.isEmpty(fse.getUUID())) { |
| | | return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); |
| | |
| | | @ApiVersion(1) |
| | | public String addReportConfig(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | IReportConfigService service = (IReportConfigService) getProxyInstance(reportConfigService); |
| | | String uuid = service.addReportConfig(fse); |
| | | return OK_Add(uuid); |
| | |
| | | @ApiVersion(1) |
| | | public String updateReportConfig(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | //uuid是否为空 |
| | | if (StringUtils.isEmpty(fse.getUUID())) { |
| | | return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); |
| | |
| | | @ApiVersion(1) |
| | | public String deleteReportConfig(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | //uuid是否为空 |
| | | if (StringUtils.isEmpty(fse.getUUID())) { |
| | | return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); |
| | |
| | | @ApiVersion(1) |
| | | public String releaseConfig(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | //判断传参是否正常 |
| | | if (StringUtils.isEmpty(CmnConst.UUID) || StringUtils.isEmpty(CmnConst.TRICODE_PARENT) || StringUtils.isEmpty(CmnConst.ROLE_UUID)) { |
| | | return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); |
| | |
| | | @ApiVersion(1) |
| | | public String cancelReleaseConfig(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | //判断传参是否正常 |
| | | if (StringUtils.isEmpty(CmnConst.UUID) || StringUtils.isEmpty(CmnConst.TRICODE_PARENT) || StringUtils.isEmpty(CmnConst.ROLE_UUID)) { |
| | | return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); |
| | |
| | | @ApiVersion(1) |
| | | public String copyConfig(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | String uuid = reportConfigService.copyConfig(fse.getUUID()); |
| | | return OK_Add(uuid); |
| | | } catch (BaseException e) { |
| | |
| | | @ApiVersion(1) |
| | | public String quoteReportConfig(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | return OK_List(reportConfigService.quoteReportConfig(fse)); |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | |
| | | @ApiVersion(1) |
| | | public String getReportReleaseInfo(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | JSONArray jsonArray = reportConfigService.getReportReleaseInfo(); |
| | | return BaseUtil.success(jsonArray, null); |
| | | } catch (BaseException e) { |
| | |
| | | @ApiVersion(1) |
| | | public String viewReportReleaseInfo(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | JSONObject resultObj = reportConfigService.viewReportReleaseInfo(fse); |
| | | return BaseUtil.success(resultObj, null); |
| | | } catch (BaseException e) { |
| | |
| | | public String releasedListReportConfig(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()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_REPORT_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_CONFIG); |
| | | return OK_List(reportConfigService.releasedListReportConfig(fse)); |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | |
| | | JSONObject object = children.getJSONObject(i); |
| | | String grouping = object.getString("grouping"); |
| | | JSONArray subChildren = object.getJSONArray("children"); |
| | | if ("1".equals(grouping) && "1".equals(jsonObject.getString("subordinateElementType"))) { |
| | | if ("1".equals(grouping) && "1".equals(jsonObject.getString(CmnConst.SUBORDINATE_ELEMENT_TYPE))) { |
| | | JSONObject group = new JSONObject(); |
| | | group.put("children", JSONArray.parseArray(children.toJSONString())); |
| | | group.put("label", "组名"); |
| | |
| | | */ |
| | | 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 ") |
| | | sql.append(" SELECT a.uuid auuid,a.detail adetail,a.attribute_name aname,a.subordinate_element_type asubordinateElementType,a.prompt_name,a.default_value, ") |
| | | .append(" b.uuid buuid,b.detail bdetail,b.attribute_name bname,b.subordinate_element_type bsubordinateElementType, ") |
| | | .append(" c.uuid cuuid,c.detail cdetail,c.attribute_name cname,c.subordinate_element_type csubordinateElementType, ") |
| | | .append(" d.uuid duuid,d.detail ddetail,d.attribute_name dname,d.subordinate_element_type dsubordinateElementType, ") |
| | | .append(" e.uuid euuid,e.detail edetail,e.attribute_name ename,e.subordinate_element_type esubordinateElementType, ") |
| | | .append(" f.uuid fuuid,f.detail fdetail,f.attribute_name fname,f.subordinate_element_type 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("product_sys_report_type_attribute b on a.parent_attribute_uuid = b.uuid LEFT JOIN ") |
| | | .append("product_sys_report_type_attribute c on b.parent_attribute_uuid = c.uuid LEFT JOIN ") |
| | | .append("product_sys_report_type_attribute d on c.parent_attribute_uuid = d.uuid LEFT JOIN ") |
| | | .append("product_sys_report_type_attribute e on d.parent_attribute_uuid = e.uuid LEFT JOIN ") |
| | | .append("product_sys_report_type_attribute f on e.parent_attribute_uuid = f.uuid ") |
| | | .append(" WHERE a.config_properties = 1 ") |
| | | .append(" AND a.type_uuid = ? "); |
| | | |
| | |
| | | import com.product.common.lang.StringUtils; |
| | | import com.product.core.cache.DataPoolCacheImpl; |
| | | import com.product.core.cache.util.RedisUtil; |
| | | import com.product.core.connection.ConnectionManager; |
| | | import com.product.core.dao.BaseDao; |
| | | import com.product.core.entity.DataTableEntity; |
| | | import com.product.core.entity.FieldSetEntity; |
| | |
| | | import com.product.server.report.util.QuerySqlParseUtil; |
| | | import com.product.util.BaseUtil; |
| | | import com.product.util.SystemParamReplace; |
| | | import com.product.util.UnifySQLFunction; |
| | | |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | |
| | | } |
| | | } else { |
| | | sql = replaceSqlContent(sqlText, fse, sort, reportConfigFse, curPage); |
| | | |
| | | sql = UnifySQLFunction.timeFunctionReplace("single", sql); |
| | | if ("1".equalsIgnoreCase(reportConfigFse.getString(CmnConst.IS_PAGE))) { |
| | | Integer pageSize = reportConfigFse.getInteger(CmnConst.PAGE_SIZE); |
| | | recordDte = baseDao.listTable(sql, new Object[]{}, pageSize == null ? Integer.MAX_VALUE : pageSize, curPage); |
| | |
| | | DataTableEntity valueData = baseDao.listTable(sql_text,new Object[]{}); |
| | | //获取报表配置属性表 加echarts配置属性 |
| | | //只能查询到关联属性值的属性表,如果父级属性下有多个相同子属性。通过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)}); |
| | | 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.parent_attribute_uuid " ,new Object[]{fse.getString(CmnConst.UUID)}); |
| | | JSONObject allProperties = new JSONObject(); |
| | | if(attributeData.getRows() > 0){ |
| | | JSONObject propertyObject = new JSONObject(); |
| | | String parenUuid1 = attributeData.getString(0,"parentAttributeUuid"); |
| | | String parenUuid1 = attributeData.getString(0,"parent_attribute_uuid"); |
| | | 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"); |
| | | String parenUuid2 = fieldSet.getString("parent_attribute_uuid"); |
| | | //上级name |
| | | String parenName = fieldSet.getString("parentAttributeName"); |
| | | String parenName = fieldSet.getString("parent_attribute_name"); |
| | | //图表属性值 |
| | | String attr_value = fieldSet.getString("report_type_attr_value"); |
| | | //为空传默认值 |
| | |
| | | grouping1 = grouping2; |
| | | //饼状图插入数据同属一个父元素 多个元素和对应的数据需全部找出来一起封装json |
| | | if(!BaseUtil.strIsNull(fieldName)){ |
| | | String parentAttributeName = fieldSet.getString("parentAttributeName"); |
| | | String parentAttributeName = fieldSet.getString(CmnConst.PARENT_ATTRIBUTE_NAME); |
| | | //下级为对象还是数组 |
| | | String type = fieldSet.getString("subordinateElementType"); |
| | | String type = fieldSet.getString("subordinate_element_ype"); |
| | | List<String> keys = ListUtils.newArrayList(); |
| | | List<String> keys2 = ListUtils.newArrayList(); |
| | | keys.add(fieldName); |
| | |
| | | //为最后一位 |
| | | while (i < length-1) { |
| | | FieldSetEntity fieldSet2 = attributeData.getFieldSetEntity(i+1); |
| | | String parenUuid3 = fieldSet2.getString("parentAttributeUuid"); |
| | | String parenUuid3 = fieldSet2.getString("parent_attribute_uuid"); |
| | | String fieldName3 = fieldSet2.getString(CmnConst.FIELD_NAME); |
| | | if(parenUuid2.equals(parenUuid3) && !BaseUtil.strIsNull(fieldName3)){ |
| | | keys.add(fieldName3); |
| | |
| | | JSONArray objSubArray = obj.getJSONArray(attribute_name); |
| | | //确定他的子属性时(1)array 还是(0)object |
| | | // if(objSubArray == null){ |
| | | if ("1".equals(fieldSet.getString("subordinateElementType"))) { |
| | | if ("1".equals(fieldSet.getString(CmnConst.SUBORDINATE_ELEMENT_TYPE))) { |
| | | JSONArray array = new JSONArray(); |
| | | array.add(obj); |
| | | superiorObj.put(attribute_name, array); |
| | |
| | | // superiorObj = obj; |
| | | // } |
| | | //上级属性name |
| | | superiorUuid = fieldSet.getString("parentAttributeUuid"); |
| | | superiorUuid = fieldSet.getString(CmnConst.PARENT_ATTRIBUTE_UUID); |
| | | //上级名称 |
| | | String parentAttributeName = fieldSet.getString("parentAttributeName"); |
| | | String parentAttributeName = fieldSet.getString(CmnConst.PARENT_ATTRIBUTE_NAME); |
| | | //如果父元素uuid为空 |
| | | if(BaseUtil.strIsNull(superiorUuid)){ |
| | | JSONArray allSubProperties = allProperties.getJSONArray(attribute_name); |
| | |
| | | Integer pageSize = fieldSetEntity.getInteger(CmnConst.PAGE_SIZE); |
| | | StringBuffer sql = new StringBuffer(); |
| | | // sql.append(" select * from ( ") |
| | | sql.append(" select rc.uuid,rc.report_name,'图表' type_name,t1.role_info,mp.menu_name tricode_parent,m.menu_icon,m.menu_name,rc.function_uuid ") |
| | | sql.append(" select rc.uuid,rc.report_name,'图表' type_name,mp.menu_name tricode_parent,m.menu_icon,m.menu_name,rc.function_uuid ") |
| | | // sql.append(" select rc.uuid,rc.report_name,'图表' type_name,t1.role_info,mp.menu_name tricode_parent,m.menu_icon,m.menu_name,rc.function_uuid ") |
| | | .append(" FROM product_sys_report_config rc ") |
| | | .append(" inner join ( ") |
| | | .append(" select function_uuid,group_concat(role_info separator ',') role_info ") |
| | | .append(" select function_uuid ") |
| | | // .append(" select function_uuid,group_concat(role_info separator ',') role_info ") //Duird解析不了这个函数用法 |
| | | .append(" from ( ") |
| | | .append(" select function_uuid,concat(c.client_name,'/',o.org_level_name,'/',role_name) role_info ") |
| | | // .append(" select function_uuid,concat(c.client_name,'/',o.org_level_name,'/',role_name) role_info ") |
| | | .append(" select function_uuid ") |
| | | .append(" FROM product_sys_clients c ") |
| | | .append(" inner join product_sys_org_levels o on o.client_uuid=c.uuid ") |
| | | .append(" inner join ( ") |
| | |
| | | |
| | | List<Object> paramList = Lists.newArrayList(); |
| | | StringBuilder sql = new StringBuilder(512); |
| | | sql.append("\nSELECT a.uuid,a.type_uuid,a.is_valid,a.org_level_uuid,a.report_name,b.type_name,b.type_group") |
| | | .append("\nFROM product_sys_report_config a") |
| | | .append("\nLEFT JOIN product_sys_report_type_config b ON a.type_uuid = b.uuid") |
| | | .append("\nwhere (function_uuid is null or function_uuid='') "); |
| | | sql.append("\nSELECT a.uuid,a.type_uuid,a.is_valid,a.org_level_uuid,a.report_name,b.type_name,b.type_group"); |
| | | sql.append("\nFROM product_sys_report_config a"); |
| | | sql.append("\nLEFT JOIN product_sys_report_type_config b ON a.type_uuid = b.uuid"); |
| | | sql.append("\nWHERE (function_uuid is null or function_uuid='') "); |
| | | if (!StringUtils.isEmpty(fse.getString(CmnConst.TYPE_UUID))) { |
| | | sql.append("\nand b.type_group=?"); |
| | | paramList.add(fse.getString(CmnConst.TYPE_UUID)); |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | public JSONArray getReportReleaseInfo() { |
| | | StringBuilder sql = new StringBuilder(256); |
| | | public JSONArray getReportReleaseInfo() { |
| | | DataTableEntity aimDte = new DataTableEntity(); |
| | | DataTableEntity dte; |
| | | Object[] arr; |
| | | String filter; |
| | | sql.append("select distinct null pid,uuid sid,client_name name FROM product_sys_clients c") |
| | | .append("\ninner join (") |
| | | .append("\n select client_uuid pid,uuid sid,org_level_name FROM product_sys_org_levels where org_level_status=0 order by org_level_code") |
| | | .append("\n) o on o.pid=c.uuid") |
| | | .append("\ninner join (") |
| | | .append("\n select org_level_uuid pid,uuid sid,role_name FROM product_sys_role where is_used=1") |
| | | .append("\n) r on r.pid=o.sid"); |
| | | sql.append("\nSELECT distinct null pid,uuid sid,client_name name "); |
| | | sql.append("\nFROM product_sys_clients c"); |
| | | sql.append("\nINNER JOIN ("); |
| | | sql.append("\n SELECT client_uuid pid,uuid sid,org_level_name "); |
| | | sql.append("\n FROM product_sys_org_levels "); |
| | | sql.append("\n WHERE org_level_status=0 "); |
| | | sql.append("\n ORDER BY org_level_code"); |
| | | sql.append("\n) o ON o.pid=c.uuid"); |
| | | sql.append("\nINNER JOIN ("); |
| | | sql.append("\n SELECT org_level_uuid pid,uuid sid,role_name "); |
| | | sql.append("\n FROM product_sys_role "); |
| | | sql.append("\n WHERE is_used=1"); |
| | | sql.append("\n) r ON r.pid=o.sid"); |
| | | // 去掉admin所属客户 |
| | | // .append("\nwhere c.uuid!='4d4679ed-c4c3-41b8-abfe-451a66fd4043'"); |
| | | dte = baseDao.listTable(sql.toString(), new Object[]{}); |
| | |
| | | arr = dte.getFieldAllValues("sid"); |
| | | filter = BaseUtil.buildQuestionMarkFilter("client_uuid", arr.length, true); |
| | | sql.setLength(0); |
| | | sql.append("\nselect distinct o.* from (") |
| | | .append("\n select client_uuid pid,uuid sid,org_level_name name FROM product_sys_org_levels where org_level_status=0") |
| | | .append("\n and ").append(filter) |
| | | .append("\n order by org_level_code") |
| | | .append("\n) o") |
| | | .append("\ninner join (") |
| | | .append("\n select org_level_uuid pid,uuid sid,role_name FROM product_sys_role where is_used=1") |
| | | .append("\n) r on r.pid=o.sid"); |
| | | sql.append("\nSELECT distinct o.* "); |
| | | sql.append("\nFROM ("); |
| | | sql.append("\n SELECT client_uuid pid,uuid sid,org_level_name name "); |
| | | sql.append("\n FROM product_sys_org_levels "); |
| | | sql.append("\n WHERE org_level_status=0"); |
| | | sql.append("\n AND ").append(filter); |
| | | sql.append("\n ORDER BY org_level_code"); |
| | | sql.append("\n) o"); |
| | | sql.append("\nINNER JOIN ("); |
| | | sql.append("\n SELECT org_level_uuid pid,uuid sid,role_name "); |
| | | sql.append("\n FROM product_sys_role "); |
| | | sql.append("\n WHERE is_used=1"); |
| | | sql.append("\n) r ON r.pid=o.sid"); |
| | | dte = baseDao.listTable(sql.toString(), arr); |
| | | aimDte.addFieldSetEntity(dte); |
| | | |
| | |
| | | public DataTableEntity releasedListReportConfig(FieldSetEntity fse) { |
| | | String filter = queryFilterService.getQueryFilter(fse); |
| | | StringBuilder sql = new StringBuilder(256); |
| | | // sql.append("select * from ( "); |
| | | sql.append("\n select rc.uuid,rc.report_name,rtc.type_name,t1.role_info,mp.menu_name tricode_parent,m.menu_icon,m.menu_name "); |
| | | sql.append("\n FROM product_sys_report_config rc "); |
| | | sql.append("\n inner join ( "); |
| | | sql.append("\n select function_uuid,group_concat(role_info separator ',') role_info "); |
| | | sql.append("\n from ( "); |
| | | sql.append("\n select function_uuid,concat(c.client_name,'/',o.org_level_name,'/',role_name) role_info "); |
| | | sql.append("\n FROM product_sys_clients c "); |
| | | sql.append("\n inner join product_sys_org_levels o on o.client_uuid=c.uuid "); |
| | | sql.append("\n inner join ( "); |
| | | sql.append("\n select function_uuid,org_level_uuid,uuid role_uuid,role_name "); |
| | | sql.append("\n FROM product_sys_role r "); |
| | | sql.append("\n inner join ( "); |
| | | sql.append("\n select function_uuid,role_uuid FROM product_sys_function_permission "); |
| | | sql.append("\n ) p on r.uuid=p.role_uuid "); |
| | | sql.append("\n ) r1 on o.uuid=r1.org_level_uuid "); |
| | | sql.append("\n ) t "); |
| | | sql.append("\n group by function_uuid "); |
| | | sql.append("\n ) t1 on rc.function_uuid=t1.function_uuid "); |
| | | sql.append("\n inner join product_sys_menus m on rc.function_uuid=m.function_uuid "); |
| | | sql.append("\n inner join product_sys_report_type_config rtc on rc.type_uuid=rtc.uuid "); |
| | | sql.append("\n inner join product_sys_menus mp on m.tricode_parent=mp.tricode "); |
| | | sql.append("\nSELECT rc.uuid,rc.report_name,rtc.type_name,mp.menu_name tricode_parent,m.menu_icon,m.menu_name "); |
| | | // sql.append("\nselect rc.uuid,rc.report_name,rtc.type_name,t1.role_info,mp.menu_name tricode_parent,m.menu_icon,m.menu_name "); |
| | | sql.append("\nFROM product_sys_report_config rc "); |
| | | sql.append("\nINNER JOIN ( "); |
| | | // sql.append("\n select function_uuid,group_concat(role_info separator ',') role_info "); //语法解析失败 |
| | | sql.append("\n SELECT function_uuid "); |
| | | sql.append("\n FROM ( "); |
| | | // sql.append("\n select function_uuid,concat(c.client_name,'/',o.org_level_name,'/',role_name) role_info "); |
| | | sql.append("\n SELECT function_uuid "); |
| | | sql.append("\n FROM product_sys_clients c "); |
| | | sql.append("\n INNER JOIN product_sys_org_levels o ON o.client_uuid=c.uuid "); |
| | | sql.append("\n INNER JOIN ( "); |
| | | sql.append("\n SELECT function_uuid,org_level_uuid,uuid role_uuid,role_name "); |
| | | sql.append("\n FROM product_sys_role r "); |
| | | sql.append("\n INNER JOIN ( "); |
| | | sql.append("\n SELECT function_uuid,role_uuid FROM product_sys_function_permission "); |
| | | sql.append("\n ) p ON r.uuid=p.role_uuid "); |
| | | sql.append("\n ) r1 ON o.uuid=r1.org_level_uuid "); |
| | | sql.append("\n ) t "); |
| | | sql.append("\n GROUP BY function_uuid "); |
| | | sql.append("\n) t1 ON rc.function_uuid = t1.function_uuid "); |
| | | sql.append("\nINNER INNER product_sys_menus m on rc.function_uuid=m.function_uuid "); |
| | | sql.append("\nINNER INNER product_sys_report_type_config rtc on rc.type_uuid=rtc.uuid "); |
| | | sql.append("\nINNER INNER product_sys_menus mp on m.tricode_parent=mp.tricode "); |
| | | // sql.append("\n) t2 "); |
| | | if (!StringUtils.isEmpty(filter)) { |
| | | sql.append(" WHERE " + filter); |
| | |
| | | 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 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.subordinate_element_type bsubordinateElementType,b.is_commonly bis_commonly, "); |
| | | sql.append(" c.uuid cuuid,c.detail cdetail,c.attribute_name cname,c.subordinate_element_type csubordinateElementType,c.is_commonly cis_commonly, "); |
| | | sql.append(" d.uuid duuid,d.detail ddetail,d.attribute_name dname,d.subordinate_element_type dsubordinateElementType,d.is_commonly dis_commonly, "); |
| | | sql.append(" e.uuid euuid,e.detail edetail,e.attribute_name ename,e.subordinate_element_type esubordinateElementType,e.is_commonly eis_commonly, "); |
| | | sql.append(" f.uuid fuuid,f.detail fdetail,f.attribute_name fname,f.subordinate_element_type fsubordinateElementType,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"); |
| | |
| | | //元素uuid |
| | | String uuid = fieldSetEntity.getString(parameter[paramIndex]+"uuid"); |
| | | //元素子元素类型 |
| | | String subType = fieldSetEntity.getString(parameter[paramIndex]+"subordinateElementType"); |
| | | String subType = fieldSetEntity.getString(parameter[paramIndex] + CmnConst.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(CmnConst.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(); |
| | |
| | | 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(CmnConst.SUBORDINATE_ELEMENT_TYPE, subFse.getString(CmnConst.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); |
| | | |
| | |
| | | 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("parent_attribute_name", parentElement.getString("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); |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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(" SELECT * FROM product_sys_report_type_attribute WHERE parent_attribute_uuid = ") |
| | | .append(" (SELECT parent_attribute_uuid FROM product_sys_report_type_attribute WHERE uuid = ?) "); |
| | | 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); |
| | | } |