Ejemplo n.º 1
0
 public String designerRZ() {
   try {
     User user = userDao.findById(Integer.parseInt(userId));
     user.setDesigner(1);
     String[] jbxxs = jbxxsStr.split(",");
     String[] qtxxtypes = qtxxtypesStr.split(",");
     String[] qtxxvalues = qtxxvaluesStr.split(",");
     System.out.println(jbxxs.length);
     System.out.println(qtxxtypes.length);
     System.out.println(qtxxvalues.length);
     // 添加基本信息
     Designer designer = new Designer();
     // 通过userId查找designer是否存在
     designer = designerDao.findByUserId(Integer.parseInt(userId));
     designer.setCompanyName(jbxxs[2]);
     designer.setEmail(jbxxs[6]);
     designer.setName(jbxxs[4]);
     designer.setPhone(jbxxs[5]);
     designer.setPosition(jbxxs[3]);
     designer.setState(1); // 待审核
     designer.setUser(user);
     designerDao.saveDesigner(designer);
     userDao.savaOrUpdateUser(user);
     // 保存一个活动信息(即:收费信息)
     Activity activity = activityDao.findByDesignerId(designer.getId());
     activity.setState(0);
     activity.setType(0);
     activity.setDesignerId(designer.getId());
     activityDao.saveActivity(activity);
     // 添加活动信息
     for (int i = 0; i < qtxxtypes.length; i++) {
       String leixing = qtxxtypes[i];
       String valuestr = qtxxvalues[i];
       if ("空".equals(leixing) && "空".equals(valuestr)) {
         continue;
       } else {
         Wordbook wb = wordbookDao.findByLNA("designer_housetype", leixing, activity.getId());
         wb.setActivityId(activity.getId());
         wb.setName(leixing);
         if (!"空".equals(valuestr)) {
           wb.setValue(valuestr);
         } else {
           wb.setValue("");
         }
         wb.setLeixing("designer_housetype");
         wordbookDao.saveWordbook(wb);
       }
     }
     ok = 1;
   } catch (Exception e) {
     e.printStackTrace();
     ok = 2;
   }
   return "success";
 }
Ejemplo n.º 2
0
  public String shenHeDesigner() {
    // 1.通过userId查询对应的设计者
    Designer d = designerDao.findByUserId(Integer.parseInt(userId));
    // 2.通过userId查询user
    User u = userDao.findById(Integer.parseInt(userId));
    d.setState(designerState);
    u.setDesigner(designerState);
    userDao.savaOrUpdateUser(u);
    designerDao.saveDesigner(d);
    ok = 1;

    return "success";
  }