public void update(IBaseDTO dto) {
   // TODO Auto-generated method stub
   OperInquiryCard inquiryCard =
       (OperInquiryCard) dao.loadEntity(OperInquiryCard.class, dto.get("id").toString());
   inquiryCard.setAlternatives(dto.get("alternatives").toString());
   inquiryCard.setDictQuestionType(dto.get("questionType").toString());
   inquiryCard.setQuestion(dto.get("question").toString());
 }
  public JFreeChart statistic(IBaseDTO dto) {
    // TODO Auto-generated method stub
    JFreeChart chart = null;
    // 根据输入的条件调用存储过程
    StatDateStr.setBeginEndTime(dto);
    List<String> params = new ArrayList<String>();
    List results = new ArrayList();

    procSql.setProcedureName("proc_productPriceStatisticsByState");
    params.add(dto.get("beginTime").toString());
    params.add(dto.get("endTime").toString());
    params.add(dto.get("caseRid").toString());
    procSql.setSqlvalues(params);
    results = procSql.execute();

    // 对存储过程返回的的结果进行分拣
    List<String> xAxis = getXaxis(results);
    List<String> yAxis = getYaxis(results);
    List<String> valueList = getValues(results, xAxis, yAxis);
    // 定制JFreeChart对象的属性
    Map<String, Object> properties = new HashMap<String, Object>();
    String chartType = dto.get("chartType").toString();
    if ("on".equals(dto.get("is3d"))) {
      chartType += "3d";
    }
    // 各种图形的通用属性
    properties.put("chartType", chartType);
    properties.put("chartTitle", "受理案件统计");
    // 各种图形的特定属性
    String xChartName = "".equals(dto.get("caseRid")) ? "工号" : "时间";
    String yChartName = "状态";
    if (chartType.indexOf(JFreeImpl.BAR) >= 0) {
      properties.put("xChartName", xChartName);
      properties.put("yChartName", yChartName);
      properties.put("xChartValues", xAxis);
      properties.put("yChartValues", yAxis);
      properties.put("chartValues", valueList);
    } else if (chartType.indexOf(JFreeImpl.LINE) >= 0) {
      properties.put("xChartName", xChartName);
      properties.put("yChartName", yChartName);
      properties.put("xChartValues", xAxis);
      properties.put("yChartValues", yAxis);
      properties.put("chartValues", valueList);
    } else if (chartType.indexOf(JFreeImpl.PIE) >= 0) {
      properties.put("pieTextValues", xAxis);
    }
    // 生成JFreeChart对象
    chart = chartService.createJFreeChart(valueList, properties);
    return chart;
  }
 public boolean judgementSameUer(IBaseDTO dto) {
   SysUser su = (SysUser) dao.loadEntity(SysUser.class, dto.get("userId").toString());
   if (null != su) {
     return true;
   } else {
     return false;
   }
 }
 /**
  * 创建 ResourceInfo 更新实例
  *
  * @param dto
  * @return
  */
 private ResourceInfo updateMeetingInfo(IBaseDTO dto) {
   ResourceInfo resourceInfo = new ResourceInfo();
   resourceInfo.setId(dto.get("meetingId").toString());
   resourceInfo.setResourceType("40");
   resourceInfo.setResourceName(
       dto.get("meetingName") == null ? "" : dto.get("meetingName").toString());
   resourceInfo.setResourceState(
       dto.get("meetingThing") == null ? "" : dto.get("meetingThing").toString());
   resourceInfo.setPrincipalId(
       dto.get("meetingPrincipal") == null ? "" : dto.get("meetingPrincipal").toString());
   resourceInfo.setCreateDate(TimeUtil.getNowTime());
   resourceInfo.setRemark(
       dto.get("meetingRemark") == null ? "" : dto.get("meetingRemark").toString());
   return resourceInfo;
 }
 /**
  * 创建 ResourceUse 实例
  *
  * @description : 会议室申请
  * @param dto
  * @return
  */
 private ResourceUse createApplyMeeting(IBaseDTO dto) {
   ResourceUse resourceUse = new ResourceUse();
   resourceUse.setId(keyService.getNext("resource_use"));
   resourceUse.setResourceInfo(getResourceInfo(dto.get("meetingName").toString()));
   resourceUse.setDateArea(TimeUtil.getTimeByStr(dto.get("useDate").toString(), "yyyy-MM-dd"));
   resourceUse.setTimeArea(
       dto.get("startHour").toString() + " ---- " + dto.get("endHour").toString());
   resourceUse.setUserName(dto.get("applyUser") == null ? "" : dto.get("applyUser").toString());
   resourceUse.setResourceState("1"); // 0-未审批;1-等待审批;2-已批准
   resourceUse.setRemark(dto.get("applyReason") == null ? "" : dto.get("applyReason").toString());
   resourceUse.setApplyState("40");
   return resourceUse;
 }
  public List<DynaBeanDTO> query(IBaseDTO dto) {
    // TODO Auto-generated method stub

    List<DynaBeanDTO> list = new ArrayList<DynaBeanDTO>();
    // 调用存储过程取得统计结果
    StatDateStr.setBeginEndTime(dto);
    List<String> params = new ArrayList<String>();
    List results = new ArrayList();
    String qType = dto.get("qtype") == null ? "" : dto.get("qtype").toString().trim();
    if ("统计日期次数".equals(qType) || "统计日期时长".equals(qType)) {
      procSql.setProcedureName("proc_ivrdataByDate");
    } else {
      procSql.setProcedureName("proc_ivrdata");
    }
    params.add(dto.get("beginTime").toString());
    params.add(dto.get("endTime").toString());
    params.add(dto.get("qtype").toString());

    try {
      procSql.setSqlvalues(params);
    } catch (Exception e) {
      // TODO: handle exception
      //			System.out.println(e.getStackTrace());
    }

    results = procSql.execute();
    // 对存储过程返回的的结果进行分拣
    List<String> xAxis = getXaxis(results);
    List<String> yAxis = getYaxis(results);
    List<String> valueList = getValues(results, xAxis, yAxis);
    int num = 0;
    if (xAxis.size() > 0 && yAxis.size() > 0) {
      for (Iterator<String> i = xAxis.iterator(); i.hasNext(); ) {
        String tmp = i.next();
        DynaBeanDTO r = new DynaBeanDTO();
        /*计算总量*/
        int sum = Integer.parseInt(valueList.get(xAxis.indexOf(tmp) * yAxis.size()));
        num += sum;
        String snum = String.valueOf(num);
        if (snum.equals("") || snum == null) {
          num = 0;
        }
        Set set = ivrModule.keySet();
        // System.out.println("ivr ..... "+set.contains(tmp));
        if (set.contains(tmp)) r.set("IVRmodule", ivrModule.get(tmp));
        else r.set("IVRmodule", tmp);

        if (dto.get("qtype").toString().indexOf("次数") != -1) {
          r.set("count", valueList.get(xAxis.indexOf(tmp) * yAxis.size()) + "次");
          r.set("num", num + "次");
        } else {
          r.set("count", valueList.get(xAxis.indexOf(tmp) * yAxis.size()) + "秒");
          r.set("num", num + "秒");
        }

        list.add(r);
      }
    }
    return list;
  }
  public List<DynaBeanDTO> query(IBaseDTO dto) {
    // TODO Auto-generated method stub
    List<DynaBeanDTO> list = new ArrayList<DynaBeanDTO>();
    // 调用存储过程取得统计结果
    StatDateStr.setBeginEndTime(dto);
    List<String> params = new ArrayList<String>();
    List results = new ArrayList();
    procSql.setProcedureName("proc_productPriceStatisticsByState");
    params.add(dto.get("beginTime").toString());
    params.add(dto.get("endTime").toString());
    params.add(dto.get("caseRid").toString());
    procSql.setSqlvalues(params);
    results = procSql.execute();

    // 对存储过程返回的的结果进行分拣
    List<String> xAxis = getXaxis(results);
    List<String> yAxis = getYaxis(results);
    List<String> valueList = getValues(results, xAxis, yAxis);
    if (xAxis.size() > 0 && yAxis.size() > 0) {
      for (Iterator<String> i = xAxis.iterator(); i.hasNext(); ) {
        String tmp = i.next();
        DynaBeanDTO r = new DynaBeanDTO();
        r.set("name", tmp);
        if (valueList.size() > xAxis.indexOf(tmp) * yAxis.size())
          r.set("type1", valueList.get(xAxis.indexOf(tmp) * yAxis.size()));
        else r.set("type1", "");
        //			r.set("type2", valueList.get(xAxis.indexOf(tmp)
        //							* yAxis.size() + 1));
        //			r.set("type3", new Integer(Integer.parseInt(valueList.get(xAxis
        //					.indexOf(tmp)
        //					* yAxis.size()))
        //					+ Integer.parseInt(valueList.get(xAxis.indexOf(tmp)
        //							* yAxis.size() + 1))));
        list.add(r);
      }
    }
    return list;
  }
  /**
   * 树节点的修改
   *
   * @param IBaseDTO dto 是BaseTree 和 ViewTreeDict的信息
   * @return
   * @throws
   */
  public boolean updateDict(IBaseDTO dto) {
    SysLeafRight slr = (SysLeafRight) dao.loadEntity(SysLeafRight.class, dto.get("id").toString());

    slr.setLabel(dto.get("label").toString());
    slr.setNickName(dto.get("nickName").toString());
    slr.setRemark(dto.get("remark").toString());
    slr.setDeleteMark(dto.get("deleteMark").toString());
    slr.setIcon(dto.get("icon").toString());
    slr.setType(dto.get("treeType").toString());

    dao.updateEntity(slr);

    return true;
  }
  /**
   * 根据ID返回详细信息
   *
   * @param
   * @return
   * @throws
   */
  public IBaseDTO treeInfo(String id) {

    SysLeafRight slr = (SysLeafRight) dao.loadEntity(SysLeafRight.class, id);
    IBaseDTO dto = new DynaBeanDTO();

    dto.set("id", slr.getId());
    dto.set("treeId", slr.getId());
    dto.set("treeType", slr.getType());
    dto.set("label", slr.getLabel());
    dto.set("nickName", slr.getNickName());
    dto.set("remark", slr.getRemark());

    return dto;
  }
 public IBaseDTO getInquiryCardInfo(String id) {
   // TODO Auto-generated method stub
   OperInquiryCard po = (OperInquiryCard) dao.loadEntity(OperInquiryCard.class, id);
   IBaseDTO dto = new DynaBeanDTO();
   dto.set("questionType", po.getDictQuestionType());
   dto.set("question", po.getQuestion());
   dto.set("alternatives", po.getAlternatives());
   dto.set("id", po.getId());
   dto.set("createTime", TimeUtil.getTheTimeStr(po.getCreateTime(), "yyyy-MM-dd"));
   return dto;
 }
  /**
   * 树节点的增加
   *
   * @param IBaseDTO dto 是BaseTree 和 ViewTreeDict的信息
   * @return
   * @throws
   */
  public void addDict(IBaseDTO dto, String treeId) {

    SysLeafRight slr = new SysLeafRight();

    BaseTree bt = (BaseTree) dao.loadEntity(BaseTree.class, treeId);

    slr.setId(ks.getNext("sys_leaf_right"));
    slr.setBaseTree(bt);
    slr.setType(dto.get("treeType").toString());
    slr.setLabel(dto.get("label").toString());
    slr.setNickName(dto.get("nickName").toString());
    slr.setRemark(dto.get("remark").toString());
    slr.setIcon(dto.get("icon").toString());
    slr.setDeleteMark(dto.get("deleteMark").toString());
    slr.setIcon((String) dto.get("icon"));
    dao.saveEntity(slr);
  }
  public List<IBaseDTO> listUser(IBaseDTO dto, PageInfo pi) {
    // TODO 需要写出方法的具体实现
    UserHelp uh = new UserHelp();
    Object[] o = dao.findEntity(uh.listUserMQ(dto, pi));
    ArrayList l = new ArrayList();
    if (null != o && o.length > 0) {
      for (Object oo : o) {
        SysUser su = ((SysUser) oo);
        IBaseDTO tdto = createDTOByPo(su);

        IBaseDTO gdto = this.groupService.uniqueGroup(su.getSysGroup().getId());
        IBaseDTO rdto = this.roleService.getRoleInfo(su.getSysRole().getId());
        tdto.set("groupName", gdto.get("name"));
        tdto.set("roleName", rdto.get("name"));
        l.add(tdto);
      }
      return l;
    }
    return l;
  }
  /** 查询会议室使用情况 */
  public Object[] searchResourceUse(IBaseDTO dto, PageInfo pageInfo) {
    // TODO Auto-generated method stub
    Object[] meetingObjects = new Object[0];
    try {
      SreachService sreachService = new SreachService();
      ResourceInfo ri =
          (ResourceInfo) dao.loadEntity(ResourceInfo.class, dto.get("meetingNames").toString());
      Object[] objs =
          this.dao.findEntity(sreachService.searchResourceUseMyQuery(dto, pageInfo, ri));
      sizeNum = this.dao.findEntitySize(sreachService.searchResourceUseMyQuery(dto, pageInfo, ri));

      if (null != objs && 0 < objs.length) {
        meetingObjects = new Object[objs.length];
        for (int i = 0; i < objs.length; i++) {
          ResourceUse meetingUse = (ResourceUse) objs[i];
          meetingObjects[i] = ResourceUsetoDTO(meetingUse);
        }
      }
    } catch (Exception e) {
      logger.debug(e);
    }
    return meetingObjects;
  }
 private SysUserInfo createSUIByDTO(IBaseDTO dto) {
   SysUserInfo sui = new SysUserInfo();
   sui.setUserId(
       null != dto.get("userId") && !"".equals("userId") ? dto.get("userId").toString() : "");
   sui.setRealName(null != dto.get("realName") ? dto.get("realName").toString() : "");
   sui.setSexId(null != dto.get("sexId") ? dto.get("sexId").toString() : "1");
   sui.setIdentityKind(null != dto.get("identityKind") ? dto.get("identityKind").toString() : "");
   sui.setIdentityCard(null != dto.get("identityCard") ? dto.get("identityCard").toString() : "");
   //		TimeUtil a;
   sui.setBirthday(
       null != dto.get("birthday") && !"".equals(dto.get("birthday").toString())
           ? TimeUtil.getTimeByStr(dto.get("birthday").toString(), "yyyy-MM-dd")
           : new Date());
   //		sui.setCountryId(null !=dto.get("countryId")?dto.get("countryId").toString():"");
   //		sui.setProvinceId(null !=dto.get("provinceId")?dto.get("provinceId").toString():"");
   //		sui.setQq(null !=dto.get("qq")?dto.get("qq").toString():"");
   //		sui.setBloodType(null !=dto.get("bloodType")?dto.get("bloodType").toString():"");
   //		sui.setAddress(null !=dto.get("address")?dto.get("address").toString():"");
   //		sui.setPostalcode(null !=dto.get("postalcode")?dto.get("postalcode").toString():"");
   //		sui.setMobile(null !=dto.get("mobile")?dto.get("mobile").toString():"");
   //		sui.setFinishSchool(null !=dto.get("finishSchool")?dto.get("finishSchool").toString():"");
   //		sui.setSpeciality(null !=dto.get("speciality")?dto.get("speciality").toString():"");
   //		sui.setWorkId(null !=dto.get("workId")?dto.get("workId").toString():"");
   //		sui.setHomepage(null !=dto.get("homepage")?dto.get("homepage").toString():"");
   return sui;
 }
 private SysUser modifyPoByDTO(IBaseDTO dto) {
   SysUser su = (SysUser) dao.loadEntity(SysUser.class, dto.get("userId").toString());
   //		su.setUserId(null !=dto.get("userId") && !"".equals("userId")?
   // dto.get("userId").toString():"");
   SysRole sr = new SysRole();
   sr.setId(dto.get("sysRole").toString());
   su.setSysRole(sr);
   SysGroup sg = new SysGroup();
   sg.setId(dto.get("sysGroup").toString());
   su.setSysGroup(sg);
   su.setPassword(
       null != dto.get("password") && !"".equals("password")
           ? dto.get("password").toString()
           : "");
   SysDepartment sd = new SysDepartment();
   if (null != dto.get("departmentId") && !"".equals("departmentId"))
     sd.setId(dto.get("departmentId").toString());
   su.setSysDepartment(sd);
   su.setUserName(
       null != dto.get("userName") && !"".equals("userName")
           ? dto.get("userName").toString()
           : "");
   su.setDeleteMark(
       null != dto.get("freezeMark") && !"".equals("freezeMark")
           ? dto.get("freezeMark").toString()
           : "");
   su.setRemark(
       null != dto.get("remark") && !"".equals("remark") ? dto.get("remark").toString() : "");
   //		su.setIsSys("0");
   return su;
 }
 private SysUser createPoByDTO(IBaseDTO dto) {
   SysUser su = new SysUser();
   su.setUserId(
       null != dto.get("userId") && !"".equals("userId") ? dto.get("userId").toString() : "");
   SysRole sr = new SysRole();
   sr.setId(dto.get("sysRole").toString());
   su.setSysRole(sr);
   SysGroup sg = new SysGroup();
   sg.setId(dto.get("sysGroup").toString());
   su.setSysGroup(sg);
   Password_encrypt pe = new Password_encrypt();
   su.setPassword(
       null != dto.get("password") && !"".equals("password")
           ? pe.pw_encrypt(dto.get("password").toString())
           : "");
   SysDepartment sd = new SysDepartment();
   if (null != dto.get("departmentId") && !"".equals("departmentId"))
     sd.setId(dto.get("departmentId").toString());
   su.setSysDepartment(sd);
   su.setUserName(
       null != dto.get("userName") && !"".equals("userName")
           ? dto.get("userName").toString()
           : "");
   su.setDeleteMark(
       null != dto.get("freezeMark") && !"".equals("freezeMark")
           ? dto.get("freezeMark").toString()
           : "");
   su.setRemark(
       null != dto.get("remark") && !"".equals("remark") ? dto.get("remark").toString() : "");
   su.setIsSys("0");
   return su;
 }
 public void delete(IBaseDTO dto) {
   // TODO Auto-generated method stub
   OperInquiryCard inquiryCard =
       (OperInquiryCard) dao.loadEntity(OperInquiryCard.class, dto.get("id").toString());
   dao.removeEntity(inquiryCard);
 }
 private SysUser modifyPwd(IBaseDTO dto) {
   SysUser su = (SysUser) dao.loadEntity(SysUser.class, dto.get("userId").toString());
   su.setPassword(dto.get("repassword").toString());
   return su;
 }
 private IBaseDTO createDTOByPo(SysUserInfo sui, IBaseDTO dto) {
   if (null != sui) {
     dto.set("realName", sui.getRealName());
     dto.set("sexId", sui.getSexId());
     dto.set("identityKind", sui.getIdentityKind());
     dto.set("identityCard", sui.getIdentityCard());
     dto.set(
         "birthday",
         null != sui.getBirthday()
             ? TimeUtil.getTheTimeStr(sui.getBirthday(), "yyyy-MM-dd")
             : "0000-00-00");
     dto.set("countryId", sui.getCountryId());
     dto.set("provinceId", sui.getProvinceId());
     dto.set("qq", sui.getQq());
     dto.set("bloodType", sui.getBloodType());
     dto.set("address", sui.getAddress());
     dto.set("postalcode", sui.getPostalcode());
     dto.set("mobile", sui.getMobile());
     dto.set("finishSchool", sui.getFinishSchool());
     dto.set("speciality", sui.getSpeciality());
     dto.set("workId", sui.getWorkId());
     dto.set("homepage", sui.getHomepage());
   }
   return dto;
 }