public void init() { JPanel main_jp = new BorderJPanel(); BoxLayout boxLayout = new BoxLayout(main_jp, BoxLayout.Y_AXIS); main_jp.setLayout(boxLayout); main_jp.setBackground(Util.PANEL_COLOR); number = new JLabelJTextFieldComponent(" *", "仓库编号:", 30); name = new JLabelJTextFieldComponent(" *", "仓库名称:", 30); location = new JLabelJTextFieldComponent(" *", "仓库地址:", 30); manager = new JLabelJComboBoxComponent("*", "仓库管理员:", new String[] {}, 188); manager.addElement(new IDNameBean("0", "请选择")); priority = new JLabelJTextFieldComponent("*", "仓库优先级:", "(数字越大,越在前面)", 15); note = new JLabelJTextAreaComponent(" 备 注:", 23, 3); number.getText().setText(UUID.GenUUID15()); number.getText().setEditable(false); priority.getText().setText("0"); main_jp.add(number); main_jp.add(name); main_jp.add(location); main_jp.add(manager); main_jp.add(priority); main_jp.add(note); JPanel p1 = new JPanel(); sureButton = new RPJButtonWhite("保存(Ctrl+S)"); cancelButton = new RPJButtonWhite("取消(Ctrl+Q)"); p1.add(sureButton); p1.add(cancelButton); p1.setOpaque(false); main_jp.add(p1); this.add(main_jp); main_jp.setCursor(Util.CURSOR_DEFAULT); }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == sureButton) { Boolean isShow = false; // 确定 String fillMoneyT = fillMoneyTF.getText().getText().trim(); // 充值金额 String giftMoneyT = giftMoneyTF.getText().getText().trim(); // 赠送金额 if (!MatcherFormatUtil.MatcherPriceScheme(fillMoneyT)) { JOptionPane.showMessageDialog(null, "充值金额 不能为空,且小数点左边最多10位数字,右边最多2位数字"); fillMoneyTF.getText().setText(""); fillMoneyTF.getText().requestFocus(); return; } if (!MatcherFormatUtil.MatcherPriceScheme(giftMoneyT)) { JOptionPane.showMessageDialog(null, "请在充值金额栏点击回车获取赠送金额!"); giftMoneyTF.getText().setText(""); giftMoneyTF.getText().requestFocus(); return; } for (int i = 0; i < tUser.size(); i++) { if (giftMoneyTF.getText().getText().trim() != "") { Double totalMoney = Double.parseDouble(giftMoneyTF.getText().getText().trim()) + Double.parseDouble(fillMoneyT); tUser.get(i).setMoney(totalMoney + tUser.get(i).getMoney()); } else { tUser.get(i).setMoney(Double.parseDouble(fillMoneyT)); } try { Date date = new Date(); if (tUserService.modifyRechargeService(tUser.get(i))) { BuildSpringApplication.getInstance() .getTOpLogServiceImpl() .addOpLogService("会员充值,卡号为:+" + tUser.get(i).getCardNum() + ",充值金额:" + fillMoneyT); TShopRecharge tShopRecharge = new TShopRecharge(); // 添加明细 tShopRecharge.setRechargeID(UUID.GenUUID15()); tShopRecharge.setUserID(userID); // 单据编号CHAR(15) tShopRecharge.setChargeRuleID(""); tShopRecharge.setHappenTime(date); tShopRecharge.setMoney(Double.parseDouble(fillMoneyT)); tShopRecharge.setGiftMoney(Double.parseDouble(giftMoneyTF.getText().getText().trim())); tShopRechargeService.saveService(tShopRecharge); // 添加资金出入 ApplicationContext.addMondyInOut( ApplicationContext.MONEYINOUT_TYPE_IN, ApplicationContext.OPERATOR_ID, ApplicationContext.MONEYINOUT_SOURCE_TYPE5, tShopRecharge.getRechargeID()); isShow = true; } } catch (Exception e1) { isShow = false; e1.printStackTrace(); } } if (isShow) { JOptionPane.showMessageDialog(null, "充值成功!"); this.dispose(); } else { JOptionPane.showMessageDialog(null, "数据异常。"); } } else if (e.getSource() == cancelButton) { this.dispose(); } }