Package com.narirelays.ems.persistence.orm

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


      return result;
    }

    try{
      CellId cellID = new CellId(rowNum, colNum, templateID, sheetNum);
      Cell cell = new Cell(cellID, template);     
      BeanUtils.populate(cell, properties);
      if(queryType.equalsIgnoreCase("manual"))
      {
        //人工设置时,要创建一个id放入measureID,详见设计文档
        cell.setMeasureId(MyUUIDGen.getUUID());
      }
      cellDAO.merge(cell);
      result.setSucceed();
    }
    catch(Exception e)
View Full Code Here


      result.setFailed("Number Format Error!");
      return result;
    }
   
    CellId cellID = new CellId(rowNum, colNum, templateID, sheetNum);
    Cell cell = cellDAO.findById(cellID);
    if(cell==null)
    {
      result.setFailed(REPORT_CELL_NOT_EXIST);
      return result;
    }
    if(cell.getQueryType()!=null&&cell.getQueryType().equalsIgnoreCase("manual"))
    {
      //查询类型为手动设置,递归删除
      if(cell.getMeasureId()!=null)
      {
        String sql = "delete from cell_value where id = ?";
        jdbcTemplate.update(sql,cell.getMeasureId());
      }
    }
    cellDAO.delete(cell);
    result.setSucceed();
    return result;
