/** * Gets the url parameters that will need to be present for every request. * * @param arrivalDate The arrival date for this request. * @param departureDate The departure date for this request. * @return The above parameters plus the cid, apikey, minor rev, and customer user agent url * parameters. */ public static List<NameValuePair> getBasicUrlParameters( final LocalDate arrivalDate, final LocalDate departureDate) { final List<NameValuePair> params = CommonParameters.asNameValuePairs(); if (arrivalDate != null) { params.add(new BasicNameValuePair("arrivalDate", DATE_TIME_FORMATTER.print(arrivalDate))); } if (departureDate != null) { params.add(new BasicNameValuePair("departureDate", DATE_TIME_FORMATTER.print(departureDate))); } return params; }
public int[] insertTransmit(List insertList, CommonParameters commonParas) throws Exception { List<Empsalaryconfig> originalList = insertList; Employee currEmp = commonParas.getCurrEmp(); int[] result = {0, 0}; SysConfigManager dbConfigManager = DatabaseSysConfigManager.getInstance(); String updateConf = dbConfigManager.getProperty("sys.salary.config.update"); Map jobgradeMap = getJobgradeMap(); Map empsalaryacctMap = getEsaNameVersionMap(); Map itemsMap = createAcctItemsMap(); Map empDbMap = getEmployeeMap(); Map escDbMap = new HashMap(); escDbMap = getEmpsalaryconfigMap(); List<Empsalaryconfig> configList = new ArrayList(); int rowNum = 1 - commonParas.getInmatchModel().getImmNoTitle().intValue(); for (Empsalaryconfig newConfig : originalList) { ++rowNum; Employee employee = newConfig.getEmployee(); if ((employee == null) || (employee.getEmpDistinctNo() == null)) { commonParas.addErrorMessage( this.msgNoNull, Integer.valueOf(rowNum), new String[] {Empsalaryconfig.PROP_EMPLOYEE + "." + Employee.PROP_EMP_DISTINCT_NO}); } else if (!empDbMap.containsKey(newConfig.getEmployee().getEmpDistinctNo())) { commonParas.addErrorMessage( this.msgNotExist, Integer.valueOf(rowNum), new String[] {Empsalaryconfig.PROP_EMPLOYEE + "." + Employee.PROP_EMP_DISTINCT_NO}); } else { Employee emp = (Employee) empDbMap.get(employee.getEmpDistinctNo()); newConfig.setEmployee(emp); newConfig.setId(emp.getId()); } Empsalaryconfig oldConfig = (Empsalaryconfig) escDbMap.get(newConfig.getId()); if (oldConfig != null) { if ("0".equals(updateConf)) { commonParas.addMessage( this.msgDbRepeat, Integer.valueOf(1), Integer.valueOf(rowNum), new String[0]); result[1] += 1; } oldConfig.decryEmpSalaryConf(oldConfig); commonParas.copy1To2(newConfig, oldConfig); newConfig = oldConfig; } Jobgrade jobgrade = newConfig.getEscJobgrade(); if ((jobgrade == null) || (jobgrade.getJobGradeName() == null)) commonParas.addErrorMessage( this.msgNoNull, Integer.valueOf(rowNum), new String[] {Empsalaryconfig.PROP_ESC_JOBGRADE + "." + Jobgrade.PROP_JOB_GRADE_NAME}); else if (!jobgradeMap.containsKey(jobgrade.getJobGradeName())) commonParas.addErrorMessage( this.msgNotExist, Integer.valueOf(rowNum), new String[] {Empsalaryconfig.PROP_ESC_JOBGRADE + "." + Jobgrade.PROP_JOB_GRADE_NAME}); else { newConfig.setEscJobgrade((Jobgrade) jobgradeMap.get(jobgrade.getJobGradeName())); } Empsalaryacctversion esav = newConfig.getEscEsavId(); if ((esav == null) || (esav.getEsavEsac() == null) || (esav.getEsavEsac().getEsacName() == null)) { commonParas.addErrorMessage( this.msgNoNull, Integer.valueOf(rowNum), new String[] { "escEsavId." + Empsalaryacctversion.PROP_ESAV_ESAC + "." + Empsalaryacct.PROP_ESAC_NAME }); } else if (!empsalaryacctMap.containsKey(esav.getEsavEsac().getEsacName())) { commonParas.addErrorMessage( this.msgNotExist, Integer.valueOf(rowNum), new String[] { "escEsavId." + Empsalaryacctversion.PROP_ESAV_ESAC + "." + Empsalaryacct.PROP_ESAC_NAME }); } else { newConfig.setEscEsavId( (Empsalaryacctversion) empsalaryacctMap.get(esav.getEsavEsac().getEsacName())); newConfig.setAcctItems((List) itemsMap.get(newConfig.getEscEsavId().getId())); } if (newConfig.getEscBankAccountNo() == null) { commonParas.addErrorMessage( this.msgNoNull, Integer.valueOf(rowNum), new String[] {Empsalaryconfig.PROP_ESC_BANK_ACCOUNT_NO}); } List acctItems = newConfig.getAcctItems(); for (int i = 0; i < acctItems.size(); ++i) { Integer isCalc = ((Empsalaryacctitems) acctItems.get(i)).getEsaiDataIsCalc(); try { if ((isCalc.intValue() == 1) || (isCalc.intValue() == 2)) PropertyUtils.setProperty(newConfig, "escColumn" + (i + 1), new BigDecimal("0.00")); } catch (Exception e) { e.printStackTrace(); } } configList.add(newConfig); } if (commonParas.getIoMessages().hasErrorMsg()) { return result; } this.salaryconfBo.interpretConfig( (Empsalaryconfig[]) configList.toArray(new Empsalaryconfig[configList.size()])); result[0] = configList.size(); for (Empsalaryconfig newConfig : configList) { this.salaryconfBo.saveOrUpdateEsc(newConfig, currEmp.getId(), newConfig.getEmployee()); } return result; }