Exemplo n.º 1
0
  private void initWorkEnv(Object f, Method method) {
    try {
      if (oldTorken != null && oldTorken.equals(getValue(method, f, "token"))) {
        isReLoad = false;
        return;
      }
      //      System.out.println("workEnv.initWorkEnv object f class name=" +
      // f.getClass().getName());
      WorkEnv workEnv = WorkEnv.getInstance();
      workEnv.setToken((String) getValue(method, f, "token"));
      oldTorken = workEnv.getToken();
      workEnv.setClientIP((String) getValue(method, f, "clientIP"));
      workEnv.setTransDate((String) getValue(method, f, "transDate"));
      workEnv.setRoot((String) getValue(method, f, "root"));
      workEnv.setWebRoot((String) getValue(method, f, "webRoot"));
      workEnv.setOrgCode((String) getValue(method, f, "orgCode"));
      workEnv.setOrgName((String) getValue(method, f, "orgName"));
      workEnv.setRoleId((String) getValue(method, f, "roleId"));
      workEnv.setEmpCode((String) getValue(method, f, "empCode"));
      workEnv.setEmpName((String) getValue(method, f, "empName"));
      workEnv.setExpertCode((String) getValue(method, f, "empCode"));
      workEnv.setExpertName((String) getValue(method, f, "empName"));
      workEnv.setOrgCode((String) getValue(method, f, "orgCode"));
      workEnv.setOrgPoCode((String) getValue(method, f, "orgPoCode"));
      //      System.out.println("workEnv.setOrgPoCode 1" + workEnv.getOrgPoCode());
      workEnv.setPoCode((String) getValue(method, f, "poCode"));
      workEnv.setExpertCode((String) getValue(method, f, "expertCode"));
      workEnv.setExpertName((String) getValue(method, f, "expertName"));
      workEnv.setUrlMap(changeStrToMap((String) getValue(method, f, "urlArray")));
      workEnv.setAccountId((String) getValue(method, f, "accountId"));

      //      workEnv.setCompoId((String) getValue(method, f, "compoId"));
      workEnv.setApplet((Applet) f);
      //      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
      //      Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());

      /*IBaseDataServiceDelegate baseDataServiceDelegate = (IBaseDataServiceDelegate) ServiceFactory.create(IBaseDataServiceDelegate.class, "baseDataServiceDelegate");

      RequestMeta meta = WorkEnv.getInstance().getRequestMeta();

      meta.setSvUserID((String) getValue(method, f, "userId"));
      User user = baseDataServiceDelegate.getUserById((String) getValue(method, f, "userId"), meta);
      workEnv.setCurrUser(user);
      Company company = baseDataServiceDelegate.getCompanyByCoCode(workEnv.getTransNd(), (String) getValue(method, f, "coCode"), meta);
      workEnv.setCurrCompany(company);
      meta.setSvCoCode(workEnv.getCurrCoCode());
      meta.setSvCoName(workEnv.getCurrCompany() == null ? null : workEnv.getCurrCompany().getName());
      java.util.Date sysDate = baseDataServiceDelegate.getSysDate(meta);
      workEnv.setSysDate(sysDate);

      IConsoleServiceDelegate consoleServiceDelegate = (IConsoleServiceDelegate) ServiceFactory.create(IConsoleServiceDelegate.class, "consoleServiceDelegate");

      List<AsRole> roles = consoleServiceDelegate.getAsRoleByPosi(workEnv.getPoCode(), meta);
      workEnv.setRoles(roles);

      //      List empLst = zcbaseDataServiceDelegate.queryDataForList("AsEmp.getAsEmp", null, meta);
      //
      //      EmpMeta.setEmpLst(empLst);

      if (workEnv.getOrgPoCode() == null || workEnv.getOrgPoCode().trim().equals("")) {
        workEnv.setOrgPoCode(getOrgPoCode(baseDataServiceDelegate, meta.getSvCoCode(), meta.getSvOrgCode(), meta.getSvPoCode(), workEnv.getTransNd(), meta));
      }*/
      IZcEbBaseServiceDelegate zcbaseDataServiceDelegate =
          (IZcEbBaseServiceDelegate)
              ServiceFactory.create(IZcEbBaseServiceDelegate.class, "zcEbBaseServiceDelegate");
      RequestMeta meta = WorkEnv.getInstance().getRequestMeta();
      meta.setSvUserID((String) getValue(method, f, "userId"));
      ElementConditionDto dto = new ElementConditionDto();
      dto.setUserId((String) getValue(method, f, "userId"));
      dto.setCoCode((String) getValue(method, f, "coCode"));
      dto.setNd(workEnv.getTransNd());
      dto.setPosiCode(workEnv.getPoCode());
      dto.setOrgCode((String) getValue(method, f, "orgCode"));
      Map initMap = zcbaseDataServiceDelegate.initWorkEnv(dto, meta);
      User user = (User) initMap.get("user");
      workEnv.setCurrUser(user);
      meta.setSvUserID(user.getUserId());
      Company company = (Company) initMap.get("company");
      workEnv.setCurrCompany(company);
      meta.setSvCoCode(workEnv.getCurrCoCode());
      meta.setSvCoName(
          workEnv.getCurrCompany() == null ? null : workEnv.getCurrCompany().getName());
      Date sysDate = (Date) initMap.get("sysDate");
      workEnv.setSysDate(sysDate);
      List roles = (List) initMap.get("roles");
      workEnv.setRoles(roles);
      String orgPoCode = (String) initMap.get("orgPoCode");
      workEnv.setOrgPoCode(orgPoCode);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Exemplo n.º 2
0
package com.ufgov.zc.client.zc.auditsheet;