Пример #1
0
 /**
  * Description: 批量删除学生考试信息 根据IDS,并修改JX1009,并修改JX1008
  *
  * @param ids,xnxqh,kwlbbh,kcdms
  * @return
  */
 public void batchDeleteKsXsxx(
     String[] ids, String xnxqh, String kwlbbh, String kcdm, HttpServletRequest request) {
   StringBuffer hql = new StringBuffer("delete Jx1007 where ");
   for (int i = 0; i < ids.length; i++) {
     // 修改班级信息
     Xs0112 xs = this.findXs0112(ids[i].split(",")[1]);
     Jx1008 jx1008 = this.findJx1008(xnxqh, kwlbbh, xs.getBjbh());
     if (jx1008.getKsrs().intValue() - 1 == 0) {
       // 如果考试人数等于0,删除班级信息
       this.singleGenericHibernateDAO.makeTransient(jx1008);
     } else {
       jx1008.setKsrs(Long.valueOf((jx1008.getKsrs().intValue() - 1) + ""));
       this.singleGenericHibernateDAO.makePersistent(jx1008, request);
     }
     if (i == 0) {
       hql.append(" ksxsbmbh='" + ids[i].split(",")[0]).append("'");
     } else {
       hql.append(" or ksxsbmbh='" + ids[i].split(",")[0]).append("'");
     }
   }
   this.singleGenericHibernateDAO.deleteByHql(hql.toString(), null);
   // 修改JX1009课程信息
   Jx1009 jx = this.findjx1009(xnxqh, kwlbbh, kcdm);
   if (jx.getKsrs().intValue() - ids.length == 0) {
     this.singleGenericHibernateDAO.makeTransient(jx);
   } else {
     jx.setKsrs(Long.valueOf((jx.getKsrs().intValue() - ids.length) + ""));
     this.singleGenericHibernateDAO.makePersistent(jx, request);
   }
 }
Пример #2
0
 /**
  * Description: 根据多个学生编号,课程代码,学年学期,考试时间,教室编号,考务类别,教师编号,教师姓名,通知单ID
  *
  * @param xsbhs,kcdm,KwlbCode,jsbh
  * @return
  */
 public void saveXsxx(
     String xsbhs,
     String xnxqh,
     String KwlbCode,
     String kcdm,
     String kcmc,
     String jsbh,
     String jsxm,
     String tzdid,
     HttpServletRequest request) {
   // 想课程表中的考试人数中添加人数
   String[] xsbh = xsbhs.split(",");
   Jx1009 jx = this.findjx1009(xnxqh, KwlbCode, kcdm);
   if (jx != null) {
     jx.setKsrs(Long.valueOf((jx.getKsrs().intValue() + xsbh.length) + ""));
     this.singleGenericHibernateDAO.makePersistent(jx, request);
   } else {
     jx = new Jx1009();
     jx.setId(new Jx1009Id(new Jx02(kcdm), xnxqh, new ZzdKwlbdm(KwlbCode)));
     jx.setKcmc(kcmc);
     jx.setKsrs(Long.valueOf(xsbh.length + ""));
     jx.setIspk("1");
     this.singleGenericHibernateDAO.save(jx, request);
   }
   // 查找课程信息
   Jx02 jx02 = this.findJx02(kcdm);
   for (int i = 0; i < xsbh.length; i++) {
     // 查找学生
     Xs0112 xs0112 = this.findXs0112(xsbh[i]);
     // 查找班级
     Jx1008 jx1008 = this.findJx1008(xnxqh, KwlbCode, xs0112.getBjbh());
     if (jx1008 == null) {
       // 添加班级信息
       jx1008 = new Jx1008();
       jx1008.setKcbjbh(Sequence.getInstance().getSequence(20));
       jx1008.setXnxqh(xnxqh);
       jx1008.setZzdKwlbdm(new ZzdKwlbdm(KwlbCode));
       jx1008.setKcmc(kcmc);
       jx1008.setKcdm(kcdm);
       jx1008.setTzdid(tzdid);
       if (jx02.getZzdKsfs() == null) {
         jx1008.setZzdKsfs(new ZzdKsfs(""));
       } else {
         jx1008.setZzdKsfs(new ZzdKsfs(jx02.getZzdKsfs().getDm()));
       }
       jx1008.setJsxm(jsxm);
       jx1008.setJsbh(jsbh);
       jx1008.setBjmc(xs0112.getBjjc());
       jx1008.setBjbh(xs0112.getBjbh());
       jx1008.setKsrs(Long.valueOf("1"));
       jx1008.setIspk("1");
       this.singleGenericHibernateDAO.save(jx1008, request);
     } else {
       jx1008.setKsrs(Long.valueOf((jx1008.getKsrs().intValue() + 1) + ""));
       this.singleGenericHibernateDAO.makePersistent(jx1008, request);
     }
     // 添加学生信息
     Jx1007 xsxx = this.findXsxx(xsbh[i], kcdm, xnxqh, KwlbCode);
     if (xsxx == null) {
       Jx1007 jx1007 = new Jx1007();
       jx1007.setKsxsbmbh(Sequence.getInstance().getSequence(15));
       jx1007.setJx1008(jx1008);
       jx1007.setXsbh(xsbh[i]);
       jx1007.setXh(xs0112.getXh());
       jx1007.setXm(xs0112.getXm());
       jx1007.setBjbh(xs0112.getBjbh());
       jx1007.setBjmc(xs0112.getBjjc());
       jx1007.setKwlbcode(KwlbCode);
       jx1007.setKch(kcdm);
       jx1007.setTzdid(tzdid);
       jx1007.setKcmc(jx02.getKcmc());
       jx1007.setXnxqh(xnxqh);
       jx1007.setJsbh(jsbh);
       jx1007.setJsxm(jsxm);
       if (jx02.getXf() == null) {
         jx1007.setXf(new Double(0.0));
       } else {
         jx1007.setXf(jx02.getXf());
       }
       if (jx02.getZxs() == null) {
         jx1007.setXs(new Long(0));
       } else {
         jx1007.setXs(jx02.getZxs());
       }
       if (jx02.getZzdKcxz() == null) {
         jx1007.setZzdKcxz(new ZzdKcxz(""));
       } else {
         jx1007.setZzdKcxz(new ZzdKcxz(jx02.getZzdKcxz().getDm()));
       }
       if (jx02.getZzdKsfs() == null) {
         jx1007.setZzdKsfs(new ZzdKsfs(""));
       } else {
         jx1007.setZzdKsfs(new ZzdKsfs(jx02.getZzdKsfs().getDm()));
       }
       if (jx02.getZzdKcfl() == null) {
         jx1007.setZzdKcfl(new ZzdKcfl(""));
       } else {
         jx1007.setZzdKcfl(new ZzdKcfl(jx02.getZzdKcfl().getDm()));
       }
       this.singleGenericHibernateDAO.save(jx1007, request);
     }
   }
 }