Exemplo n.º 1
0
 private DTOSet getSystemIds(HttpServletRequest req) throws UploadException {
   DTOSet dtos = new DTOSet();
   try {
     CheckBoxProp checkProp = new CheckBoxProp("subCheck");
     checkProp.setIgnoreOtherField(true);
     RequestParser reqParser = new RequestParser();
     reqParser.setCheckBoxProp(checkProp);
     reqParser.transData(req);
     String[] exarr = reqParser.getParameterValues("systemId");
     if (exarr != null) {
       TfEtsItemMatchRecDTO dto;
       String inarr;
       for (int i = 0; i < exarr.length; i++) {
         inarr = exarr[i];
         if (inarr != null && !inarr.equals("")) {
           dto = new TfEtsItemMatchRecDTO();
           dto.setSystemId(inarr);
           dtos.addDTO(dto);
         }
       }
     }
   } catch (StrException ex) {
     ex.printLog();
     throw new UploadException(ex);
   } catch (DTOException ex) {
     ex.printLog();
     throw new UploadException(ex);
   }
   return dtos;
 }
Exemplo n.º 2
0
  /** 查询会计期间 */
  public void synPeriodStatus(Connection conn, SfUserDTO user) {
    int trueCount = 0;
    int totalCount = 0;
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    try {

      InquiryAssetPeriodStatusSrv service = new InquiryAssetPeriodStatusSrv();
      SrvAssetPeriodStatusDTO dtoParameter = new SrvAssetPeriodStatusDTO();
      SrvAssetPeriodDAO srvAssetPeriodDAO = new SrvAssetPeriodDAO(user, dtoParameter, conn);
      String bookType[] = logUtil.getBookTypeCodeModel(conn, MIS_CONSTANT.SOURCE_MIS);
      SrvReturnMessage srm = new SrvReturnMessage();

      for (int i = 0; i < bookType.length; i++) {
        logDTO = new SynLogDTO();
        logDTO.setSynType(SrvType.SRV_FA_PERIOD);
        logDTO.setCreatedBy(user.getUserId());
        logDTO.setSynMsg(bookType[i] + ":同步MIS资产会计期间开始");
        logUtil.synLog(logDTO, conn);
        service.setBookTypeCode(bookType[i]);
        service.execute();
        srm = service.getReturnMessage();

        if (srm.getErrorFlag().equals("Y")) {
          DTOSet ds = service.getDs();
          totalCount += ds.getSize();
          trueCount += srvAssetPeriodDAO.synAssetPeriod(ds);
        }
        resumeTime = System.currentTimeMillis() - start;
        logDTO = new SynLogDTO();
        logDTO.setSynType(SrvType.SRV_FA_PERIOD);
        logDTO.setCreatedBy(user.getUserId());
        logDTO.setSynMsg(
            bookType[i]
                + ":同步MIS资产会计期间结束。同步"
                + totalCount
                + "条记录,成功"
                + trueCount
                + ",失败"
                + (totalCount - trueCount)
                + ",耗时"
                + resumeTime
                + "毫秒");
        if (srm.getErrorFlag().equals("N")) {
          logDTO.setSynMsg(logDTO.getSynMsg() + ".错误信息:" + srm.getErrorMessage());
        }
        logUtil.synLog(logDTO, conn);
      }
      if (totalCount == trueCount) {
        SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_FA_PERIOD, conn);
        SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_FA_PERIOD, conn);
      }

    } catch (Exception e) {
      Logger.logError(e);
    }
  }
Exemplo n.º 3
0
  /** 查询组织结构 */
  public void synOrgstructure(Connection conn, SfUserDTO user) {
    int count = 0;
    long resumeTime = 0;
    int falsecount = 0;
    long start = System.currentTimeMillis();
    SynLogDTO logDTO = null;
    try {
      SynLogUtil logUtil = new SynLogUtil();
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_ORG_STRUCTURE);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS组织结构开始");
      logUtil.synLog(logDTO, conn);

      SBHRHRInquiryOrgStructureSrv service = new SBHRHRInquiryOrgStructureSrv();
      service.excute();
      SrvReturnMessage srm = service.getReturnMessage();
      SBHRHRInquiryOrgStructureDAO dao =
          new SBHRHRInquiryOrgStructureDAO(user, new SBHRHRInquiryOrgStructureDTO(), conn);
      if (srm.getErrorFlag().equalsIgnoreCase("Y")) {
        DTOSet ds = service.getDs();
        if (ds.getSize() > 0) {
          ds = filterDtoSet(ds);
          count = dao.synOrgStructure(ds);
        }
      }
      falsecount = dao.getErrorCount();
      if (falsecount == 0) { // 没有发生错误才记录同步类型的更新时间
        SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_ORG_STRUCTURE, conn);
        SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_ORG_STRUCTURE, conn);
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_ORG_STRUCTURE);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS组织结构结束。同步"
              + (count + falsecount)
              + "条记录,成功"
              + count
              + ",失败"
              + (falsecount)
              + ",耗时"
              + resumeTime
              + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (CalendarException e) {
      Logger.logError(e);
    } catch (DTOException e) {
      Logger.logError(e);
    } catch (DataHandleException e) {
      Logger.logError(e);
    }
  }
