whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
src/main/java/com/fgkj/services/User_battmaint_checkService.java
@@ -61,14 +61,12 @@
      return model;   
   }   
   //4.10作业抽查管理(编辑记录)(user_battmaint_check表修改时User_battmaint_check_process表就新增一条记录)
    public ServiceModel updatePro(User_battmaint_check obj1,List<User_battmaint_check_process> obj2) {
    public ServiceModel updatePro(User_battmaint_check ucheck,List<User_battmaint_check_process> list) {
      ServiceModel model = new ServiceModel();
      //TODO perry待查
      boolean bl = true;
      TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
      User_battmaint_check ucheck = (User_battmaint_check) obj1;
      List<User_battmaint_check_process> list = (List<User_battmaint_check_process>) obj2;
      ArrayList<String> str_sql = new ArrayList<String>();//存放所有的sql语句
//      ArrayList<String> str_sql = new ArrayList<String>();//存放所有的sql语句
      //修改User_battmaint_check表
      if (!(mapper.updatePro(ucheck) > 0)) {
         bl = false;
@@ -107,28 +105,27 @@
   }
    //4.10作业抽查管理(删除记录)
    public ServiceModel deletePro(User_battmaint_check ucheck) {
      ServiceModel model=new ServiceModel();
      ServiceModel model = new ServiceModel();
      TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
      //TODO perry待查
      boolean bl=true;
       //删除对应的User_battmaint_check_process
       User_battmaint_check_process uprocess=new User_battmaint_check_process();
       uprocess.setTask_rec_id(ucheck.getNum());
       //删除User_battmaint_check表
      bl=mapper.delPro(ucheck)>0;
       //删除User_battmaint_check_process表中task_rec_id对应的记录
      bl=processMapper.delPro(uprocess)>0;
       //Boolean bl= DateUtil.makeManualCommit(DBUtil.getConn(), str_sql);
       if(bl){
      boolean bl = true;
      //删除对应的User_battmaint_check_process
      User_battmaint_check_process uprocess = new User_battmaint_check_process();
      uprocess.setTask_rec_id(ucheck.getNum());
      //删除User_battmaint_check表
      bl = mapper.delPro(ucheck) > 0;
      //删除User_battmaint_check_process表中task_rec_id对应的记录
      if (bl) {
         bl = processMapper.delPro(uprocess) > 0;
      }
      if (bl) {
         dataSourceTransactionManager.commit(transactionStatus);     //手动提交
         model.setCode(1);
         model.setMsg("修改成功!");
      }
      else{
      } else {
         dataSourceTransactionManager.rollback(transactionStatus);       //事务回滚
         model.setMsg("修改失败!");
      }
       return model;
      return model;
   }
   //TODO  数据不足待测试
    //4.10作业抽查管理
@@ -152,6 +149,7 @@
      String[] copy_names;
      System.out.println(" list.size = " + list.size());
      for(int i=0;i<list.size();i++){
         System.out.println("list.get("+i+") = " + list.get(i));
         BattInf binf=new BattInf();
         //电池组组数
         binf.setStationName(list.get(i).getMcheck().getRemark());
@@ -162,31 +160,46 @@
         //责任人/创建人/指派人/抄送人
         usr_id=list.get(i).getMcheck().getUsr_id();
         uinf.setuId(usr_id);
         usr_name=((User_inf)userInfMapper.serchUname(uinf).get(0)).getuName();
//         System.out.println("usr_id = " + usr_id);
         List<User_inf> listuser_inf = userInfMapper.serchUname(uinf);
         if (listuser_inf.size() > 0) {
            usr_name = listuser_inf.get(0).getuName();
         }
         binf.setStationName6(usr_name);
         master_id=list.get(i).getMcheck().getMaster_id();
         uinf.setuId(master_id);
         master_name=((User_inf)userInfMapper.serchUname(uinf).get(0)).getuName();
         List<User_inf> user_infs = userInfMapper.serchUname(uinf);
         if (user_infs.size() > 0) {
            master_name = user_infs.get(0).getuName();
         }
         binf.setStationName7(master_name);
         appoint_uid=list.get(i).getMcheck().getAppoint_uid();
         uinf.setuId(appoint_uid);
         appoint_name=((User_inf)userInfMapper.serchUname(uinf).get(0)).getuName();
         List<User_inf> user_infs1 = userInfMapper.serchUname(uinf);
         if (user_infs1.size() > 0) {
            appoint_name = user_infs1.get(0).getuName();
         }
         binf.setStationName8(appoint_name);
         //System.out.println(usr_name+"  "+master_name+"  "+appoint_name);
         copy_ids=list.get(i).getMcheck().getCopy_uids();
         System.out.println("copy_ids = " + copy_ids);      //1001,1002,1003,1004,1008
         copy_names=copy_ids.split(",");
         for(int j=0;j<copy_names.length;j++){
            copy_id=Integer.parseInt(copy_names[j]);
            uinf.setuId(copy_id);
            copy_name+=",";
            copy_name+=userInfMapper.serchUname(uinf).get(0).getuName();
//            List<User_inf> listu = userInfMapper.serchUname(uinf);
//            System.out.println("listu = " + listu);
//            User_inf user_inf = listu.get(0);
//            copy_name+= user_inf.getuName();
         if (copy_names.length>0) {
            System.out.println("copy_names = " + copy_names.toString());
            for (int j = 0; j < copy_names.length; j++) {
               String copy_name1 = copy_names[j];
               if (copy_name1.length() > 0) {
                  copy_id = Integer.parseInt(copy_name1);
                  uinf.setuId(copy_id);
               }
               copy_name += ",";
               List<User_inf> user_infs2 = userInfMapper.serchUname(uinf);
               if (user_infs2.size() > 0) {
                  copy_name += user_infs2.get(0).getuName();
               }
            }
         }
         binf.setStationName9(copy_name.substring(1, copy_name.length()));
         //System.out.println(binf.getStationName9());