示例#1
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getSource() == table && e.getClickCount() == 2) {
     // 表格
     String id = table.getValueAt(table.getSelectedRow(), -1).toString();
     try {
       TUser user = tUserService.getByIdService(id);
       if (user == null) {
         JOptionPane.showMessageDialog(null, "当前会员不存在");
         return;
       }
       menberDetailDialog = new MenberDetailDialog(null, "会员详细", true);
       menberDetailDialog.showDialog(user);
     } catch (Exception e1) {
       e1.printStackTrace();
     }
   }
 }
示例#2
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == queryButton) {
      // 查询
      this.termQuery(1);
    } else if (e.getSource() == showButton) {
      // 查看详细
      if (table.getSelectedRow() != -1) {
        String userID = (String) table.getValueAt(table.getSelectedRow(), -1);
        try {
          TUser tUser = tUserService.getByIdService(userID);
          menberDetailDialog = new MenberDetailDialog(null, "会员详细信息", true);
          menberDetailDialog.showDialog(tUser);
        } catch (Exception e1) {
          e1.printStackTrace();
        }
      } else {
        JOptionPane.showMessageDialog(null, "请先选择行数据");
      }
    } else if (e.getSource() == dGiftButton) {
      // 兑换礼品
      if (table.getSelectedRow() != -1) {
        String userID = (String) table.getValueAt(table.getSelectedRow(), -1);
        try {
          TUser tUser = tUserService.getByIdService(userID);
          tUser.setUserID(userID);
          memberDGiftDialog = new MemberDGiftDialog(null, "兑换礼品", true);
          memberDGiftDialog.showDialog(tUser);
        } catch (Exception e1) {
          e1.printStackTrace();
        }
      } else {
        JOptionPane.showMessageDialog(null, "请先选择行数据");
      }
    } else if (e.getSource() == levelButton) {
      // 设置会员级别
      if (table.getSelectedRow() != -1) {
        boolean[] bools = memberQueryCardModel.getBools();
        boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true
        for (int i = bools.length - 1; i >= 0; --i) {
          if (bools[i]) {
            select = true;
            break;
          }
        }
        if (!select) {
          JOptionPane.showMessageDialog(null, "请先选择用户!");
          return;
        } else {
          try {
            // TUser tUser = tUserService.getByIdService(userID);

            List<TUser> tUserList = memberQueryCardModel.getTCommodityList();
            List<TUser> tUserListOn = new ArrayList();
            for (int i = 0; i < tUserList.size(); i++) {
              if (bools[i]) {
                tUserListOn.add(tUserList.get(i));
              }
            }
            memberLevelPanel = new MemberLevelPanel(null, "设置会员级别", true);
            memberLevelPanel.showDialog(tUserListOn);
            table.updateUI();
          } catch (Exception e1) {
            e1.printStackTrace();
          }
        }
      } else {
        JOptionPane.showMessageDialog(null, "请先选择行数据");
      }
    } else if (e.getSource() == giftButton) {
      // 送礼品
      if (table.getSelectedRow() != -1) {
        boolean[] bools = memberQueryCardModel.getBools();
        boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true
        for (int i = bools.length - 1; i >= 0; --i) {
          if (bools[i]) {
            select = true;
            break;
          }
        }
        if (!select) {
          JOptionPane.showMessageDialog(null, "请先选择用户!");
          return;
        } else {
          try {
            // TUser tUser = tUserService.getByIdService(userID);

            List<TUser> tUserList = memberQueryCardModel.getTCommodityList();
            List<TUser> tUserListOn = new ArrayList();
            for (int i = 0; i < tUserList.size(); i++) {
              if (bools[i]) {
                tUserListOn.add(tUserList.get(i));
              }
            }
            memberGiftSend = new MemberGiftSend(null, "会员赠送礼品", true);
            memberGiftSend.showDialog(tUserListOn);
            table.updateUI();
          } catch (Exception e1) {
            e1.printStackTrace();
          }
        }
      } else {
        JOptionPane.showMessageDialog(null, "请先选择行数据");
      }
    } else if (e.getSource() == pointButton) {
      // 送积分
      if (table.getSelectedRow() != -1) {
        boolean[] bools = memberQueryCardModel.getBools();
        boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true
        for (int i = bools.length - 1; i >= 0; --i) {
          if (bools[i]) {
            select = true;
            break;
          }
        }
        if (!select) {
          JOptionPane.showMessageDialog(null, "请先选择用户!");
          return;
        } else {
          try {
            // TUser tUser = tUserService.getByIdService(userID);

            List<TUser> tUserList = memberQueryCardModel.getTCommodityList();
            List<TUser> tUserListOn = new ArrayList();
            for (int i = 0; i < tUserList.size(); i++) {
              if (bools[i]) {
                // Object obj1=tUserList.get(i);
                tUserListOn.add(tUserList.get(i));
                // TRoleRight roleRight=new TRoleRight();
                // roleRight.setTRight((TRight)obj1);
              }
            }
            memberPointSend = new MemberPointSend(null, "会员赠送积分", true);
            memberPointSend.showDialog(tUserListOn);
            table.updateUI();
          } catch (Exception e1) {
            e1.printStackTrace();
          }
        }
      } else {
        JOptionPane.showMessageDialog(null, "请先选择行数据");
      }
    } else if (e.getSource() == cashButton) {
      // 送优惠
      if (table.getSelectedRow() != -1) {
        boolean[] bools = memberQueryCardModel.getBools();
        boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true
        for (int i = bools.length - 1; i >= 0; --i) {
          if (bools[i]) {
            select = true;
            break;
          }
        }
        if (!select) {
          JOptionPane.showMessageDialog(null, "请先选择用户!");
          return;
        } else {
          try {
            // TUser tUser = tUserService.getByIdService(userID);

            List<TUser> tUserList = memberQueryCardModel.getTCommodityList();
            List<TUser> tUserListOn = new ArrayList();
            for (int i = 0; i < tUserList.size(); i++) {
              if (bools[i]) {
                // Object obj1=tUserList.get(i);
                tUserListOn.add(tUserList.get(i));
                // TRoleRight roleRight=new TRoleRight();
                // roleRight.setTRight((TRight)obj1);
              }
            }
            memberCashSend = new MemberCashSend(null, "会员赠送优惠卷", true);
            memberCashSend.showDialog(tUserListOn);
            table.updateUI();
          } catch (Exception e1) {
            e1.printStackTrace();
          }
        }
      } else {
        JOptionPane.showMessageDialog(null, "请先选择行数据");
      }
    } else if (e.getSource() == chargeButton) {
      // 充值
      if (table.getSelectedRow() != -1) {
        // String userID = (String)table.getValueAt(table.getSelectedRow(), 0);
        boolean[] bools = memberQueryCardModel.getBools();
        boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true
        for (int i = bools.length - 1; i >= 0; --i) {
          if (bools[i]) {
            select = true;
            break;
          }
        }
        if (!select) {
          JOptionPane.showMessageDialog(null, "请先选择用户!");
          return;
        } else {
          try {
            // TUser tUser = tUserService.getByIdService(userID);

            List<TUser> tUserList = memberQueryCardModel.getTCommodityList();
            List<TUser> tUserListOn = new ArrayList();
            for (int i = 0; i < tUserList.size(); i++) {
              if (bools[i]) {
                // Object obj1=tUserList.get(i);
                tUserListOn.add(tUserList.get(i));
                // TRoleRight roleRight=new TRoleRight();
                // roleRight.setTRight((TRight)obj1);
              }
            }
            memberChargeDetailDialog = new MemberChargeDetailDialog(null, "会员充值", true);
            memberChargeDetailDialog.showDialog(tUserListOn);
            table.updateUI();
          } catch (Exception e1) {
            e1.printStackTrace();
          }
        }
      } else {
        JOptionPane.showMessageDialog(null, "请先选择行数据");
      }
    } else if (e.getSource() == memberDetailButton) {
      // 查看会员行为
      if (table.getSelectedRow() != -1) {
        String userID = (String) table.getValueAt(table.getSelectedRow(), -1);
        try {
          TUser tUser = tUserService.getByIdService(userID);
          tUser.setUserID(userID);
          memberBehaviorDialog = new MemberBehaviorDialog(null, "会员行为", true);
          memberBehaviorDialog.showDialog(tUser);
        } catch (Exception e1) {
          e1.printStackTrace();
        }
      } else {
        JOptionPane.showMessageDialog(null, "请先选择行数据");
      }
    } else if (e.getSource() == noticeButton) {
      // 通知
      if (table.getSelectedRow() != -1) {
        boolean[] bools = memberQueryCardModel.getBools();
        boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true
        for (int i = bools.length - 1; i >= 0; --i) {
          if (bools[i]) {
            select = true;
            break;
          }
        }
        if (!select) {
          JOptionPane.showMessageDialog(null, "请先选择用户!");
          return;
        } else {
          try {

            List<TUser> tUserList = memberQueryCardModel.getTCommodityList();
            List<TUser> tUserListOn = new ArrayList();
            for (int i = 0; i < tUserList.size(); i++) {
              if (bools[i]) {
                tUserListOn.add(tUserList.get(i));
              }
            }
            memberNoticeDetailDialog = new MemberNoticeDetailDialog(null, "通知会员", true);
            memberNoticeDetailDialog.showDialog(tUserListOn);
            table.updateUI();
          } catch (Exception e1) {
            e1.printStackTrace();
          }
        }
      } else {
        JOptionPane.showMessageDialog(null, "请先选择行数据");
      }
    } else if (e.getSource() == clearButton) {
      // 清空
      cardNumTF.getText().setText("");
      nameTF.getText().setText("");
      tel.getText().setText("");
      startTimeTF.setDate(null);
      timeTF.setDate(null);
    }
  }