Package com.sogou.qadev.service.cynthia.bean

Examples of com.sogou.qadev.service.cynthia.bean.Data


    if (allBugArr != null) {
      for (String bugIds : allBugArr) {
        if (bugTemplate == null) {
          String[] bugIdArr = bugIds.split(",");
          if (bugIdArr != null && bugIdArr.length > 0) {
            Data data = das.queryData(DataAccessFactory.getInstance().createUUID(bugIdArr[0]));
            if (data != null) {
              bugTemplate = das.queryTemplate(data.getTemplateId());
            }
          }
        }else {
          break;
        }
View Full Code Here


    }
   
    StringBuffer errorDataBuffer = new StringBuffer();
   
    for (Data tempData : allNeedMoveDataList) {
      Data data = das.queryData(tempData.getId(), templateId);
      if (data != null) {
        try {
          Map<String, Pair<Object, Object>> baseValueMap = new HashMap<String, Pair<Object,Object>>();
          Map<UUID, Pair<Object, Object>> extValueMap =  new HashMap<UUID, Pair<Object,Object>>();
         
          if(data.getAssignUsername() == null && newUserName != null || data.getAssignUsername() != null && newUserName == null
            || data.getAssignUsername() != null && newUserName != null && !data.getAssignUsername().equals(newUserName)){
            baseValueMap.put("assignUser", new Pair<Object, Object>(data.getAssignUsername(), newUserName));
          }
         
          data.setAssignUsername(newUserName);
         
          data.setObject("logCreateUser", key.getUsername());
         
          data.setObject("logActionId", null);
         
          if(actionComment != null && actionComment.length() > 0){
            data.setObject("logActionComment", actionComment);
          }else {
            data.setObject("logActionComment", "");
          }
         
          data.setObject("logBaseValueMap", baseValueMap);
          data.setObject("logExtValueMap", extValueMap);
         
          Pair<ErrorCode, String> result = das.modifyData(data);
         
          if(result.getFirst().equals(ErrorCode.success)){
            das.commitTranscation();
          }else{
            errorDataBuffer.append(errorDataBuffer.length() > 0 ?"," :"").append(XMLUtil.toSafeXMLString(data.getTitle()));
            das.rollbackTranscation();
          }
        } catch (Exception e) {
          errorDataBuffer.append(errorDataBuffer.length() > 0 ?"," :"").append(XMLUtil.toSafeXMLString(data.getTitle()));
          e.printStackTrace();
        }
      }
    }
    if (errorDataBuffer.length() > 0) {
View Full Code Here

      Set<UUID> statusIdSet = new HashSet<UUID>();
      for(String statusIdStr : statsIdArr){
        if(statusIdStr!=null&&!"".equals(statusIdStr))
          statusIdSet.add(DataAccessFactory.getInstance().createUUID(statusIdStr));
      }
      Data oldTask = das.queryData(DataAccessFactory.getInstance().createUUID(oldTaskId) ,DataAccessFactory.getInstance().createUUID(templateId));
      String oldTaskTitle = oldTask.getTitle();
      UUID[] oldVersionBugIds = oldTask.getMultiReference(DataAccessFactory.getInstance().createUUID(bugField));
      Set<Data> oldVesionBugsSet = new HashSet<Data>();
      for(UUID uuid : oldVersionBugIds){
        Data tempData = das.queryData(uuid ,DataAccessFactory.getInstance().createUUID(templateId));
        if(tempData!=null)
          oldVesionBugsSet.add(tempData);
      }
      boolean success = true;
      Data[] dataArray = oldVesionBugsSet.toArray(new Data[oldVesionBugsSet.size()]);
View Full Code Here

   */
  @ResponseBody
  @RequestMapping("/getTaskBugTemplate.do")
  public String getTaskBugTemplate(@RequestParam("oldTaskId") String oldTaskId ,@RequestParam("bugTaskField") String bugTaskFieldId ) throws Exception {
   
    Data oldTask = das.queryData(DataAccessFactory.getInstance().createUUID(oldTaskId));
    UUID [] bugs = oldTask.getMultiReference(DataAccessFactory.getInstance().createUUID(bugTaskFieldId));
    Map<String,Template> bugTemplateMap = new HashMap<String,Template>();
    Data bugData = null;
   
    Map<UUID, Template> allTemplateMap = new HashMap<UUID, Template>();
   
    if(bugs!=null&&bugs.length>0){
      for(UUID id : bugs){
       bugData = das.queryData(id)
       if(bugData!=null){
        if (allTemplateMap.get(bugData.getTemplateId()) == null) {
          allTemplateMap.put(bugData.getTemplateId(), das.queryTemplate(bugData.getTemplateId()));
        }
        Template template = allTemplateMap.get(bugData.getTemplateId());
        if(template!=null)
          bugTemplateMap.put(template.getId().toString(), template);
       }
      }
    }
View Full Code Here

            {
              boolean isSingleFail = false//单条信息录入错误

              Map<String, Pair<Object, Object>> baseValueMap = new LinkedHashMap<String, Pair<Object, Object>>();
              Map<UUID, Pair<Object, Object>> extValueMap = new LinkedHashMap<UUID, Pair<Object, Object>>();
              Data data = das.addData(templateId);

              String title = "";       //标题
              ErrorInfo errorInfo = null;

              if(data == null){
                return "";
              }

              for (Field field : allFields) {
                if (excelValueNum.keySet().contains(field.getName())) {
                  String fieldName = field.getName();
                  //excel中存在该字段,从excel中获取内容
                  String cellContentString = "";
                  java.util.Date cellContentDate = null;
                  if(row.getCell(excelValueNum.get(fieldName))!=null)
                  {
                    if(row.getCell(excelValueNum.get(fieldName)).getCellType()==XSSFCell.CELL_TYPE_NUMERIC//日期类型
                    {
                      cellContentDate = row.getCell(excelValueNum.get(fieldName)).getDateCellValue();
                      cellContentString = CynthiaUtil.getValue(row, excelValueNum.get(fieldName));
                    }else{
                      //其它类型
                      cellContentString = CynthiaUtil.getValue(row, excelValueNum.get(fieldName));
                    }

                  }else {
                    //判断该字段是否为必填
                    if (allNeedFields.contains(field.getName())) {
                      //必填为空,错误
                      isSingleFail = true;
                      errorInfo = new ErrorInfo() ;
                      errorInfo.setErrorDescription("必填字段为空");
                      errorInfo.setErrorRowNum(j);
                      errorInfo.setErrorColumnName(field.getName());
                      break;
                    }
                  }

                  if (field.getDataType()==DataType.dt_timestamp) { //处理日期类型
                    Date timeDate = null;
                    try {
                      timeDate = Date.valueOf(sdf.format(cellContentDate));
                     
                    } catch (Exception e) {
                    }
                    if (timeDate == null) {
                      try {
                        timeDate = Date.valueOf(cellContentString);
                      } catch (Exception e) {
                      }
                    }
                    if (timeDate == null && allNeedFields.contains(fieldName)) {
                      // 日期类型错误 返回错误
                      isSingleFail = true;
                      errorInfo = new ErrorInfo() ;
                      errorInfo.setErrorDescription("日期类型错误");
                      errorInfo.setErrorRowNum(j);
                      errorInfo.setErrorColumnName(field.getName());
                      break;
                    }else {
                      if (timeDate != null) {
                        data.setDate(field.getId(), timeDate);
                        extValueMap.put(field.getId(), new Pair<Object, Object>(null, timeDate));
                      }
                    }
                  }else if (field.getType()==Type.t_selection) {  //处理单选类型
                    Option option = field.getOption(cellContentString);
                    if (option == null) {
                      if (allNeedFields.contains(field)) {  //为空必填
                        //错误,单选选项错误
                        isSingleFail = true;
                        errorInfo = new ErrorInfo() ;
                        errorInfo.setErrorDescription("单选选项错误");
                        errorInfo.setErrorRowNum(j);
                        errorInfo.setErrorColumnName(field.getName());
                        break;
                      }
                    }else {
                      data.setSingleSelection(field.getId(), option.getId());
                      extValueMap.put(field.getId(), new Pair<Object, Object>(null,option.getId()));
                    }
                  }else //普通字段类型
                    data.setString(field.getId(), cellContentString);
                    extValueMap.put(field.getId(), new Pair<Object, Object>(null, cellContentString));
                  }
                }

              }//end foreach

              if (isSingleFail) {
                //记录错误 开始下一条数据录入
                failCount ++;
                errorInfoList.add(errorInfo);
                continue;
              }
             
              //问题概述
              if (excelValueNum.get("标题")!=null) {
                title = CynthiaUtil.getValue(row, excelValueNum.get("标题"));
              }
             
              //标题
              data.setTitle(title);
              baseValueMap.put("title", new Pair<Object, Object>(null,title));

              data.setObject("logCreateUser", addUser)//添加人
              //正文
              if (excelValueNum.get("正文")!=null) {
                String content = CynthiaUtil.getValue(row, excelValueNum.get("正文"));
                data.setDescription(content);
                baseValueMap.put("description", new Pair<Object, Object>(null, content));
              }
             
              //状态
              UUID statId = null;
              if (excelValueNum.get("状态")!=null) {
                String statIdStr = CynthiaUtil.getValue(row, excelValueNum.get("状态"));
                if (statIdStr != null && statIdStr.length() >0) {
                  Stat stat = flow.getStat(statIdStr);
                  if (stat == null) {
                    failCount ++;
                    errorInfo = new ErrorInfo() ;
                    errorInfo.setErrorDescription("状态不存在");
                    errorInfo.setErrorRowNum(j);
                    errorInfo.setErrorColumnName("状态");
                    errorInfoList.add(errorInfo);
                    continue;
                  }else {
                    statId = stat.getId();
                  }
                }
              }
             
              boolean isEndStat = isEndStat(flow, statId);
              //指派人
              if (excelValueNum.get("指派人")!=null && !isEndStat) {
                String assignUser = CynthiaUtil.getValue(row, excelValueNum.get("指派人"));

                if (userMap.get(assignUser) == null) {
                 
                  UserInfo relatedUsers = das.queryUserInfoByUserName(assignUser);

                  if (relatedUsers == null) {
                    failCount ++;
                    errorInfo = new ErrorInfo() ;
                    errorInfo.setErrorDescription("指派人不存在");
                    errorInfo.setErrorRowNum(j);
                    errorInfo.setErrorColumnName("指派人");
                    errorInfoList.add(errorInfo);
                    continue;
                  }else {
                    userMap.put(assignUser, relatedUsers.getNickName());
                  }
                }

                if (statId != null) {
                  if(!isEndStat){
                    data.setAssignUsername(assignUser);
                    baseValueMap.put("assignUser", new Pair<Object, Object>(null, assignUser));
                  }
                }
              }
             
              data.setObject("logActionId", null);
              data.setStatusId(statId);
              baseValueMap.put("statusId", new Pair<Object, Object>(null, statId));

              data.setObject("logBaseValueMap", baseValueMap);
              data.setObject("logExtValueMap", extValueMap);
             
              //验证控制字段是否正确
              String controlErrorString = checkDataControlValid(data, template);
              if(controlErrorString != null && !controlErrorString.equals("")){
                failCount ++;
                errorInfo = new ErrorInfo() ;
                errorInfo.setErrorDescription(controlErrorString);
                errorInfo.setErrorRowNum(j);
                errorInfoList.add(errorInfo);
                continue;
              }
             
              if (!isSingleFail) {
                Pair<ErrorCode, String> pair = das.modifyData(data);

                if (pair.getFirst().equals(ErrorCode.success)) {
                  das.commitTranscation();
                  das.updateCache(DataAccessAction.delete, data.getId().getValue(), data);
                }else {
                  isSingleFail = true;
                  errorInfo = new ErrorInfo();
                  errorInfo.setErrorDescription("数据库操作失败!");
                  errorInfo.setErrorRowNum(j);
View Full Code Here

   
    String currentIndentFieldValue = ""//当前分组字段值
   
    //内容
    for (int i = 0; i < allDatas.length; i++) {
      Data task = allDatas[i];
      if (task == null) {
        continue;
      }
      if (templateMap.get(task.getTemplateId()) == null) {
        Template template = das.queryTemplate(task.getTemplateId());
        if (template != null) {
          templateMap.put(task.getTemplateId(), template);
        }
      }
     
      Template template = templateMap.get(task.getTemplateId());
     
      if (flowMap.get(template.getFlowId()) == null) {
        Flow flow = das.queryFlow(template.getFlowId());
        if (flow != null) {
          flowMap.put(flow.getId(), flow);
        }
      }
     
      Flow flow = flowMap.get(template.getFlowId());
     
      List<String> allShowList = new ArrayList<String>();
      allShowList.addAll(Arrays.asList(displayNames));
      allShowList.add(indentFieldName);
      Map<String, String> displayMap = FilterQueryManager.getShowFieldValueMap(allShowList.toArray(new String[0]), task , template ,flow ,das ,ExportType.html , userAliasMap , isSysFilter);
     
      //有分组字段情况
      if (indentFieldName != null && indentFieldName.length() >0) { 
        if (i == 0) {
          currentIndentFieldValue = displayMap.get(indentFieldName);
          dataBuffer.append("<h5>").append(indentFieldName + " : " + currentIndentFieldValue).append("</h5>");
          dataBuffer.append("<table>");
           dataBuffer.append(tableHeader);
        }else {
          if (!currentIndentFieldValue.equals(displayMap.get(indentFieldName))) {
            currentIndentFieldValue = displayMap.get(indentFieldName);
            //下一个分组
            dataBuffer.append("</table>");
            dataBuffer.append("<h5>").append(indentFieldName + " : " + currentIndentFieldValue).append("</h5>");
            dataBuffer.append("<table>");
            dataBuffer.append(tableHeader);
          }
        }
      }
     
      dataBuffer.append("<tr>");
      dataBuffer.append("<td>").append(String.valueOf(i+1)).append("</td>");
      dataBuffer.append("<td>").append(task.getId().getValue()).append("</td>");
     
      for (int j = 0; j < displayNames.length; j++) {
        if (displayNames[j] != null && displayNames[j].equals("标题")) {
          dataBuffer.append("<td align=\"left\">").append("<a href=\"" + ConfigUtil.getCynthiaWebRoot() + "taskManagement.html?operation=read&taskid=" + task.getId().getValue() + "\"")
          .append(">" + XMLUtil.toSafeXMLString(displayMap.get(displayNames[j])) + "</a>").append("</td>");
        }else {
          dataBuffer.append("<td>").append(XMLUtil.toSafeXMLString(displayMap.get(displayNames[j]))).append("</td>");
        }
      }
View Full Code Here

    
     String[] displayNames = FilterQueryManager.getDisplayNamesFilter(filter.getXml(), das)//显示字段名
     StringBuffer plainBuffer = new StringBuffer();
     plainBuffer.append("<root>");
     for (int i = 0; i < allDatas.length; i++) {
       Data task = allDatas[i];
      
      if (task == null) {
        continue;
      }
      plainBuffer.append("<data>");
      if (templateMap.get(task.getTemplateId()) == null) {
        Template template = das.queryTemplate(task.getTemplateId());
        if (template != null) {
          templateMap.put(task.getTemplateId(), template);
        }
      }
     
      Template template = templateMap.get(task.getTemplateId());
     
      if (flowMap.get(template.getFlowId()) == null) {
        Flow flow = das.queryFlow(template.getFlowId());
        if (flow != null) {
          flowMap.put(flow.getId(), flow);
View Full Code Here

    linkStyle.setFont(cellFont);

    boolean hasTag = false;
    for(int i = 0 ;i < allDatas.length ; i++)
    {
      Data task = allDatas[i];
      if (task == null) {
        continue;
      }
      if (templateMap.get(task.getTemplateId()) == null) {
        Template template = das.queryTemplate(task.getTemplateId());
        if (template != null) {
          templateMap.put(task.getTemplateId(), template);
        }
      }
     
      Template template = templateMap.get(task.getTemplateId());
     
      if (flowMap.get(template.getFlowId()) == null) {
        Flow flow = das.queryFlow(template.getFlowId());
        if (flow != null) {
          flowMap.put(flow.getId(), flow);
        }
      }
     
      Flow flow = flowMap.get(template.getFlowId());
     
     
      Map<String, String> displayMap = FilterQueryManager.getShowFieldValueMap(displayNames , task , template ,flow ,das ,ExportType.excel , userAliasMap ,isSysFilter);
     
      HSSFRow dataRow = sheet.createRow((short)(i+1));
     
      //编号
      HSSFCell displayCellId = dataRow.createCell((short)(0));
      displayCellId.setCellType(HSSFCell.CELL_TYPE_STRING);
      displayCellId.setCellValue(task.getId().getValue());
     
      for(int j=0;j<displayNames.length;j++)
      {
        try
        {
          if (displayNames[j] != null && displayNames[j].equals("标题")) {
            //标题以超链接形式展示
            HSSFHyperlink link = new HSSFHyperlink(HSSFHyperlink.LINK_URL);
              link.setAddress(ConfigUtil.getCynthiaWebRoot() + "taskManagement.html?operation=read&taskid=" + task.getId().getValue());
              HSSFCell numberCell = dataRow.createCell((short)(j+1));
              numberCell.setCellStyle(linkStyle);
              numberCell.setCellValue(task.getTitle());
              numberCell.setHyperlink(link);// 设定单元格的链接
          }else {
            HSSFCell displayCell = dataRow.createCell((short)(j+1));
            String cellValue = splitAndFilterString(CynthiaUtil.getXMLStr(displayMap.get(displayNames[j])));
            if(cellValue.length()>32760)
              continue;
           
            if (CommonUtil.isPosNum(cellValue) || (cellValue != null && cellValue.equals("0"))) {  //设置为数字格式
              displayCell.setCellValue(Integer.parseInt(cellValue));
            }else {
              displayCell.setCellValue(cellValue);
            }
          }
        }catch(Exception e)
        {
          e.printStackTrace();
        }
       
      }
     
      if (userClassifyDataMap.get(task.getId().getValue()) != null) {
        hasTag = true;
        HSSFCell displayCell = dataRow.createCell((short)(displayNames.length+1));
        StringBuffer tagBuffer = new StringBuffer();
        String[] allTag = userClassifyDataMap.get(task.getId().getValue()).split(",");
        for (String tagId : allTag) {
          tagBuffer.append(tagBuffer.length() > 0 ? "," : "").append(tagMap.get(tagId));
        }
        displayCell.setCellValue(tagBuffer.toString());
      }
View Full Code Here

     for (int i = 0; i < displayNames.length; i++) {
      plainBuffer.append("  ").append(displayNames[i]);
    }
     plainBuffer.append("\r\n");
     for (int i = 0; i < allDatas.length; i++) {
       Data task = allDatas[i];
      if (task == null) {
        continue;
      }
      if (templateMap.get(task.getTemplateId()) == null) {
        Template template = das.queryTemplate(task.getTemplateId());
        if (template != null) {
          templateMap.put(task.getTemplateId(), template);
        }
      }
     
      Template template = templateMap.get(task.getTemplateId());
     
      if (flowMap.get(template.getFlowId()) == null) {
        Flow flow = das.queryFlow(template.getFlowId());
        if (flow != null) {
          flowMap.put(flow.getId(), flow);
        }
      }
     
      Flow flow = flowMap.get(template.getFlowId());
     
      Map<String, String> displayMap = FilterQueryManager.getShowFieldValueMap(displayNames , task , template ,flow ,das ,ExportType.excel , userAliasMap ,isSysFilter);
     
      plainBuffer.append(task.getId().getValue());
     
      for(int j=0;j<displayNames.length;j++)
      {
        String cellValue = splitAndFilterString(CynthiaUtil.getXMLStr(displayMap.get(displayNames[j])));
        if(cellValue.equals("-2147483648") || cellValue.equals("-9223372036854775808") || cellValue.equals("1.4E-45") || cellValue.equals("4.9E-324")){
View Full Code Here

        }
      } else if (field.getType().equals(Type.t_reference)) {
        if (field.getDataType().equals(DataType.dt_single)) {
          UUID dataId = task.getSingleReference(field.getId());
          if (dataId != null) {
            Data data = das.queryData(dataId);
            if (data != null)
              dataMap.put(field.getName(), data.getTitle());
          }
        } else {
          UUID[] dataIdArray = task.getMultiReference(field.getId());
          if (dataIdArray != null && dataIdArray.length > 0) {
            StringBuffer valueStrb = new StringBuffer();
            for (UUID dataId : dataIdArray) {
              Data data = das.queryData(dataId);
              if (data != null) {
                if (valueStrb.length() > 0)
                  valueStrb.append(",");

                valueStrb.append("[").append(data.getTitle())
                    .append("]");
              }
            }

            if (valueStrb.length() > 0)
View Full Code Here

TOP

Related Classes of com.sogou.qadev.service.cynthia.bean.Data

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.