View Full Code Here

      result.setFailed("Number Format Error!");
      return result;
    }
   
    CellId cellID = new CellId(rowNum, colNum, templateID, sheetNum);
    Cell cell = cellDAO.findById(cellID);
    if(cell==null)
    {
      result.setFailed(REPORT_CELL_NOT_EXIST);
      return result;
    }
    LazyDynaBean bean = new LazyDynaBean();
    bean = ObjectListConvert2DynaBeanList.convert(cell);
    if(cell.getQueryType().equalsIgnoreCase("single")||cell.getQueryType().equalsIgnoreCase("serial"))
    {
      //历史查询时,需要返回计量点path供前台显示
      String measureID = cell.getMeasureId();
      if(measureID!=null)
      {
        WinccMeasure measure = winccMeasureDAO.findById(measureID);
        if(measure!=null) bean.set("path", measure.getPath());
      }     
View Full Code Here

      HTMLTableManipulator htmlTable = new HTMLTableManipulator(template.getCode());
      Set<Cell> cells = template.getCells();
      Iterator<Cell> iter = cells.iterator();
      while(iter.hasNext())
      {
        Cell cell = iter.next();
        CellId cellID = cell.getId();
        String queryType = cell.getQueryType();
        int sheetNum = cellID.getSheetNum().intValue();
        int rowNum = cellID.getRowNum().intValue();
        int colNum = cellID.getColNum().intValue();
        if(queryType.equalsIgnoreCase("single")||queryType.equalsIgnoreCase("serial"))//商用库查询
        {         
          String measureID = cell.getMeasureId();
          String timeVar = cell.getTimeVar();
          String target = cell.getQueryTarget();
          LazyDynaBean bean = QueryTimeUtility.getHisQueryDate(timeVar, time);
          if(bean==null)
          {
            htmlTable.setCellValue(sheetNum, rowNum,colNum,"");//将单元格值设为空,原来是*/#
            continue;
          }
          Date startTime = (Date)bean.get("startTime");
//          Date endTime = (Date)bean.get("endTime");
//          int interval = (Integer)bean.get("interval");
          if(queryType.equalsIgnoreCase("single"))//单点
          {

            Double value = getSigleValueFromWinCC(measureID, startTime);
            if(value!=null)
            {
              htmlTable.setCellValue(sheetNum, rowNum,colNum,String.valueOf(value));
            }
            else
            {
              htmlTable.setCellValue(sheetNum, rowNum,colNum,"");//将单元格查询标记清除
            }
          }
//          else//序列,暂时不支持序列查询
//          {
//            String direction = cell.getDirection();//序列方向,水平/垂直
//            Long spacing = cell.getSpacing();//序列之间的间隔数
//            if(direction==null)direction = "vertical";
//            if(spacing==null)spacing = new Long(0);
//            List<Double> values = getSerialValueFromHis(measureID, startTime, endTime, interval);
//            if(values!=null&&values.size()>0)
//            {
//              int length = (int) (rowNum+values.size()*(1+spacing));//序列总长度
//              if(direction.equalsIgnoreCase("vertical"))//垂直方向,则修改行
//              {
//                if(htmlTable.getNumberOfRows(sheetNum)<rowNum+length)
//                {
//                  //表格模板不够长,插入count行,index是插入点
//                  int index = htmlTable.getNumberOfRows(sheetNum);//在最后一行插
//                  int count = rowNum + length- index;//计算插入的个数
//                  htmlTable.addRows(sheetNum, index, count);
//                }
//                for(Double value:values)
//                {
//                  htmlTable.setCellValue(sheetNum, rowNum, colNum, String.valueOf(value));
//                  rowNum += 1+spacing;//默认序列是往下发展
//                }
//              }
//              else//序列为水平方向
//              {
//                if(htmlTable.getNumberOfColumns(sheetNum)<colNum+length)
//                {
//                  //表格模板不够长,插入count行,index是插入点
//                  int index = htmlTable.getNumberOfColumns(sheetNum);//最后一列插
//                  int count = colNum + length - index;//计算插入的个数
//                  htmlTable.addColumns(sheetNum, index, count);
//                }
//                for(Double value:values)
//                {
//                  htmlTable.setCellValue(sheetNum, rowNum, colNum, String.valueOf(value));
//                  colNum += 1+spacing;//向右发展
//                }
//              }
//            }
//            else
//            {
//              htmlTable.setCellValue(sheetNum, rowNum, colNum, "");
//            }
//          }
        }
        else if(queryType.equalsIgnoreCase("time"))//单元格设定为时间变量
        {
          String timeVar = cell.getTimeVar();
          String timeValue = QueryTimeUtility.getTimeQueryDate(timeVar, time);
          if(timeValue==null)
          {
            timeValue = "";
          }
          htmlTable.setCellValue(sheetNum, rowNum,colNum,timeValue);
        }
        else if(queryType.equalsIgnoreCase("manual"))//人工设定的值,人工设定的值是存储在olapQuery中的
        {
          String manualContent = getCellManualValue(cell.getMeasureId(),template.getReportType(),time);
          if(manualContent==null)
          {
            manualContent = "";
          }
          htmlTable.setCellValue(sheetNum, rowNum,colNum,manualContent);
View Full Code Here

      result.setFailed("Number Format Error!");
      return result;
    }
   
    CellId cellID = new CellId(rowNum, colNum, templateID, sheetNum);
    Cell cell = cellDAO.findById(cellID);
    if(cell==null)
    {
      result.setFailed(REPORT_CELL_NOT_EXIST);
      return result;
    }
    String queryType = cell.getQueryType();
    if(queryType==null||!queryType.equalsIgnoreCase("manual"))
    {
      result.setFailed(QUERY_TYPE_NOT_CORRECT);
      return result;
    }
   
    if(cell.getMeasureId()==null)
    {
      cell.setMeasureId(MyUUIDGen.getUUID());
      cellDAO.merge(cell);
    }
   
    String reportType = template.getReportType();
    if(reportType==null)//如果报表类型为空,按照默认other处理
      reportType = "other";
    Date time = null;
    SimpleDateFormat sdf = null;
    if(reportType.equalsIgnoreCase("other"))//其它类型报表
    {
      Calendar cal = Calendar.getInstance();
      cal.clear();
      time = cal.getTime();
    }
    else//day,month,year
    {
      if(reportType.equalsIgnoreCase("day"))//日报
      {
        sdf = new SimpleDateFormat("yyyy-MM-dd");   
      }
      else if(reportType.equalsIgnoreCase("month"))//月报,时间id为yyyy-MM-1
      {
        sdf = new SimpleDateFormat("yyyy-MM");
      }
      else if(reportType.equalsIgnoreCase("year"))//年报,时间id为yyyy-1-1
      {
        sdf = new SimpleDateFormat("yyyy");       
      }
      try {
        time = sdf.parse(timeString);
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        result.setFailed("Time Format error!");
        return result;
      }
    }
    CellValueId cellValueID = new CellValueId(cell.getMeasureId(), new Timestamp(time.getTime()));
    CellValue cellValue = new CellValue(cellValueID);
    cellValue.setTemplateId(templateID);//设置报表模板id,以便于报表模板删除
    Object valueObj = properties.get("value");
    if(valueObj!=null)
    {
View Full Code Here

TOP

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

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.