@Override public boolean submit() { // TODO Auto-generated method stub ArrayList<BaccountPO> accountList = new ArrayList<BaccountPO>(); accountList = findAll(); MoneyOutListDataService od = DataFactory.getMoneyOutListData(); if (!moneyOutListList.isEmpty()) { for (int i = 0; i < moneyOutListList.size(); i++) { MoneyOutListVO vo = moneyOutListList.get(i); MoneyOutListPO po = new MoneyOutListPO( vo.getId(), vo.getTime(), vo.getMoney(), vo.getName(), vo.getAccount(), vo.getEntry(), vo.getNote(), vo.getLst()); try { result = od.insert(po); } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } for (int l = 0; l < accountList.size(); l++) { if (po.getAccount().getName().equals(accountList.get(l).getName())) { double balance = Double.parseDouble(accountList.get(l).getBalance()); balance -= po.getMoney(); accountList.get(l).setBalance(balance + ""); } } } updata(accountList); moneyOutListList.clear(); count = 0; return result; } else return false; }
@Override public long myGetListId(TimePO time) { MoneyOutListDataService od = DataFactory.getMoneyOutListData(); if (time.getHour() >= 10) { preFour = time.getHour() + ""; } else { preFour = "0" + time.getHour(); } if (time.getMin() >= 10) preFour += (time.getMin() + ""); else preFour += ("0" + time.getMin()); try { lastFour = (od.findLast().getId() + 1) + ""; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } lastFour = lastFour.substring(6); return Long.parseLong(preFour + "03" + lastFour); }