Exemplo n.º 4
0
  /** 查询供应商信息 */
  public void synVendorInfo(Connection conn, SfUserDTO user) {
    int count = 0;
    int errorCount = 0;
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_VENDOR);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS供应商信息开始");
      logUtil.synLog(logDTO, conn);

      InquiryVendorInfoSrv service = new InquiryVendorInfoSrv();
      service.setLastUpdateDate(SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_VENDOR, conn));
      service.excute();
      SrvReturnMessage srvMessage = service.getReturnMessage();
      SrvVendorInfoDAO srvVendorInfoDAO = new SrvVendorInfoDAO(user, new SrvVendorInfoDTO(), conn);
      if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
        SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_VENDOR, conn);
        DTOSet ds = service.getDs();
        if (ds.getSize() > 0) {
          count = srvVendorInfoDAO.synVendorInfo(ds);
        }
        SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_VENDOR, conn);
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_VENDOR);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS供应商信息结束。同步"
              + (count + errorCount)
              + "条记录,成功"
              + count
              + ",失败"
              + errorCount
              + ",耗时"
              + resumeTime
              + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (DataHandleException e) {
      Logger.logError(e);
    } catch (QueryException e) {
      Logger.logError(e);
    } catch (ContainerException e) {
      Logger.logError(e);
    } catch (Exception e) {
      Logger.logError(e);
    }
  }
Exemplo n.º 5
0
  /** 查询资产类别 */
  public void synAssetCategory(Connection conn, SfUserDTO user) {
    int count = 0;
    long resumeTime = 0;
    int errorCount = 0;
    long start = System.currentTimeMillis();
    SynLogDTO logDTO = null;
    try {
      SynLogUtil logUtil = new SynLogUtil();
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_FA_CATEGORY);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS资产类别开始");
      logUtil.synLog(logDTO, conn);

      SBFIFAInquiryAssetCategorySrv service = new SBFIFAInquiryAssetCategorySrv();
      String lastUpdateDate = logUtil.getLastUpdateDate(SrvType.SRV_FA_CATEGORY, conn);
      SBFIFASrvAssetCategoryDAO srvAssetCategoryDAO =
          new SBFIFASrvAssetCategoryDAO(user, new SBFIFASrvAssetCategoryDTO(), conn);
      service.setLastUpdateDate(lastUpdateDate);
      service.execute();
      SrvReturnMessage srm = service.getReturnMessage();
      if (srm.getErrorFlag().equals("Y")) {
        SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_FA_CATEGORY, conn);
        DTOSet ds = service.getDs();
        if (ds.getSize() > 0) {
          count = srvAssetCategoryDAO.SavaAssetCategory(ds);
        }
        SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_FA_CATEGORY, conn);
      }
      errorCount = srvAssetCategoryDAO.getErrorCount();
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_FA_CATEGORY);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS资产类别结束,成功" + count + ",失败" + errorCount + ",耗时" + resumeTime + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (DatatypeConfigurationException e) {
      Logger.logError(e);
    } catch (PoolException e) {
      Logger.logError(e);
    } catch (QueryException e) {
      Logger.logError(e);
    } catch (ContainerException e) {
      Logger.logError(e);
    } catch (CalendarException e) {
      Logger.logError(e);
    } catch (DTOException e) {
      Logger.logError(e);
    } catch (DataHandleException e) {
      Logger.logError(e);
    }
  }
Exemplo n.º 6
0
 public void saveUses(DTOSet lineSet) throws DataHandleException, QueryException {
   AmsHouseInfoDTO houseDTO = (AmsHouseInfoDTO) dtoParameter;
   if (lineSet != null && !lineSet.isEmpty()) {
     for (int i = 0; i < lineSet.getSize(); i++) {
       AmsHouseUsesDTO lineData = (AmsHouseUsesDTO) lineSet.getDTO(i);
       lineData.setBarcode(houseDTO.getBarcode());
       if (!(lineData.getArea().equals("") || lineData.getUsage().equals(""))) {
         GetMisHousInfoModel model = new GetMisHousInfoModel(userAccount, houseDTO);
         SQLModel sqlModel = model.insertUsesInfo(lineData);
         DBOperator.updateRecord(sqlModel, conn);
       }
     }
   }
 }
