| | |
| | | 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(); |