public boolean censored(int id, boolean pass) { boolean flag; PaidDetail paidDetail = paidDao.find(id); paidDetail.setCensored(pass ? Constants.CENSORED_PASS : Constants.CENSORED_REFUSE); flag = paidDao.update(paidDetail); if (flag) { log.debug(MyFactory.getUserService().getCurrentUserName() + " censored " + paidDetail); } return flag; }
private List<PaidDetail> selectFruit(List<PaidDetail> list, int fid) { List<PaidDetail> result = new ArrayList<PaidDetail>(); for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { PaidDetail paidDetail = (PaidDetail) iterator.next(); if (fid == paidDetail.getFid()) { result.add(paidDetail); } } return result; }
public boolean update(PaidDetail paidDetail) { int id = paidDetail.getId(); boolean flag = false; PaidDetail old = paidDao.find(id); if (MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.CENSORED)) { paidDetail.setCensored(Constants.CENSORED_PASS); } else { paidDetail.setCensored(Constants.CENSORED_ORIGINAL); } if (flag) { log.debug( MyFactory.getUserService().getCurrentUserName() + " update " + old + " to " + paidDetail); } return flag; }
public boolean create(PaidDetail paidDetail) { paidDetail.setUid(MyFactory.getCurrentUser().getId()); if (MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.CENSORED)) { paidDetail.setCensored(Constants.CENSORED_PASS); } boolean flag = paidDao.create(paidDetail); if (flag) { log.info(MyFactory.getUserService().getCurrentUserName() + " create " + paidDetail); if (paidDetail.getDiscount() != -1) { OutDetailService outDetailService = MyFactory.getOutDetailService(); outDetailService.paid(paidDetail); } } return flag; }