Exemplo n.º 7
0
 private DTOSet filterDtoSet(DTOSet ds) {
   DTOSet returnds = new DTOSet();
   for (int i = 0; i < ds.getSize(); i++) {
     SBHRHRInquiryOrgStructureDTO dto = (SBHRHRInquiryOrgStructureDTO) ds.getDTO(i);
     if (dto.getOrganizationName().indexOf("OU_") < 0
         && dto.getOrganizationName().indexOf("IO_") < 0
         && dto.getOrganizationName().indexOf("IA_") < 0
         && dto.getOrganizationName().indexOf("LA_") < 0) {
       try {
         returnds.addDTO(dto);
       } catch (DTOException e) {
         e.printLog();
       }
     }
   }
   return returnds;
 }
Exemplo n.º 8
0
 private DTOSet getCheckedAssets(HttpServletRequest req, String matchType)
     throws ServletException {
   DTOSet dtos = new DTOSet();
   try {
     RequestParser parser = new RequestParser();
     CheckBoxProp checkProp = new CheckBoxProp("subCheck");
     checkProp.setIgnoreOtherField(true);
     parser.setCheckBoxProp(checkProp);
     parser.transData(req);
     String[] systemids = parser.getParameterValues("systemId");
     String[] assetIds = parser.getParameterValues("assetId");
     if (systemids != null) {
       int checkedCount = systemids.length;
       for (int i = 0; i < checkedCount; i++) {
         TfEtsItemMatchRecDTO dto = new TfEtsItemMatchRecDTO();
         dto.setSystemId(systemids[i]);
         dto.setAssetId(assetIds[i]);
         dto.setMatchType(matchType);
         // String flag = req.getParameter("unyokeFlag");
         String flag = "1";
         if (flag.equals("1")) { // 资产匹配撤销
           dto.setOldFinanceProp(DictConstant.FIN_PROP_ASSETS);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_UNKNOW);
         } else if (flag.equals("0")) { // 转资匹配撤销
           dto.setOldFinanceProp(DictConstant.FIN_PROP_ASSETS);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_PRJ);
         }
         dtos.addDTO(dto);
       }
     }
   } catch (UploadException ex) {
     ex.printLog();
     throw new ServletException(ex);
   } catch (StrException ex) {
     ex.printLog();
     throw new ServletException(ex);
   } catch (DTOException ex) {
     ex.printLog();
     throw new ServletException(ex);
   }
   return dtos;
 }
Exemplo n.º 9
0
 /**
  * 功能:记录设备最新一次交易情况:例如报废,其他的视具体需要而定 需要同步到MIS的时候调用该方法。
  *
  * @param orderType String
  * @param isExist String
  * @throws DataHandleException
  */
 private void recordChkLog(String orderType, String isExist) throws DataHandleException {
   try {
     FreeFlowDTO dto = (FreeFlowDTO) dtoParameter;
     AmsAssetsTransLineDTO line = new AmsAssetsTransLineDTO();
     line.setTransId(dto.getTransId());
     AmsAssetsTransLineDAO lineDAO = new AmsAssetsTransLineDAO(userAccount, line, conn);
     lineDAO.setDTOClassName(AmsAssetsTransLineDTO.class.getName());
     DTOSet dtos = (DTOSet) lineDAO.getDataByForeignKey("transId");
     if (dtos != null && !dtos.isEmpty()) {
       int lineCount = dtos.getSize();
       String orderUrl = "";
       AmsAssetsChkLogDTO chkLogDTO = null;
       AmsAssetsChkLogDAO chkLogDAO = new AmsAssetsChkLogDAO(userAccount, null, conn);
       for (int i = 0; i < lineCount; i++) {
         line = (AmsAssetsTransLineDTO) dtos.getDTO(i);
         chkLogDTO = new AmsAssetsChkLogDTO();
         chkLogDTO.setBarcode(line.getBarcode());
         chkLogDTO.setLastChkNo(line.getTransNo());
         chkLogDTO.setHeaderId(line.getTransId());
         chkLogDTO.setResponsibilityUser(line.getResponsibilityUser());
         chkLogDTO.setResponsibilityDept(line.getDeptCode());
         chkLogDTO.setAddressId(line.getAddressId());
         chkLogDTO.setOrganizationId(userAccount.getOrganizationId());
         chkLogDTO.setCreatedBy(userAccount.getUserId());
         chkLogDTO.setOrderType(orderType);
         chkLogDTO.setIsExist(isExist);
         orderUrl = URLDefineList.FREE_FLOW_SERVLET;
         orderUrl += "?act=" + AssetsActionConstant.DETAIL_ACTION;
         orderUrl += "&transId=" + line.getTransId();
         chkLogDTO.setOrderDtlUrl(orderUrl);
         chkLogDAO.setDTOParameter(chkLogDTO);
         chkLogDAO.saveCheckLogData();
       }
     }
   } catch (QueryException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   }
 }
