public String preEditMyCustomer() throws Exception {
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();

    String json = "";
    String ids = request.getParameter("pid").trim();
    String shop_no = ids.split("\\|")[0];
    String pos_no = ids.split("\\|")[1];
    String pan = ids.split("\\|")[2];
    ArrayList<String> arrayList = new ArrayList<String>();
    arrayList.add("shop_no,string," + shop_no);
    arrayList.add("pos_no,string," + pos_no);
    arrayList.add("pan,string," + pan);
    List myCustomerList = myCustomerBean.execHql("myCustomer", "findMyCustomer", arrayList);
    MyCustomer mc = new MyCustomer();
    if (myCustomerList != null && !myCustomerList.isEmpty()) {
      mc = (MyCustomer) myCustomerList.get(0);
    }
    json = JsonFormat.objectToJson(mc);
    // 需要加商户名称
    Shop s = new Shop();
    arrayList.clear();
    arrayList.add("shop_no,string," + mc.getShop_no().trim());
    List shopList = myCustomerBean.execHql("shop", "findShop", arrayList);
    if (shopList != null && !shopList.isEmpty()) {
      s = (Shop) shopList.get(0);
      json += ",shop_name:'" + s.getShop_name() + "'";
    }
    response.setContentType("text/html;charset=utf-8");
    response.getWriter().write(json);
    return null;
  }
  public String saveMyCustomer() throws Exception {
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();

    String json = "";

    String flag = StringUtil.formatNullString(request.getParameter("flag"));
    String ischeck = StringUtil.formatNullString(request.getParameter("ischeck"));
    ArrayList<String> arrayList = new ArrayList<String>();
    arrayList.add("shop_no,string," + myCustomer.getShop_no().trim());
    arrayList.add("pos_no,string," + myCustomer.getPos_no().trim());
    arrayList.add("pan,string," + myCustomer.getPan().trim());
    List myCustomerList = myCustomerBean.execHql("myCustomer", "findMyCustomer", arrayList);

    MyCustomer mc = null;
    if (myCustomerList != null && !myCustomerList.isEmpty()) {
      mc = (MyCustomer) myCustomerList.get(0);
    }
    if (!flag.equalsIgnoreCase("edit") && mc != null) {
      json = DATA_EXIST_EXCEPTION; // 数据存在异常
    } else {
      if (flag.equalsIgnoreCase("new") && !ischeck.equalsIgnoreCase("check")) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        SimpleDateFormat timeFormat = new SimpleDateFormat("HHmmss");
        Date now = new Date();
        String nowDate = dateFormat.format(now);
        // 加上rec_no
        String rec_no = myCustomerBean.getMaxId("myCustomer", "getMaxId", null);
        myCustomer.setRec_no(Integer.parseInt(rec_no));
        myCustomer.setRegister_date(nowDate);
        myCustomerBean.addData(myCustomer);
        json = SAVE_SUCCESS;
      }
      if (flag.equalsIgnoreCase("edit") && !ischeck.equalsIgnoreCase("check")) {
        myCustomer.setShop_no(mc.getShop_no());
        myCustomer.setPos_no(mc.getPos_no());
        myCustomer.setPan(mc.getPan());
        myCustomer.setRec_no(mc.getRec_no());

        myCustomer.setRegister_date(mc.getRegister_date());

        myCustomerBean.updateData(myCustomer);
        json = UPDATE_SUCCESS;
      }
      if (ischeck.equalsIgnoreCase("check")) {
        json = JsonFormat.outputJson(true, "", "");
      }
    }
    response.setContentType("text/html;charset=utf-8");
    response.getWriter().write(json);
    return null;
  }