Пример #1
0
 public void modifRetuenDefary(int i) {
   Defray def = defaryDao.findById(i);
   User user = def.getShopId().getUsers();
   user.setMoney(user.getMoney() + (long) (def.getMoney())); // 虚拟币退还
   userDao.save(user); // 保存用户信息
   defaryDao.delete(def); // 删除本次申请
 }
Пример #2
0
  public void addDefarys(Defray obj, int shopId) {
    Shop shop = shopDao.findById(shopId);
    if (shop != null) {
      obj.setShopId(shop);
      User user = shop.getUsers();
      user.setMoney(user.getMoney() - (long) (PriceFormat.formateFen(obj.getMoney()))); // 先减去申请的利润
      userDao.save(user);

      obj.setMoney(PriceFormat.formateFen(obj.getMoney())); // 把单位元转为分
      obj.setState(Constants.DEF_NO);
      obj.setCreateDate(System.currentTimeMillis());
      defaryDao.save(obj);
    }
  }