Exemplo n.º 10
0
  /** 查询项目信息 */
  public void synProjectInfo(Connection conn, SfUserDTO user) {
    int totalCount = 0;
    int errorCount = 0;
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_PA_PROJECT);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS项目信息开始");
      logUtil.synLog(logDTO, conn);

      InquiryProjectInfoSrv projectInfoSrv = new InquiryProjectInfoSrv();
      projectInfoSrv.execute();
      SrvReturnMessage srvMessage = projectInfoSrv.getReturnMessage();
      if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
        DTOSet ds = projectInfoSrv.getDs();
        SrvProjectInfoDAO srvProjectInfoDAO = new SrvProjectInfoDAO(user, null, conn);
        for (int i = 0; i < ds.getSize(); i++) {
          SrvProjectInfoDTO dto = (SrvProjectInfoDTO) ds.getDTO(i);
          srvProjectInfoDAO.setDTOParameter(dto);
          try {
            if (SynUpdateDateUtils.getBetweenDays(
                    SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_PA_PROJECT, conn),
                    (dto.getLastUpdateDate().toString()))
                > 0) {
              if (srvProjectInfoDAO.isProjecdtExists(dto.getSegment1())) {
                srvProjectInfoDAO.updateData();
              } else {
                srvProjectInfoDAO.createData();
              }
              totalCount++;
            }
          } catch (Throwable e) {
            Logger.logError(e);
            logDTO = new SynLogDTO();
            logDTO.setSynType(SrvType.SRV_PA_PROJECT);
            logDTO.setCreatedBy(user.getUserId());
            logDTO.setSynMsg(e.toString());
            logUtil.synLog(logDTO, conn);
            errorCount++;
          }
        }
        if (errorCount == 0) { // 错误数为0时才能更新同步类型日志记录,否则可能造成数据遗漏
          SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_PA_PROJECT, conn);
          SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_PA_PROJECT, conn);
        }
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_PA_PROJECT);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS项目信息结束!成功" + totalCount + ",失败" + errorCount + ",耗时" + resumeTime + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (Throwable e) {
      Logger.logError(e);
    }
  }
Exemplo n.º 11
0
  /** 查询值集信息 */
  public void synSetValue(Connection conn, SfUserDTO user, String source) {
    int totalCount = 0;
    long resumeTime = 0;
    int errorCount = 0;
    long start = System.currentTimeMillis();
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_SET_VALUESET);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS值集值信息服务开始");
      logUtil.synLog(logDTO, conn);

      SBSYSYInquiryVSetValueInfoDAO mFndFlexValuesDAO =
          new SBSYSYInquiryVSetValueInfoDAO(user, null, conn);
      List valuesList = mFndFlexValuesDAO.getAllFlexValues(source);
      if (valuesList != null && valuesList.size() > 0) {
        SBSYSYInquiryVSetValueInfoSrv setValueInfoSrv = new SBSYSYInquiryVSetValueInfoSrv();
        setValueInfoSrv.setStartLastUpdateDate(
            SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_SET_VALUESET, conn));

        for (int i = 0; i < valuesList.size(); i++) {
          String flexValueName = (String) valuesList.get(i);
          setValueInfoSrv.setFlexValueName(flexValueName);
          setValueInfoSrv.execute();
          SrvReturnMessage srvMessage = setValueInfoSrv.getReturnMessage();
          if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
            DTOSet ds = setValueInfoSrv.getDs();
            for (int j = 0; j < ds.getSize(); j++) {
              SBSYSYInquiryVSetValueInfoDTO valueSetDTO =
                  (SBSYSYInquiryVSetValueInfoDTO) ds.getDTO(j);
              mFndFlexValuesDAO.setDTOParameter(valueSetDTO);
              try {
                if (mFndFlexValuesDAO.isexistsSetValueModel(
                    valueSetDTO.getFlexValue(), valueSetDTO.getFlexValueSetId())) {
                  mFndFlexValuesDAO.updateData();
                } else {
                  mFndFlexValuesDAO.createData();
                }
                totalCount++;
              } catch (Throwable e) {
                Logger.logError(e);
                logDTO = new SynLogDTO();
                logDTO.setSynType(SrvType.SRV_SET_VALUESET);
                logDTO.setCreatedBy(user.getUserId());
                logDTO.setSynMsg(e.toString());
                logUtil.synLog(logDTO, conn);
                errorCount++;
              }
            }
          }
        }
        if (errorCount == 0) {
          SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_SET_VALUESET, conn);
          SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_SET_VALUESET, conn);
        }
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_SET_VALUESET);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS值集值信息服务结束。成功" + totalCount + ",失败" + errorCount + ",耗时" + resumeTime + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (Throwable e) {
      Logger.logError(e);
    }
  }
