Package com.narirelays.ems.persistence.orm

Examples of com.narirelays.ems.persistence.orm.ReportTemplate


    {
      result.setFailed(TEMPLATE_NAME_IS_NULL);
      return result;
    }
    String id = MyUUIDGen.getUUID();
    ReportTemplate reportTemplate = new ReportTemplate();
    reportTemplate.setId(id);//id
    reportTemplate.setName(name);//name
    reportTemplate.setTimeStamp(new Timestamp(new Date().getTime()));//timestamp
    String code = getBlankSheetHtmlCode();
    reportTemplate.setCode(code);//code
    reportTemplate.setTemplateCat(category);//parent
    reportTemplate.setReportType("other");//默认报表为其它,可以通过接口修改
    setDefaultReportTempExp(category, reportTemplate);//设置报表模板默认的访问控制
    reportTemplateDAO.merge(reportTemplate);
    result.setSucceed(id);
    return result;
  }
View Full Code Here


    if(ID==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate reportTemplate = reportTemplateDAO.findById(ID);
    if(reportTemplate==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
View Full Code Here

    if(id==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(id);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
    String expression = template.getOperEdit();
    if(!evaluateUserWithExp(expression))//判断用户有无报表编辑的权限
    {
      result.setFailed(HAS_NO_EDIT_AUTHENTICATION);
      return result;
    }
    if(name==null||name.equalsIgnoreCase(""))
    {
      result.setFailed(REPORT_TEMPLATE_NAME_IS_NULL);
      return result;
    }
    template.setName(name);
    reportTemplateDAO.merge(template);
    result.setSucceed();
    return result;
  }
View Full Code Here

    if(id==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(id);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
    String expression = template.getOperDelete();
    if(!evaluateUserWithExp(expression))
    {
      result.setFailed(HAS_NO_DELETE_AUTHENTICATION);
      return result;
    }
    try{
      String sql = "delete from cell where template_id = ?";//删除cell中相关记录
      jdbcTemplate.update(sql,id);
      sql = "delete from cell_value where template_id = ?";//删除cell_value中相关记录
      jdbcTemplate.update(sql, id);
      String reportType = template.getReportType();
      if(reportType!=null)//day,month,year,other
      {
        //删除离线报表库中的相应内容
        if(reportType.equalsIgnoreCase("day")||reportType.equalsIgnoreCase("month")
            ||reportType.equalsIgnoreCase("year")||reportType.equalsIgnoreCase("other"))
View Full Code Here

    if(templateID==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(templateID);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
View Full Code Here

    if(templateID==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(templateID);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
View Full Code Here

    if(templateID==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(templateID);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
View Full Code Here

    OperResult result = new OperResult();
    if(templateID!=null)
    {
      //如果ID或模板为空,这里不作权限判断,相当与判断通过
      //由之后的getReportContent返回错误
      ReportTemplate template = reportTemplateDAO.findById(templateID);
      if(template!=null)
      {
        String expression = template.getOperQuery();
        if(!evaluateUserWithExp(expression))//判断用户有没有该报表的浏览权限
        {
          result.setFailed(HAS_NO_REPORT_QUERY_AUTHENTICATION);
          return result;
        }
View Full Code Here

    if(templateID==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(templateID);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
    Object timeObject = properties.get("time");//获取前台传的时间
    Date queryDatePar;
    String queryDateParString;
   
    if(timeObject==null||stringValue(timeObject).equalsIgnoreCase(""))//如果没有传时间
    {
      queryDatePar = new Date();//默认使用当前时间
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
      queryDateParString = sdf.format(queryDatePar);
    }
    else//传时间,则解析
    {
      try{
        queryDateParString = stringValue(timeObject);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        queryDatePar = sdf.parse(queryDateParString)
      }
      catch(ParseException e)
      {
        result.setFailed("Time Format Error!");
        return result;
      }
    }
   
    Object heightObject = properties.get("height");
    Object widthObject = properties.get("width");
    LazyDynaBean bean = new LazyDynaBean();//bean用来存储最终返回的html code
    bean.set("name", template.getName());
    bean.set("id", template.getId());
    bean.set("time", queryDateParString);//要将时间返回前台
    if(heightObject!=null)
      bean.set("height", stringValue(heightObject));
    if(widthObject!=null)
      bean.set("width", stringValue(widthObject));
   
    Object queryStyleObj = properties.get("action");
    String queryStyle = null;
    if(queryStyleObj==null)//如果前台不传刷新与否,默认不刷新
      queryStyle = "unrefresh";
    else queryStyle = stringValue(queryStyleObj);
    DayReport dayReport = null;
    MonthReport monthReport = null;
    YearReport yearReport = null;
    OtherReport otherReport = null;

    //不是以刷新方式查询,则优先查找报表库***_report中是否有
    //如有,则直接返回      
    String reportType = template.getReportType();
    if(reportType==null||reportType.equals(""))
    {
      reportType="other";//默认以other处理
    }
    if(reportType.equalsIgnoreCase("day"))//日报表
    {
      DayReportId reportID = new DayReportId(template.getId(),new Timestamp(queryDatePar.getTime()));
      dayReport = dayReportDAO.findById(reportID);
      if(dayReport!=null&&!queryStyle.equalsIgnoreCase("refresh"))//说明在报表库中找到了该报表,直接返回
      {
        //不是刷新模式,则直接返回离线库中的值
        bean.set("code", dayReport.getCode());
        result.setData(bean);
        result.setSucceed();
        return result;
      }
    }
    else if(reportType.equalsIgnoreCase("month"))//月报表
    {
      SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM");
      try {
        String mDateString = sdfm.format(queryDatePar);
        Date mDate = sdfm.parse(mDateString);//得到的日期是yyyy-MM-1
        MonthReportId reportID = new MonthReportId(template.getId(), new Timestamp(mDate.getTime()));
        monthReport = monthReportDAO.findById(reportID);
        if(monthReport!=null&&!queryStyle.equalsIgnoreCase("refresh"))
        {
          //不是刷新模式,则直接返回离线库中的值
          bean.set("code", monthReport.getCode());
          result.setData(bean);
          result.setSucceed();
          return result;
        }
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        result.setFailed("Time Format Error!");
        return result;
      }
    }
    else if(reportType.equalsIgnoreCase("year"))//年报表
    {
      SimpleDateFormat sdfy = new SimpleDateFormat("yyyy");//得到的日期是yyyy-1-1
      try {
        String yDateString = sdfy.format(queryDatePar);
        Date yDate = sdfy.parse(stringValue(yDateString));
        YearReportId reportID = new YearReportId(template.getId(), new Timestamp(yDate.getTime()));
        yearReport = yearReportDAO.findById(reportID);
        if(yearReport!=null&&!queryStyle.equalsIgnoreCase("refresh"))
        {
          //不是刷新模式,则直接返回离线库中的值
          bean.set("code", yearReport.getCode());
View Full Code Here

    if(templateID==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(templateID);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
View Full Code Here

TOP

Related Classes of com.narirelays.ems.persistence.orm.ReportTemplate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.