private void save() {
        String date = date_jtf.getText();
        if ("".equals(date)) {
            JOptionPane.showMessageDialog(null, "日期必须填");
            return;
        }
        String price = money_jtf.getText();
        if ("".equals(price)) {
            JOptionPane.showMessageDialog(null, "花费必须填");
            return;
        }
        String desc = desc_jta.getText();

        Consumption consumption = new Consumption();
        consumption.setCreateAt(date);
        try {
            consumption.setMoney(Double.parseDouble(price));
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null, "花费必须是数字");
            return;
        }
        consumption.setDesc(desc);
        consumption.setColor(color.getBackground().getRGB());

        boolean flag = false;
        if (cid == -1) {
            flag = MyFactory.getConsumptionService().create(consumption);
        } else {
            consumption.setId(cid);
            consumption.setUid(uid);
            flag = MyFactory.getConsumptionService().update(consumption);
        }

        if (flag) {
            if (cid != -1) {
                JOptionPane.showMessageDialog(null, "修改成功");
            } else {
                int result = JOptionPane.showConfirmDialog(null, "增加成功，再增加一条？");
                if (result == JOptionPane.YES_OPTION) {
                    reset();
                }
            }
        } else {
            JOptionPane.showMessageDialog(null, "增加失败，请重试！");
        }
    }