Exemplo n.º 12
0
 private DTOSet getDTOs(HttpServletRequest req, String matchType) throws UploadException {
   DTOSet dtos = new DTOSet();
   try {
     RequestParser reqParser = new RequestParser();
     reqParser.transData(req);
     String[] exarr = reqParser.getParameterValues("systemId");
     //            String[] arr = reqParser.getParameterValues("assetId");
     if (exarr != null) {
       int exLength = exarr.length;
       for (int i = 0; i < exLength; i++) {
         TfEtsItemMatchRecDTO dto = new TfEtsItemMatchRecDTO();
         dto.setSystemId(exarr[i]);
         //                    dto.setAssetId(arr[i]);
         if (matchType.equals(WebAttrConstant.MATCH_MODE_SPARE)) { // 备件确认
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_SPARE);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_SPARE_RET)) { // 撤销备件关系
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_SPARE);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_PRJMTL)) { // 工程物资确认
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_PRJ);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_PRJMTL_RET)) { // 撤销工程物资匹配关系
           //                        dto.setAssetId(arr[i]);
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_PRJ);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_OTHER)) { // 设备屏蔽
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_OTHER);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_0THER_RET)) { // 撤销设备屏蔽
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_OTHER);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_RENT)) { // 租赁资产确认
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_RENT);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_RENT_RET)) { // 租赁资产撤销
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_RENT);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_DG)) { // 代管资产确认
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_DG);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_DG_RET)) { // 代管资产撤销
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_DG);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_LC)) { // 低值易耗资产确认
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_DH);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_LC_RET)) { // 低值易耗资产撤销
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_DH);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_TD)) { // TD资产确认
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_TD);
           dtos.addDTO(dto);
         } else if (matchType.equals(WebAttrConstant.MATCH_MODE_TD_RET)) { // TD资产撤销
           dto.setMatchType(matchType);
           dto.setOldFinanceProp(DictConstant.FIN_PROP_TD);
           dto.setNewFinanceProp(DictConstant.FIN_PROP_UNKNOW);
           dtos.addDTO(dto);
         }
         //                    else if
         // (matchType.equals(WebAttrConstant.MATHC_MODE_CHANGED_ASSETS_RET)) { // 撤消资产匹配关系操作
         //                        dto.setMatchType(matchType);
         //                        String flag = req.getParameter("unyokeFlag");
         //                        if (flag.equals("1")) {                   //资产匹配撤销
         //                            dto.setOldFinanceProp(DictConstant.FIN_PROP_ASSETS);
         //                            dto.setNewFinanceProp(DictConstant.FIN_PROP_UNKNOW);
         //                            dtos.addDTO(dto);
         //                        } else if (flag.equals("0")) {            //转资匹配撤销
         //                            dto.setOldFinanceProp(DictConstant.FIN_PROP_ASSETS);
         //                            dto.setNewFinanceProp(DictConstant.FIN_PROP_PRJ);
         //                            dtos.addDTO(dto);
         //                        }
         //                    }
       }
     }
   } catch (DTOException ex) {
     ex.printLog();
     throw new UploadException(ex);
   }
   return dtos;
 }
