Exemplo n.º 1
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      HttpSession session = request.getSession();
      PrintWriter out = response.getWriter();
      businessComment demo = new businessComment();
      demo.setPath(request);
      Email mail = new Email();
      nseer_db_backup1 design_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 intrmanufacture_db = new nseer_db_backup1(dbApplication);
      if (design_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && intrmanufacture_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String kind_chain = request.getParameter("kind_chain");
        String chain_id = Divide1.getId(kind_chain);
        String chain_name = Divide1.getName(kind_chain);
        String provider_ID =
            NseerId.getId("intrmanufacture/file", (String) dbSession.getAttribute("unit_db_name"));
        String intrmanufacturer = request.getParameter("intrmanufacturer");
        String intrmanufacturer_ID = request.getParameter("intrmanufacturer_ID");
        String provider_name = request.getParameter("provider_name");
        String provider_address = request.getParameter("provider_address");
        String type = request.getParameter("type");
        String provider_class = request.getParameter("class1");
        String used_provider_name = request.getParameter("used_provider_name");
        String provider_bank = request.getParameter("provider_bank");
        String provider_account = request.getParameter("provider_account");
        String provider_web = request.getParameter("provider_web");
        String provider_tel1 = request.getParameter("provider_tel1");
        String provider_fax = request.getParameter("provider_fax");
        String provider_postcode = request.getParameter("provider_postcode");
        String contact_person1 = request.getParameter("contact_person1");
        String contact_person1_department = request.getParameter("contact_person1_department");
        String contact_person1_duty = request.getParameter("contact_person1_duty");
        String contact_person1_sex = request.getParameter("contact_person1_sex");
        String contact_person1_office_tel = request.getParameter("contact_person1_office_tel");
        String contact_person1_home_tel = request.getParameter("contact_person1_home_tel");
        String contact_person1_mobile = request.getParameter("contact_person1_mobile");
        String contact_person1_email = request.getParameter("contact_person1_email");
        String contact_person2 = request.getParameter("contact_person2");
        String contact_person2_department = request.getParameter("contact_person2_department");
        String contact_person2_duty = request.getParameter("contact_person2_duty");
        String contact_person2_sex = request.getParameter("contact_person2_sex");
        String contact_person2_office_tel = request.getParameter("contact_person2_office_tel");
        String contact_person2_home_tel = request.getParameter("contact_person2_home_tel");
        String contact_person2_mobile = request.getParameter("contact_person2_mobile");
        String contact_person2_email = request.getParameter("contact_person2_email");
        String register = request.getParameter("register");
        String register_time = request.getParameter("register_time");
        String bodyc = new String(request.getParameter("invoice_info").getBytes("UTF-8"), "UTF-8");
        String invoice_info = exchange.toHtml(bodyc);
        String bodya =
            new String(request.getParameter("demand_products").getBytes("UTF-8"), "UTF-8");
        String demand_products = exchange.toHtml(bodya);
        try {
          if (!chain_id.equals("")) {
            String sqll =
                "select * from intrmanufacture_file where provider_ID='"
                    + provider_ID
                    + "' and provider_name='"
                    + provider_name
                    + "'";
            ResultSet rset = intrmanufacture_db.executeQuery(sqll);
            if (rset.next()) {
              response.sendRedirect("portal/oem/register1_ok_a.jsp");
            } else {
              String sql =
                  "insert into intrmanufacture_file(chain_id,chain_name,provider_ID,provider_name,provider_address,provider_class,type,provider_bank,provider_account,provider_web,provider_tel1,provider_fax,provider_postcode,used_provider_name,contact_person1,contact_person1_department,contact_person1_duty,contact_person1_sex,contact_person1_office_tel,contact_person1_home_tel,contact_person1_mobile,contact_person1_email,contact_person2,contact_person2_department,contact_person2_duty,contact_person2_sex,contact_person2_office_tel,contact_person2_home_tel,contact_person2_mobile,contact_person2_email,register,register_time,invoice_info,demand_products,check_tag,modify_tag,excel_tag,intrmanufacturer,intrmanufacturer_ID) values ('"
                      + chain_id
                      + "','"
                      + chain_name
                      + "','"
                      + provider_ID
                      + "','"
                      + provider_name
                      + "','"
                      + provider_address
                      + "','"
                      + provider_class
                      + "','"
                      + type
                      + "','"
                      + provider_bank
                      + "','"
                      + provider_account
                      + "','"
                      + provider_web
                      + "','"
                      + provider_tel1
                      + "','"
                      + provider_fax
                      + "','"
                      + provider_postcode
                      + "','"
                      + used_provider_name
                      + "','"
                      + contact_person1
                      + "','"
                      + contact_person1_department
                      + "','"
                      + contact_person1_duty
                      + "','"
                      + contact_person1_sex
                      + "','"
                      + contact_person1_office_tel
                      + "','"
                      + contact_person1_home_tel
                      + "','"
                      + contact_person1_mobile
                      + "','"
                      + contact_person1_email
                      + "','"
                      + contact_person2
                      + "','"
                      + contact_person2_department
                      + "','"
                      + contact_person2_duty
                      + "','"
                      + contact_person2_sex
                      + "','"
                      + contact_person2_office_tel
                      + "','"
                      + contact_person2_home_tel
                      + "','"
                      + contact_person2_mobile
                      + "','"
                      + contact_person2_email
                      + "','"
                      + register
                      + "','"
                      + register_time
                      + "','"
                      + invoice_info
                      + "','"
                      + demand_products
                      + "','0','0','1','"
                      + intrmanufacturer
                      + "','"
                      + intrmanufacturer_ID
                      + "')";
              intrmanufacture_db.executeUpdate(sql);
              String[] email_box = {contact_person1_email};
              mail.send(
                  email_box,
                  "smtp.sina.com.cn",
                  "*****@*****.**",
                  "123456",
                  demo.getLang("erp", "注册信息"),
                  "欢迎您注册成为我们的委外厂商,您的档案编号是:" + provider_ID);

              CdefineUpdate CdefineUpdate = new CdefineUpdate();
              sql =
                  CdefineUpdate.update("intrmanufacture_file", "provider_ID", provider_ID, request);
              intrmanufacture_db.executeUpdate(sql);
              /** ************************************************** */
              List rsList = (List) new java.util.ArrayList();
              String[] elem = new String[3];
              sql =
                  "select id,describe1,describe2 from intrmanufacture_config_workflow where type_id='01'";
              rset = intrmanufacture_db.executeQuery(sql);
              while (rset.next()) {
                elem = new String[3];
                elem[0] = rset.getString("id");
                elem[1] = rset.getString("describe1");
                elem[2] = rset.getString("describe2");
                rsList.add(elem);
              }
              if (rsList.size() == 0) {
                sql =
                    "update intrmanufacture_file set check_tag='1' where provider_ID='"
                        + provider_ID
                        + "'";
                intrmanufacture_db.executeUpdate(sql);
              } else {
                Iterator ite = rsList.iterator();
                while (ite.hasNext()) {
                  elem = (String[]) ite.next();
                  sql =
                      "insert into intrmanufacture_workflow(config_id,object_ID,describe1,describe2) values ('"
                          + elem[0]
                          + "','"
                          + provider_ID
                          + "','"
                          + elem[1]
                          + "','"
                          + elem[2]
                          + "')";
                  intrmanufacture_db.executeUpdate(sql);
                }
              }
              response.sendRedirect(
                  "portal/oem/register1_choose_attachment.jsp?provider_ID=" + provider_ID + "");
            }
          } else {
            response.sendRedirect("portal/oem/register1_ok_b.jsp");
          }
        } catch (Exception ex) {
          out.println("error" + ex);
        }
        intrmanufacture_db.commit();
        design_db.commit();
        intrmanufacture_db.close();
        design_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Exemplo n.º 2
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();
    try {

      ServletContext application;
      HttpSession session = request.getSession();
      nseer_db_backup1 oa_db = new nseer_db_backup1(dbApplication);
      if (oa_db.conn((String) dbSession.getAttribute("unit_db_name"))) {

        Note note = new Note();
        Email mail = new Email();

        String meeting_ID = request.getParameter("meeting_ID");
        String checker = request.getParameter("checker");
        String checker_ID = request.getParameter("checker_ID");
        String check_time = request.getParameter("check_time");
        String cols_number = request.getParameter("cols_number");
        String[] check_type = request.getParameterValues("check_type");
        String[] chain_id = request.getParameterValues("chain_id");
        String send_type = "";
        if (check_type != null) {
          if (chain_id != null) {
            for (int i = 0; i < check_type.length; i++) {
              send_type += check_type[i] + ",";
            }
            send_type = send_type.substring(0, send_type.length() - 1);

            int n = 0;

            String[] email_box = new String[chain_id.length];
            n = 0;
            int p = 0;
            String subject = "";
            String content = "";
            String sql2 =
                "select * from oa_meeting where meeting_ID='" + meeting_ID + "' and check_tag='0'";
            ResultSet rs2 = oa_db.executeQuery(sql2);
            if (rs2.next()) {
              subject = rs2.getString("subject");
              content =
                  subject
                      + "时间:"
                      + rs2.getString("begin_time")
                      + "至"
                      + rs2.getString("end_time")
                      + "会议日程:"
                      + rs2.getString("schedule");
              for (int j = 0; j < chain_id.length; j++) {
                //	String checkbox_name="col"+j;
                //	String[] cols=request.getParameterValues(checkbox_name);
                if (!chain_id[j].equals("")) {
                  n++;
                  if (chain_id[j].indexOf("//") != -1) {
                    StringTokenizer token =
                        new StringTokenizer(
                            chain_id[j].substring(0, chain_id[j].length() - 2), "/");
                    while (token.hasMoreTokens()) {
                      String human_ID = token.nextToken();
                      String human_name = token.nextToken();
                      String sql =
                          "insert into oa_meeting_attend_details(meeting_ID,human_ID,human_name,human_major_first_kind_name,human_major_second_kind_name) values('"
                              + meeting_ID
                              + "','"
                              + human_ID
                              + "','"
                              + human_name
                              + "','','')";
                      oa_db.executeUpdate(sql);
                      String sql3 = "select * from hr_file where human_ID='" + human_ID + "'";
                      ResultSet rs3 = oa_db.executeQuery(sql3);
                      if (rs3.next()) {
                        email_box[p] = rs3.getString("human_email");
                        p++;
                        if (send_type.indexOf("发短信") != -1) {
                          note.send("bjnseer", "8888", rs3.getString("human_cellphone"), content);
                        }
                      }
                    }
                  } else if (chain_id[j].substring(chain_id[j].length() - 1).equals("/")) {
                    StringTokenizer token = new StringTokenizer(chain_id[j], "/");
                    while (token.hasMoreTokens()) {
                      String human_ID = token.nextToken();
                      String human_name = token.nextToken();
                      String human_major_first_kind_name = token.nextToken();
                      String sql =
                          "insert into oa_meeting_attend_details(meeting_ID,human_ID,human_name,human_major_first_kind_name,human_major_second_kind_name) values('"
                              + meeting_ID
                              + "','"
                              + human_ID
                              + "','"
                              + human_name
                              + "','"
                              + human_major_first_kind_name
                              + "','')";
                      oa_db.executeUpdate(sql);
                      String sql3 = "select * from hr_file where human_ID='" + human_ID + "'";
                      ResultSet rs3 = oa_db.executeQuery(sql3);
                      if (rs3.next()) {
                        email_box[p] = rs3.getString("human_email");
                        p++;
                        if (send_type.indexOf("发短信") != -1) {
                          note.send("bjnseer", "8888", rs3.getString("human_cellphone"), content);
                        }
                      }
                    }
                  } else {
                    StringTokenizer token = new StringTokenizer(chain_id[j], "/");
                    while (token.hasMoreTokens()) {
                      String human_ID = token.nextToken();
                      String human_name = token.nextToken();
                      String human_major_first_kind_name = token.nextToken();
                      String human_major_second_kind_name = token.nextToken();
                      String sql =
                          "insert into oa_meeting_attend_details(meeting_ID,human_ID,human_name,human_major_first_kind_name,human_major_second_kind_name) values('"
                              + meeting_ID
                              + "','"
                              + human_ID
                              + "','"
                              + human_name
                              + "','"
                              + human_major_first_kind_name
                              + "','"
                              + human_major_second_kind_name
                              + "')";
                      oa_db.executeUpdate(sql);
                      String sql3 = "select * from hr_file where human_ID='" + human_ID + "'";
                      ResultSet rs3 = oa_db.executeQuery(sql3);
                      if (rs3.next()) {
                        email_box[p] = rs3.getString("human_email");
                        p++;
                        if (send_type.indexOf("发短信") != -1) {
                          note.send("bjnseer", "8888", rs3.getString("human_cellphone"), content);
                        }
                      }
                    }
                  }
                }
              }
              if (send_type.indexOf("发邮件") != -1) {
                mail.send(
                    email_box, "smtp.sina.com.cn", "*****@*****.**", "123456", subject, content);
              }
              if (n == 0) {

                response.sendRedirect("oa/meeting/inform_ok_a.jsp");
              } else {
                String sql1 =
                    "update oa_meeting set checker='"
                        + checker
                        + "',checker_ID='"
                        + checker_ID
                        + "',check_time='"
                        + check_time
                        + "',check_tag='1' where meeting_ID='"
                        + meeting_ID
                        + "'";
                oa_db.executeUpdate(sql1);

                response.sendRedirect("oa/meeting/inform_ok_b.jsp");
              }
            } else {

              response.sendRedirect("oa/meeting/inform_ok_c.jsp");
            }
          } else {

            response.sendRedirect("oa/meeting/inform_ok_e.jsp");
          }
        } else {

          response.sendRedirect("oa/meeting/inform_ok_d.jsp");
        }
        oa_db.commit();
        oa_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }

    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }