Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
  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;
  }