Exemplo n.º 13
0
  /**
   * 功能:保存工单
   *
   * @param orders DTOSet
   * @return boolean
   */
  public boolean saveOrders(DTOSet orders) {
    boolean operateResult = false;
    boolean autoCommit = true;
    EamDhCheckBatchDTO dto = (EamDhCheckBatchDTO) dtoParameter;
    boolean isNewBatch = dto.getBatchId().equals("");
    String act = dto.getAct();
    try {
      autoCommit = conn.getAutoCommit();
      conn.setAutoCommit(false);
      if (isNewBatch) {
        SeqProducer seqPrd = new SeqProducer(conn);
        // TODO
        dto.setBatchId(seqPrd.getStrNextSeq("EAM_DH_CHECK_BATCH") + "");
        String companyCode = userAccount.getCompanyCode();
        String orderType = LvecDicts.CHECK_BATCH;
        OrderNumGenerator numPrd = new OrderNumGenerator(conn, companyCode, orderType);
        numPrd.setOrderLength(3);
        dto.setBatchNo(numPrd.getOrderNum());
        setDTOParameter(dto);
        createData();
      } else {
        updateData();
      }
      EamDhCheckLineDAO lineDAO = new EamDhCheckLineDAO(userAccount, null, conn);
      EamDhCheckLineDTO orderLine = new EamDhCheckLineDTO();
      if (!dto.getOrderType().equals(LvecDicts.ORD_TYPE1_DHBS)) {
        orderLine.setBatchId(dto.getBatchId());
        lineDAO.setDTOParameter(orderLine);
        lineDAO.DeleteByForeignKey("batchId");
      }
      EamDhCheckHeaderDTO orderHeader = new EamDhCheckHeaderDTO();
      orderHeader.setBatchId(dto.getBatchId());
      EamDhCheckHeaderDAO headerDAO = new EamDhCheckHeaderDAO(userAccount, orderHeader, conn);
      headerDAO.DeleteByForeignKey("batchId");

      int orderCount = orders.getSize();
      for (int i = 0; i < orderCount; i++) {
        orderHeader = (EamDhCheckHeaderDTO) orders.getDTO(i);

        if (orderHeader.getCheckLocation() == 0) {

          continue;
        }
        orderHeader.setBatchId(dto.getBatchId());
        orderHeader.setCheckTaskId(dto.getCheckTaskId());
        orderHeader.setAct(act);
        headerDAO.setDTOParameter(orderHeader);
        headerDAO.saveOrder();

        if (!orderHeader.getOrderType().equals(LvecDicts.ORD_TYPE1_DHBS)) { // 非补扫工单才需要创建行信息
          orderHeader = (EamDhCheckHeaderDTO) headerDAO.getDTOParameter();
          orderLine.setHeaderId(orderHeader.getHeaderId());
          orderLine.setOrderType(orderHeader.getOrderType());
          orderLine.setBatchId(dto.getBatchId());
          lineDAO.setDTOParameter(orderLine);
          lineDAO.createData();
        }
      }
      operateResult = true;
    } catch (Exception ex) {
      Logger.logError(ex);
    } finally {
      try {
        if (operateResult) {
          conn.commit();
          if (act.equals(DzyhActionConstant.SAVE_ACTION)) { // 暂存工单
            prodMessage(LvecMessageKeys.ORDER_SAVE_SUCCESS);
          } else if (act.equals(DzyhActionConstant.DISTRI_ORDER)) { // 下发工单
            prodMessage(LvecMessageKeys.ORDER_DISTRI_SUCCESS);
          }
        } else {
          conn.rollback();
          if (isNewBatch) {
            dto.setBatchId("");
            dto.setBatchNo(LvecWebAttributes.ORDER_NO_AUTO_PRODUCE);
          }
          if (act.equals(DzyhActionConstant.SAVE_ACTION)) { // 暂存工单
            prodMessage(LvecMessageKeys.ORDER_SAVE_FAILURE);
          } else if (act.equals(DzyhActionConstant.DISTRI_ORDER)) { // 下发工单
            prodMessage(LvecMessageKeys.ORDER_DISTRI_FAILURE);
          }
          message.setIsError(true);
        }
        conn.setAutoCommit(autoCommit);
        setDTOParameter(dto);
      } catch (SQLException ex) {
        Logger.logError(ex);
      }
    }
    return operateResult;
  }
Exemplo n.º 14
0
 /**
  * 提交工单
  *
  * @param dtoSet
  * @return
  * @throws QueryException
  * @throws DataHandleException
  */
 private boolean importEAMhouse(DTOSet dtoSet) throws DataHandleException {
   boolean operatorResult = false;
   try {
     if (dtoSet != null && dtoSet.getSize() > 0) {
       EtsFaAssetsDTO faDTO = null;
       EtsItemInfoDTO itemDTO = null;
       AmsHouseInfoDTO houseDTO = null;
       SystemItemHouse systemItemUtil = new SystemItemHouse();
       for (int i = 0; i < dtoSet.getSize(); i++) {
         faDTO = (EtsFaAssetsDTO) dtoSet.getDTO(i);
         itemDTO = new EtsItemInfoDTO();
         itemDTO.setBarcode(faDTO.getTagNumber());
         itemDTO.setItemName(faDTO.getAssetsDescription());
         itemDTO.setItemSpec(faDTO.getModelNumber());
         itemDTO.setItemQty(StrUtil.nullToString(faDTO.getCurrentUnits()));
         itemDTO.setStartDate(faDTO.getDatePlacedInService().toString());
         itemDTO.setItemCategory("HOUSE");
         itemDTO.setAssetId(faDTO.getAssetId());
         itemDTO.setOrganizationId(faDTO.getOrganizationId());
         itemDTO.setFinanceProp("ASSETS");
         itemDTO = systemItemUtil.checkSysItem(conn, itemDTO);
         appendProjIdData(itemDTO, faDTO);
         appendUserData(itemDTO, faDTO);
         appendAddressData(itemDTO, faDTO);
         if (StrUtil.isEmpty(itemDTO.getAddressId())) {
           addAddressData(faDTO);
           appendAddressData(itemDTO, faDTO);
         }
         if (StrUtil.isEmpty(itemDTO.getAddressId())) {
           continue;
         }
         houseDTO = new AmsHouseInfoDTO();
         houseDTO.setBarcode(faDTO.getTagNumber());
         houseDTO.setHouseAddress(faDTO.getAssetsLocation());
         houseDTO.setHremark("house信息导入");
         itemDTO.setSystemId(getNextSystemId());
         itemDTO.setRemark("house信息导入");
         if (!isExist(faDTO)) {
           insertEtsItemInfo(itemDTO); // IN  ams_item_info
         }
         insertHouesInfo(houseDTO); // IN ams_house_info
         matchData(itemDTO, faDTO); // 进行匹配操作
       }
     }
     operatorResult = true;
   } catch (DataHandleException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   } catch (SQLException ex) {
     Logger.logError(ex);
     throw new DataHandleException(ex);
   } catch (ContainerException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   } catch (QueryException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   } catch (CalendarException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   }
   return operatorResult;
 }
