| | |
| | | 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"; |
| | |
| | | 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"; |
| | | |
| | | //常量字段定义 |
| | |
| | | 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 = "普通数据列表"; |
| | |
| | | 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(); |
| | |
| | | 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; |
| | | |
| | | |
| | | /** |
| | | * 报表数据源列表 |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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()); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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()); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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(); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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()); |
| | |
| | | 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()); |
| | |
| | | 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()); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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()); |
| | |
| | | |
| | | 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; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | |
| | | /** |
| | | * 报表类型-报表类型属性 |
| | | * |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/report-type") |
| | | public class ReportTypeController extends AbstractBaseController{ |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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) { |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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()); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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()); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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()); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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); |
| | | //判断传参是否正确 |
| | | if (StringUtils.isEmpty(fse.getString(CmnConst.TYPE_GROUP))) { |
| | | return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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); |
| | | //判断传参是否正确 |
| | | if (StringUtils.isEmpty(fse.getString(CmnConst.TYPE_UUID))) { |
| | | return this.error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText()); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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) { |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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(); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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(); |
| | |
| | | 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()); |
| | | } |
| | | //判断表名是否正常 |
| | | 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); |
| | |
| | | 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("#}", ""); |
| | |
| | | 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("#}", ""); |
| | |
| | | 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", "组名"); |
| | |
| | | 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)); |
| | |
| | | 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 |
| | |
| | | //属性值 |
| | | group.put("report_type_attr_value", fieldSetEntity.getString("report_type_attr_value")); |
| | | //分组标识,加载多条数据需要加标识 |
| | | group.put("grouping", key); |
| | | group.put("group_sign", key); |
| | | } |
| | | } |
| | | return group; |
| | |
| | | */ |
| | | 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}); |
| | | } |
| | |
| | | //元素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(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")); |
| | |
| | | //属性值 |
| | | 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){ |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | public DataListReportService dataListReportService; |
| | | @Autowired |
| | | QueryFilterService queryFilterService; |
| | | |
| | | @Override |
| | | public JSONArray generatePieEChartMaster(FieldSetEntity fse) throws BaseException { |
| | | String uuid = fse.getString(CmnConst.UUID); |
| | |
| | | @Override |
| | | public JSONObject generatePieEChart(FieldSetEntity fse) throws BaseException { |
| | | |
| | | //数据源uuid |
| | | // 获取数据源UUID 和 报表类型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); |
| | | |
| | | //获取配置报表数据源data数据表 .PRODUCT_SYS_report_datasource_config子表 |
| | | // 获取报表类型 |
| | | 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); |
| | | //获取查询的数据sql |
| | | String sql_text = datasourceField.getString(CmnConst.SQL_TEXT); |
| | | //解析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.OPTION,obj); |
| | | // object.put("function",this.functionArray(uuid)); |
| | | return object; |
| | | } |
| | | // 获取报表数据源数据 |
| | | 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)}); |
| | | JSONObject allProperties = new JSONObject(); |
| | | if(attributeData.getRows() > 0){ |
| | | 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"); |
| | | //只能查询到关联属性值的属性表,如果父级属性下有多个相同子属性。通过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(""); |
| | | } |
| | | //图表属 |
| | | String attribute_name = fieldSet.getString("attribute_name"); |
| | | //通过数据库插入数据 |
| | | String fieldName = fieldSet.getString(CmnConst.FIELD_NAME); |
| | | //通过数据库插入数据 |
| | | String grouping2 = fieldSet.getString("grouping"); |
| | | // 创建图表属性容器 |
| | | JSONObject allProperties = new JSONObject(); |
| | | if(!BaseUtil.dataTableIsEmpty(attributeData)){ |
| | | JSONObject propertyObject = new JSONObject(); |
| | | 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 attrValue = fseAttr.getString(CmnConst.REPORT_TYPE_ATTR_VALUE); |
| | | if(BaseUtil.strIsNull(attrValue)){ |
| | | // 配置值为空则用默认值 |
| | | attrValue = fseAttr.getString("default_value"); |
| | | } |
| | | // 当前属性的上级属性uuid和name |
| | | 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)) { |
| | | //封装之前的json数据 |
| | | 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,说明他为最大属性没有上级 直接添加进allProperties |
| | | 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; |
| | | //饼状图插入数据同属一个父元素 多个元素和对应的数据需全部找出来一起封装json |
| | | 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; |
| | | } |
| | |
| | | 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); |
| | |
| | | |
| | | /** |
| | | * 获取上级数据并递归拼装上级属性 |
| | | * @param superiorUuid 上级uuid |
| | | * @param obj |
| | | * @param superiorAttrUUID 上级属性UUID |
| | | * @param noSuperiorJsonAttr 未封装上级的JSON属性 |
| | | * @param allProperties 图表总JSON属性 |
| | | * @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"))) { |
| | | // 判定属性值是Object数组还是Object对象(即子属性是对象还是数组,0为obj对象,1为array数组) |
| | | if ("1".equals(fseAttrInfo.getString(CmnConst.SUBORDINATE_ELEMENT_TYPE))) { |
| | | JSONArray array = new JSONArray(); |
| | | array.add(obj); |
| | | array.add(noSuperiorJsonAttr); |
| | | superiorObj.put(attribute_name, array); |
| | | // superiorObj.put(attribute_name, Arrays.asList(noSuperiorJsonAttr)); |
| | | } else { |
| | | superiorObj.put(attribute_name, obj); |
| | | superiorObj.put(attribute_name, noSuperiorJsonAttr); |
| | | } |
| | | // }else if(objSubArray != null){ |
| | | // superiorObj = obj; |
| | | // } |
| | | //上级属性name |
| | | superiorUuid = fieldSet.getString("parentAttributeUuid"); |
| | | //上级名称 |
| | | String parentAttributeName = fieldSet.getString("parentAttributeName"); |
| | | // 获取当前属性父级属性UUID 和 NAME |
| | | superiorAttrUUID = fseAttrInfo.getString(CmnConst.PARENT_ATTRIBUTE_UUID); |
| | | String parentAttributeName = fseAttrInfo.getString(CmnConst.PARENT_ATTRIBUTE_NAME); |
| | | //如果父元素uuid为空 |
| | | 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; |
| | |
| | | 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 { |
| | |
| | | } |
| | | } |
| | | } |
| | | this.getAllProperties(superiorUuid,newObj,allProperties); |
| | | this.getAllJSONAttrs(superiorAttrUUID, newObj, allProperties); |
| | | }else { |
| | | JSONObject currentProperty = null; |
| | | if(o instanceof JSONArray) { |
| | |
| | | } |
| | | } |
| | | } |
| | | obj.clear(); |
| | | noSuperiorJsonAttr.clear(); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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"); |
| | |
| | | //元素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(); |
| | |
| | | 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); |
| | | |
| | |
| | | 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); |
| | |
| | | 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("\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); |
| | | } |
| | |
| | | * @return |
| | | * @throws BaseException |
| | | */ |
| | | void getAllProperties(String superiorUuid,JSONObject obj, JSONObject allProperties)throws BaseException; |
| | | void getAllJSONAttrs(String superiorUuid,JSONObject obj, JSONObject allProperties)throws BaseException; |
| | | |
| | | /** |
| | | * 获取上级数据并拼装json |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | |