예제 #1
0
  /* (non-Javadoc)
   * @see com.cloud.erp.dao.SalesContractDao#persistenceSalesContract(com.cloud.erp.entities.table.SalesContract, java.util.Map, java.util.Map)
   */
  @Override
  public boolean persistenceSalesContract(
      SalesContract salesContract,
      Map<String, List<SalesContractEntry>> entries,
      Map<String, List<SalesContractScheme>> schemes) {
    // TODO Auto-generated method stub
    Integer userId = Constants.getCurrentUser().getUserId();
    if (null == salesContract.getInterId() || "".equals(salesContract.getInterId())) {
      salesContract.setCreated(new Date());
      salesContract.setCreater(userId);
      salesContract.setLastmod(new Date());
      salesContract.setModifier(userId);
      salesContract.setStatus(Constants.PERSISTENCE_STATUS);
      baseDao.save(salesContract);
    } else {
      salesContract.setLastmod(new Date());
      salesContract.setModifier(userId);
      baseDao.update(salesContract);
    }
    this.addEntry(salesContract, entries.get(Constants.ENTRY_LIST_TYPE_ADD));
    this.updateEntry(entries.get(Constants.ENTRY_LIST_TYPE_UPD));
    this.delEntry(entries.get(Constants.ENTRY_LIST_TYPE_DEL));

    this.addScheme(salesContract, schemes.get(Constants.ENTRY_LIST_TYPE_ADD));
    this.updateScheme(schemes.get(Constants.ENTRY_LIST_TYPE_UPD));
    this.delScheme(schemes.get(Constants.ENTRY_LIST_TYPE_DEL));

    return true;
  }
예제 #2
0
 private boolean addScheme(SalesContract salesContract, List<SalesContractScheme> schemes) {
   Integer userId = Constants.getCurrentUser().getUserId();
   if (null != schemes && !schemes.isEmpty()) {
     for (SalesContractScheme salesContractScheme : schemes) {
       salesContractScheme.setContract(salesContract);
       salesContractScheme.setCreated(new Date());
       salesContractScheme.setCreater(userId);
       salesContractScheme.setLastmod(new Date());
       salesContractScheme.setModifier(userId);
       salesContractScheme.setStatus(Constants.PERSISTENCE_STATUS);
       baseDao.save(salesContractScheme);
     }
   }
   return true;
 }