Exemplo n.º 15
0
  /** 查询资产地点 */
  public void synFaLocation(Connection conn, SfUserDTO user) {
    int totalCount = 0;
    int count = 0;
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_FA_LOCATION);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS资产地点开始");
      logUtil.synLog(logDTO, conn);

      SrvAssetLocationSrv service = new SrvAssetLocationSrv();
      SrvAssetLocationDTO dtoParameter = new SrvAssetLocationDTO();
      SrvAssetLocationDAO srvAssetLocationDAO = new SrvAssetLocationDAO(user, dtoParameter, conn);
      service.setLastUpDate(SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_FA_LOCATION, conn));
      SrvProcessModel spm = new SrvProcessModel();
      SQLModel sqlModel =
          spm.getLocalCodeModel(MIS_CONSTANT.SOURCE_MIS, SinoConfig.getLoc1SetNameMis());
      SimpleQuery simp = new SimpleQuery(sqlModel, conn);
      simp.executeQuery();
      Row row = null;
      if (simp.hasResult()) {
        RowSet rs = simp.getSearchResult();
        for (int i = 0; i < rs.getSize(); i++) {
          row = rs.getRow(i);
          String cc = row.getStrValue("FLEX_VALUE");
          service.setSegment1(cc);
          service.excute();
          SrvReturnMessage srm = service.getReturnMessage();
          if (srm.getErrorFlag().equals("Y")) {
            DTOSet ds = service.getDs();
            totalCount += ds.getSize();
            if (ds.getSize() > 0) {
              count += srvAssetLocationDAO.synAssetLocation(ds, cc);
            }
          }
        }
        if (totalCount == count) { // 全部成功才更新同步类型日志,以免下次获取不到数据
          SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_FA_LOCATION, conn);
          SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_FA_LOCATION, conn);
        }
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_FA_LOCATION);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS资产地点结束。同步"
              + totalCount
              + "条记录,成功"
              + count
              + ",失败"
              + (totalCount - count)
              + ",耗时"
              + resumeTime
              + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (Exception e) {
      Logger.logError(e);
    }
  }
Exemplo n.º 16
0
  /** 查询员工信息 */
  public void synEmployeeInfo(Connection conn, SfUserDTO user) {
    long resumeTime = 0;
    int baseErrorCount = 0;
    int baseTotalCount = 0;
    int assignErrorCount = 0;
    int assignTotalCount = 0;
    long start = System.currentTimeMillis();
    SBHRHRInquiryEmpBaseInfoSrv employeeInfoSrv = new SBHRHRInquiryEmpBaseInfoSrv();
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_EMPLOYEE);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS员工信息开始");
      logUtil.synLog(logDTO, conn);

      employeeInfoSrv.setStartLastUpdateDate(
          SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_EMPLOYEE, conn));
      employeeInfoSrv.excute();
      SrvReturnMessage srvMessage = employeeInfoSrv.getReturnMessage();

      if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
        DTOSet ds = employeeInfoSrv.getDs();
        SBHRHRSrvEmpInfoDAO srvEmployeeInfoDAO = new SBHRHRSrvEmpInfoDAO(user, null, conn);
        for (int i = 0; i < ds.getSize(); i++) {
          SBHRHRSrvEmployeeInfoDTO dto = (SBHRHRSrvEmployeeInfoDTO) ds.getDTO(i);
          srvEmployeeInfoDAO.setDTOParameter(dto);
          try {
            if (srvEmployeeInfoDAO.isServiceTypeExists(dto.getEmployeeNumber())) {
              srvEmployeeInfoDAO.updateData();
            } else {
              srvEmployeeInfoDAO.createData();
            }
            baseTotalCount++;
          } catch (Throwable e) {
            Logger.logError(e);
            logDTO = new SynLogDTO();
            logDTO.setSynType(SrvType.SRV_EMPLOYEE);
            logDTO.setCreatedBy(user.getUserId());
            logDTO.setSynMsg(e.toString());
            logUtil.synLog(logDTO, conn);
            baseErrorCount++;
          }
        }
        SBHRHRInquiryEmpAssignInfoSrv empAssignInfoSrv = new SBHRHRInquiryEmpAssignInfoSrv();
        empAssignInfoSrv.setStartLastUpdateDate(
            SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_EMPLOYEE, conn));
        empAssignInfoSrv.execute();
        SrvReturnMessage empMessage = empAssignInfoSrv.getReturnMessage();
        if (empMessage.getErrorFlag().equalsIgnoreCase("Y")) {
          DTOSet dtos = empAssignInfoSrv.getDs();
          SBHRHRSrvEmpAssignDAO srvEmpAssignInfoDAO = new SBHRHRSrvEmpAssignDAO(user, null, conn);
          for (int i = 0; i < dtos.getSize(); i++) {
            SBHRHRSrvEmployeeInfoDTO dto = (SBHRHRSrvEmployeeInfoDTO) dtos.getDTO(i);
            srvEmpAssignInfoDAO.setDTOParameter(dto);
            try {
              if (srvEmpAssignInfoDAO.isEmployeeExists(dto.getEmployeeNumber())) {
                srvEmpAssignInfoDAO.updateData();
                assignTotalCount++;
              }
            } catch (Throwable e) {
              Logger.logError(e);
              logDTO = new SynLogDTO();
              logDTO.setSynType(SrvType.SRV_EMPLOYEE);
              logDTO.setCreatedBy(user.getUserId());
              logDTO.setSynMsg(e.toString());
              logUtil.synLog(logDTO, conn);
              assignErrorCount++;
            }
          }
        }
        if (baseErrorCount + assignErrorCount == 0) {
          SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_EMPLOYEE, conn);
          SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_EMPLOYEE, conn);
        }
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_EMPLOYEE);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS员工信息结束。共同步"
              + (baseTotalCount + baseErrorCount + assignTotalCount + assignErrorCount)
              + "条记录,"
              + "员工基本信息同步成功"
              + baseTotalCount
              + ",失败"
              + baseErrorCount
              + ","
              + "员工分配信息同步成功"
              + assignTotalCount
              + ",失败"
              + assignErrorCount
              + ","
              + "耗时"
              + resumeTime
              + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (Throwable e) {
      Logger.logError(e);
    }
  }
Exemplo n.º 17
0
  public void run() {
    Connection conn = null;
    DTOSet messages = null;
    SfMsgDefineDTO message = null;
    int msgCount = 0;
    DTOSet sendInfos = null;
    SfMsgSendInfoDTO sendDTO = null;
    String cellPhone = "";

    boolean needSend = false;
    System.out.println("启动消息服务...");
    while (true) {
      try {
        sleep(300000);

        AmsEmailSend send = new AmsEmailSend();
        send.sendEmail();

        conn = DBManager.getDBConnection();
        msgProcessService.finishMessages(conn); // 更新已经处理过的消息的状态。

        messages = msgProcessService.getNeedSendMessages(conn);
        if (messages == null || messages.isEmpty()) {
          continue;
        }
        msgCount = messages.getSize();
        for (int i = 0; i < msgCount; i++) {
          message = (SfMsgDefineDTO) messages.getDTO(i);
          sendInfos = msgProcessService.getMsgSendInfos(conn, message);
          if (sendInfos == null || sendInfos.isEmpty()) {
            continue;
          }
          sendService.setMessage(message.getMsgContent());
          for (int j = 0; j < sendInfos.getSize(); j++) {
            sendDTO = (SfMsgSendInfoDTO) sendInfos.getDTO(j);
            cellPhone = sendDTO.getMsgCellPhone();

            needSend = msgProcessService.needSend(conn, sendDTO);

            if (needSend) { // 需要发送
              sendService.addPhoneNum(cellPhone);
              if (sendService.getPhoneCount() >= sendService.getMaxPhoneNum()) {
                sendService.sendMessage();
                sendService.clearPhoneList();
              }
            }
            if (needSend) {
              msgProcessService.processSendLog(conn, sendDTO, cellPhone);
            }
          }
          if (sendService.getPhoneCount() > 0) {
            sendService.sendMessage();
            sendService.clearPhoneList();
          }
        }
      } catch (PoolException ex) {
        ex.printLog();
      } catch (InterruptedException ex) {
        Logger.logError(ex);
      } catch (QueryException ex) {
        ex.printLog();
      } catch (DataHandleException ex) {
        ex.printLog();
      } catch (OutOfBoundsException ex) {
        Logger.logError(ex);
      } catch (NoSuchProviderException e) {
        Logger.logError(e);
      } finally {
        DBManager.closeDBConnection(conn);
      }
    }
  }