<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<task id="__aYCQd5DjAVwj15nYX1M">
  <name>资格证成绩合格自动确认成绩</name>
  <parentId>__LgZds5MVHW3o08T7UcX</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <description>成绩合格自动确认成绩</description>
  <type>1</type>
  <runningTime>2022-08-22T08:48:40.000+08:00</runningTime>
  <interval>3</interval>
  <period>34</period>
  <runtimes>0</runtimes>
  <terminateScript><![CDATA[]]></terminateScript>
  <taskScript><![CDATA[(function(){
  var sql = "select * from tlk_system_exam_person a join tlk_qualify_person_apply b on a.ITEM_APPLYID = b.id where ifnull(b.item_areacode,'') = '' and a.item_teststate = '1' and a.item_scoreState = '0' and a.item_cardState = '0' and ifnull(a.item_examid,'') != '' limit 10";
  var datas = queryByDSName("tms",sql);
  if(datas!=null){
    for(var iterator = datas.iterator();iterator.hasNext();){
      var map1 = iterator.next();//取值
      var examPersonId= map1.get("id");
      println("examPersonId----------------"+examPersonId)
      var examId = map1.get("item_examid");
      println("examId----------------"+examId)
      var now = getToday();
      var CurrentTime=format(now,"yyyy-MM");//当前时间 格式化为月份
      //var CurrentTime=format(now,"yyyy-MM-dd HH");//当前时间 格式化为月份
      var NOW = format(now,"yyyy-MM-dd HH:mm:ss");
      var formservice = getFormProcess();
      var arrto = splitText(examPersonId,";"); 
      var process = getDocumentProcess();   
      var CID="";
      var PID="";
      // var boolean = false;
      for(var i=0;i<arrto.length;i++){
        var examPersonInfoDoc = findDocument(arrto[i]);
        examPersonInfoDoc.findItem("scoreState").setValue("1");
        var writtenScore = examPersonInfoDoc.findItem("writtenScore").getValue(); 
        var operateScore = examPersonInfoDoc.findItem("operateScore").getValue(); 
        var applyId = examPersonInfoDoc.findItem("applyId").getValue(); 
        var applyInfoDoc = findDocument(applyId);
        var learnid = applyInfoDoc.findItem("learnid").getValue(); 
        var learnName = applyInfoDoc.findItem("learnname").getValue(); 
        var trainName = applyInfoDoc.findItem("trainName").getValue(); 
        var trainid = applyInfoDoc.findItem("trainid").getValue(); 
        var orderId = applyInfoDoc.findItem("orderId").getValue(); 
        var trainSelectId = trainid;
        var conName = learnName	;
        var domainid = learnid;
        var peixunName = trainName;
        var orderInfoDoc = findDocument(orderId);
        var Form_settlement = orderInfoDoc.findItem("Form_settlement").getValue();
        var form_p_settlement = orderInfoDoc.findItem("form_p_settlement").getValue();
        //需要创建两张表的数据已创建培训公司的id作为业务id ,要考虑自然人情况（同一家公司）(item_my_domainID存储的是当前缴费的公司，item_peixunID存储的缴费的培训公司)
        var slq=" select ID from tlk_training_table where item_peixunID='"+trainSelectId+"'and date_format(created,'%Y-%m')='"+CurrentTime+"' "
        //var slq=" select ID from tlk_training_table where item_peixunID='"+trainSelectId+"'and date_format(created,'%Y-%m-%d %H')='"+CurrentTime+"' ";//or (item_my_domainID='"+domainid+"' and   item_companyID='bdjaI4oc' and date_format(created,'%Y-%m')='"+CurrentTime+"')
        println("slq--------------------------->"+slq);
        var datas6 = queryByDSName("tms",slq);
        println("datas6--------------------------->"+datas6);
        if(datas6=="[]"){//无数据的时候 新建 
          println("进到创建数据了？？？？？？？")
          println("公司是同一个不会创建保安和培训数据 这边直接走创建平台数据"); 
          //创建培训公司和平台之间的数据
          //意味着收票方是自己 即使保安公司也是培训机构 开票方是平台  
          var bcxInfo = formservice.doView("__sveeIxudIagr9knJk12");//
          println("bcxInfo"+bcxInfo);
          println("formservice"+formservice);
          var bcxInfoDoc = process.doNew(bcxInfo, getWebUser(), createParamsTable());
          println("2");
          bcxInfoDoc.addStringItem("my_domainID", domainid);//当前组织域id
          bcxInfoDoc.addStringItem("my_domainName", conName);//当前企业域名称
          bcxInfoDoc.addStringItem("K_trueStatus", "1");//开票方确认状态
          bcxInfoDoc.addStringItem("S_Status", "1");//收票方确认状态
          bcxInfoDoc.addStringItem("Kai_type", "1");//开票状态 
          bcxInfoDoc.addStringItem("type", "1");// 我方应收？？（只能去sql 判断）
          bcxInfoDoc.addStringItem("platformid", "__iZjB3As6MOfttXkZTXo");// 平台id
          bcxInfoDoc.addStringItem("platform", "1"); //平台类型
          bcxInfoDoc.addStringItem("companyID","__iZjB3As6MOfttXkZTXo" );//开票方当前平台
          bcxInfoDoc.addStringItem("companyName","百川信（北京）信息服务有限公司");//开票方当前平台
          bcxInfoDoc.addStringItem("peixunName", peixunName);////收票方是培训机构
          bcxInfoDoc.addStringItem("peixunID",trainSelectId );//收票方是培训机构
          //bcxInfoDoc.addStringItem("companytype", companytype);//保安公司类型
          //bcxInfoDoc.addStringItem("traintype", traintype);// 培训公司类型
          bcxInfoDoc.addStringItem("isTrue", "1");//开起平台收费
          bcxInfoDoc.addStringItem("money", "10");//平台收取费用
          if("2".equals(form_p_settlement)){ 
            bcxInfoDoc.addStringItem("biaoshi", "1");//平台收取费用
          }
          println(bcxInfoDoc);


          if(("1".equals(Form_settlement)&&"2".equals(form_p_settlement)) || ("2".equals(Form_settlement)&&"1".equals(form_p_settlement))){
            var slqp=" select ID from tlk_training_table where item_peixunID='"+trainSelectId+"'"  ;
            println("slqp--------------------------->"+slqp);
            var datas99 = queryByDSName("tms",slqp);
            println("datas99--------------------------->"+datas99);
            if(datas99!="[]"){
              process.doCreate(bcxInfoDoc);
              var PID1 = orderInfoDoc.findItem("PID").getValue();
              var PID2=bcxInfoDoc.getId();
              PID = PID1+";"+PID2;
            }else{
              process.doCreate(bcxInfoDoc);
              PID=bcxInfoDoc.getId();
            }
          }/*else if("2".equals(Form_settlement)&&"1".equals(form_p_settlement)){
        var slqp=" select ID from tlk_training_table where item_peixunID='"+trainSelectId+"'"  ;
        println("slqp--------------------------->"+slqp);
        var datas99 = queryByDSName("tms",slqp);
        println("datas99--------------------------->"+datas99);
        if(datas99!="[]"){
          process.doCreate(bcxInfoDoc);
          var PID1 = orderInfoDoc.findItem("PID").getValue();
          var PID2=bcxInfoDoc.getId();
          PID = PID2+";"+PID1;
        }else{
          process.doCreate(bcxInfoDoc);
          PID=bcxInfoDoc.getId();
        }
      }*/else{
        process.doCreate(bcxInfoDoc);
        PID=bcxInfoDoc.getId();
      }
          //这条数据的id 将来用做业务id


        }else{//表示查到了数据,业务id,是肯定存在的也就是PID,学员那边cid可能会没有就是null,
          var sql6 = "update tlk_training_table set item_biaoshi = '1' where item_peixunid = '"+trainid+"' and date_format(created,'%Y-%m')='"+CurrentTime+"' "
          //var sql6 = "update tlk_training_table set item_biaoshi = '1' where item_peixunid = '"+trainid+"' and date_format(created,'%Y-%m-%d %H')='"+CurrentTime+"' "
          updateByDSName("tms",sql6);
          /*if("1".equals(form_p_settlement)){
        //var slqq=" update tlk_training_table set item_biaoshi = '1' where item_peixunID='"+trainSelectId+"'and date_format(created,'%Y-%m')='"+CurrentTime+"' "
        var slqq=" update tlk_training_table set item_biaoshi = '1' where item_peixunID='"+trainSelectId+"'and date_format(created,'%Y-%m-%d %H')='"+CurrentTime+"' "
        println("slqq-------------------"+slqq)
        updateByDSName("tms",slqq);
      }*/
          println("表示查到了数据")
          var iterator = datas6.iterator();
          if(iterator.hasNext()){
            var map3 = iterator.next();
            PID= map3.get("ID");
          }
        }
        var sql2="select ID from tlk_Reconciliation_table where item_my_domainID='"+domainid+"' and item_companyID='"+trainSelectId+"' and date_format(created,'%Y-%m')='"+CurrentTime+"' "
        //var sql2="select ID from tlk_Reconciliation_table where item_my_domainID='"+domainid+"' and item_companyID='"+trainSelectId+"' and date_format(created,'%Y-%m-%d %H')='"+CurrentTime+"' "
        var datas7 = queryByDSName("tms",sql2);
        println("datas7--------------------------->"+datas7);
        if(datas7=="[]"){
          if(!domainid.equals(trainSelectId)){
            println("公司不是同一个");
            //创建保安公司和培训公司的数据
            var comInfo = formservice.doView("__id1XYDTMK5gXL4wCigC");
            var comInfoDoc = process.doNew(comInfo, getWebUser(), createParamsTable());
            comInfoDoc.addStringItem("my_domainID", domainid);//当前组织域id
            comInfoDoc.addStringItem("my_domainName", conName);//当前企业域名称
            comInfoDoc.addStringItem("K_trueStatus", "1");//开票方确认状态
            comInfoDoc.addStringItem("S_Status", "1");//收票方确认状态
            comInfoDoc.addStringItem("Kai_type", "1");//开票状态 
            comInfoDoc.addStringItem("type", "1");// 我方应收？？（只能去sql 判断）
            comInfoDoc.addStringItem("platformid", "__iZjB3As6MOfttXkZTXo");// 平台id
            comInfoDoc.addStringItem("platform", "1"); //平台类型
            comInfoDoc.addStringItem("companyID", trainSelectId);//开票方当前培训机构的企业域id
            comInfoDoc.addStringItem("companyName", peixunName);//开票方当前培训机构的企业域名称
            comInfoDoc.addStringItem("peixunName",conName );//收票方当前企业域名称
            comInfoDoc.addStringItem("peixunID", domainid);//收票方当前企业域id
            //comInfoDoc.addStringItem("companytype", companytype);//保安公司类型
            //comInfoDoc.addStringItem("traintype", traintype);// 培训公司类型
            comInfoDoc.addStringItem("isTrue", "0");//关闭平台收费
            comInfoDoc.addStringItem("b_Business_id",PID);//加一个培训表与平台的id
            if("2".equals(Form_settlement)){ 
              comInfoDoc.addStringItem("biaoshi", "1");
            }
            println(comInfoDoc);

            if(("1".equals(Form_settlement)&&"2".equals(form_p_settlement)) || ("2".equals(Form_settlement)&&"1".equals(form_p_settlement))){
              var sqlp="select ID from tlk_Reconciliation_table where item_my_domainID='"+domainid+"' and item_companyID='"+trainSelectId+"'  "
              println("sqlp--------------------------->"+sqlp);
              var datas99 = queryByDSName("tms",sqlp);
              println("datas99--------------------------->"+datas99);
              if(datas99!="[]"){
                var CID1 = orderInfoDoc.findItem("com_id").getValue();
                process.doCreate(comInfoDoc);
                var CID2=comInfoDoc.getId()
                CID = CID1+";"+CID2;
              }else{
                process.doCreate(comInfoDoc);
                CID=comInfoDoc.getId()
              }
            }/*else if("2".equals(Form_settlement)&&"1".equals(form_p_settlement)){
          var sqlp="select ID from tlk_Reconciliation_table where item_my_domainID='"+domainid+"' and item_companyID='"+trainSelectId+"'  "
          println("sqlp--------------------------->"+sqlp);
          var datas99 = queryByDSName("tms",sqlp);
          println("datas99--------------------------->"+datas99);
          if(datas99!="[]"){
            var CID1 = orderInfoDoc.findItem("com_id").getValue();
            process.doCreate(comInfoDoc);
            var CID2=comInfoDoc.getId()
            CID = CID2+";"+CID1;
          }else{
            process.doCreate(comInfoDoc);
            CID=comInfoDoc.getId()
          }
        }*/else{
          process.doCreate(comInfoDoc);
          CID=comInfoDoc.getId()
        }
          }
        }else{
          var sql5 = "update tlk_reconciliation_table set item_biaoshi = '1' where item_peixunid = '"+learnid+"' and item_companyid = '"+trainid+"' and date_format(created,'%Y-%m')='"+CurrentTime+"'"
          //var sql5 = "update tlk_reconciliation_table set item_biaoshi = '1' where item_peixunid = '"+learnid+"' and item_companyid = '"+trainid+"' and date_format(created,'%Y-%m-%d %H')='"+CurrentTime+"' "
          updateByDSName("tms",sql5);
          /*if("1".equals(Form_settlement)){ 
        //var slqq=" update tlk_Reconciliation_table set item_biaoshi = '1'  where item_my_domainID='"+domainid+"' and item_companyID='"+trainSelectId+"' and date_format(created,'%Y-%m')='"+CurrentTime+"' "
        var slqq=" update tlk_Reconciliation_table set item_biaoshi = '1'  where item_my_domainID='"+domainid+"' and item_companyID='"+trainSelectId+"' and date_format(created,'%Y-%m-%d %H')='"+CurrentTime+"' "
        updateByDSName("tms",slqq);
      }*/
          println("表示查到了数据")
          var iterator4 = datas7.iterator();
          if(iterator4.hasNext()){
            var map4 = iterator4.next();
            CID= map4.get("ID");
          }
        }
        if(isNotNull(orderId)){
          var orderInfoDoc = findDocument(orderId);
          var biaoshi1 = orderInfoDoc.findItem("biaoshi1").getValue();
          var biaoshi2 = orderInfoDoc.findItem("biaoshi2").getValue();
          var f1 = orderInfoDoc.findItem("Form_settlement").getValue();
          var f2 = orderInfoDoc.findItem("form_p_settlement").getValue();
          println("f1--------------"+f1);
          println("f2--------------"+f2);
          orderInfoDoc.findItem("confirmdate").setValue(NOW);
          orderInfoDoc.findItem("com_ID").setValue(CID);
          orderInfoDoc.findItem("PID").setValue(PID);
          if("1".equals(f1) && "2".equals(f2)){
            println("进1~~~~~~~~~~~~~~~~~~~~")
            orderInfoDoc.findItem("PAYMENT_MARK").setValue("新购1");
          }else if("2".equals(f1) && "1".equals(f2)){
            println("进2~~~~~~~~~~~~~~~~~~~~")
            orderInfoDoc.findItem("PAYMENT_MARK").setValue("新购2");
          }else if("2".equals(f1) && "2".equals(f2)){
            println("进3~~~~~~~~~~~~~~~~~~~~")
            orderInfoDoc.findItem("PAYMENT_MARK").setValue("新购3");
          }
          if(!"1".equals(biaoshi1)){
            orderInfoDoc.findItem("biaoshi1").setValue("1");
          }
          if(!"1".equals(biaoshi2)){
            orderInfoDoc.findItem("biaoshi2").setValue("1");
          }
          process.doUpdate(orderInfoDoc);
        }

        var idcardno = examPersonInfoDoc.findItem("idcardNo").getValue();
        println("idcardno------------------"+idcardno);
        var examInfoDoc = findDocument(examId);
        var isComputerExam = examInfoDoc.findItem("isComputerExam").getValue(); 
        var isStamina = examInfoDoc.findItem("isStamina").getValue(); 
        var examRules = examInfoDoc.findItem("examRules").getValue(); 
        var writtenRatio = examInfoDoc.findItem("writtenRatio").getValue();
        var operateRatio= examInfoDoc.findItem("operateRatio").getValue();
        var examStandard= examInfoDoc.findItem("examStandard").getValue();
        var writtenPassScore = examInfoDoc.findItem("writtenPassScore").getValue();
        var operatePassScore= examInfoDoc.findItem("operatePassScore").getValue();
        var applyInfoDoc = findDocument(applyId);
        var now = format(getToday(),"yyyy-MM-dd HH:mm:ss");
        println("now~~~~~~~~~~~~~~~~1111111111111"+now);
        var sqll = "select item_authlessonid from tlk_lesson_auth_base_info where item_authRecordId = '"+applyId+"'";
        var authlessonid = '';
        var datas = queryByDSName("tms",sqll);
        if(datas!=null){
          for(var iterator = datas.iterator();iterator.hasNext();){
            var map1 = iterator.next();//取值
            authlessonid = map1.get("item_authlessonid");
          }
        }
        println("报错？1111")
        println("isComputerExam"+isComputerExam);
        println("isStamina"+isStamina);
        if("1".equals(isComputerExam) && "0".equals(isStamina) ){//不需要实操考试并且需要理论考试
          println("进了吗？？"+writtenScore)
          println("进了吗？？"+examStandard)
          if(writtenScore < examStandard){//考试分数小于合格分数
            examPersonInfoDoc.findItem("testState").setValue("0");
            applyInfoDoc.findItem("applyStatus").setValue("2");

            examPersonInfoDoc.findItem("confirmDate").setValue(now);
            /* var updateSql = "update tlk_lesson_auth_base_info set item_isdelete='1',item_isProgress='0' where item_authRecordId='"+applyId+"'"
        updateByDSName("tms",updateSql);	*/
            var updateSql = "update tlk_lesson_auth_base_info set item_isdelete='1',item_isProgress='0' where item_authuserid='"+idcardno+"' and item_authlessonid = '"+authlessonid+"'"
            updateByDSName("tms",updateSql);
            var updateSql2 = "update tlk_sectioninfo set item_isStudy = '1' where ITEM_NEW_IDCARD = '"+idcardno+"'"
            updateByDSName("tms",updateSql2);	
            process.doUpdate(applyInfoDoc);  
            var updateSql22 = "update tlk_qualify_person_apply set ITEM_APPLYSTATUS = '2' where id = '"+applyId+"'"
            updateByDSName("tms",updateSql22);
            //var deleteSql = "delete from tlk_lesson_auth_base_info where item_authRecordId='"+applyId+"'";
            
          }else{//考试分数大于合格分数---合格
            println("进了吗？？？？22222")
            //   boolean = true;
            examPersonInfoDoc.findItem("cardState").setValue("2");
            examPersonInfoDoc.findItem("testState").setValue("1");
            applyInfoDoc.findItem("applyStatus").setValue("1");

            examPersonInfoDoc.findItem("confirmDate").setValue(now);
            var updateSql = "update tlk_lesson_auth_base_info set item_ispass='1',item_isProgress='1' where item_authRecordId='"+applyId+"'"
            updateByDSName("tms",updateSql);	
            /* var deleteSql = "delete from tlk_lesson_auth_base_info where item_authRecordId='"+applyId+"'";
          deleteByDSName("tms",deleteSql);*/
            process.doUpdate(applyInfoDoc);  
            var updateSql22 = "update tlk_qualify_person_apply set ITEM_APPLYSTATUS = '1' where id = '"+applyId+"'"
            updateByDSName("tms",updateSql22);
          }
        }else if("0".equals(isComputerExam) && "1".equals(isStamina) ){//只有实操考试-不合格
          if(operateRatio < examStandard){
            examPersonInfoDoc.findItem("testState").setValue("0");
            applyInfoDoc.findItem("applyStatus").setValue("2");

            examPersonInfoDoc.findItem("confirmDate").setValue(now);
            /* var updateSql = "update tlk_lesson_auth_base_info set item_isdelete='1',item_isProgress='0' where item_authRecordId='"+applyId+"'"
        updateByDSName("tms",updateSql);*/
            var updateSql = "update tlk_lesson_auth_base_info set item_isdelete='1',item_isProgress='0' where item_authuserid='"+idcardno+"' and item_authlessonid = '"+authlessonid+"'"
            updateByDSName("tms",updateSql);
            var updateSql2 = "update tlk_sectioninfo set item_isStudy = '1' where ITEM_NEW_IDCARD = '"+idcardno+"'"
            updateByDSName("tms",updateSql2);	
            /* var deleteSql = "delete from tlk_lesson_auth_base_info where item_authRecordId='"+applyId+"'";
        deleteByDSName("tms",deleteSql);*/
            process.doUpdate(applyInfoDoc);  
            var updateSql22 = "update tlk_qualify_person_apply set ITEM_APPLYSTATUS = '2' where id = '"+applyId+"'"
            updateByDSName("tms",updateSql22);
          }else{
            examPersonInfoDoc.findItem("cardState").setValue("2");
            examPersonInfoDoc.findItem("testState").setValue("1");
            applyInfoDoc.findItem("applyStatus").setValue("1");

            examPersonInfoDoc.findItem("confirmDate").setValue(now);
            var updateSql = "update tlk_lesson_auth_base_info set item_ispass='1',item_isProgress='1' where item_authRecordId='"+applyId+"'"
            updateByDSName("tms",updateSql);	
            /*var deleteSql = "delete from tlk_lesson_auth_base_info where item_authRecordId='"+applyId+"'";
          deleteByDSName("tms",deleteSql);*/
            process.doUpdate(applyInfoDoc);  
            var updateSql22 = "update tlk_qualify_person_apply set ITEM_APPLYSTATUS = '1' where id = '"+applyId+"'"
            updateByDSName("tms",updateSql22);
          }
        } else if("1".equals(isComputerExam) && "1".equals(isStamina) ){//两个都有
          if("0".equals(examRules)){//考试规则为累加合格
            writtenScore = writtenScore * (writtenRatio / 100);
            operateScore = operateScore * (operateRatio / 100);
            if((writtenScore + operateScore) < examStandard){//不合格
              examPersonInfoDoc.findItem("testState").setValue("0");
              applyInfoDoc.findItem("applyStatus").setValue("2");

              examPersonInfoDoc.findItem("confirmDate").setValue(now);
              /* var updateSql = "update tlk_lesson_auth_base_info set item_isdelete='1',item_isProgress='0' where item_authRecordId='"+applyId+"'"
          updateByDSName("tms",updateSql);*/
              var updateSql = "update tlk_lesson_auth_base_info set item_isdelete='1',item_isProgress='0' where item_authuserid='"+idcardno+"' and item_authlessonid = '"+authlessonid+"'"
              updateByDSName("tms",updateSql);
              var updateSql2 = "update tlk_sectioninfo set item_isStudy = '1' where ITEM_NEW_IDCARD = '"+idcardno+"'"
              updateByDSName("tms",updateSql2);	
              /*  var deleteSql = "delete from tlk_lesson_auth_base_info where item_authRecordId='"+applyId+"'";
          deleteByDSName("tms",deleteSql);*/
              process.doUpdate(applyInfoDoc);  
              var updateSql22 = "update tlk_qualify_person_apply set ITEM_APPLYSTATUS = '2' where id = '"+applyId+"'"
              updateByDSName("tms",updateSql22);
            }else{//合格
              examPersonInfoDoc.findItem("cardState").setValue("2");
              examPersonInfoDoc.findItem("testState").setValue("1");
              applyInfoDoc.findItem("applyStatus").setValue("1");

              examPersonInfoDoc.findItem("confirmDate").setValue(now);
              var updateSql = "update tlk_lesson_auth_base_info set item_ispass='1',item_isProgress='1' where item_authRecordId='"+applyId+"'"
              updateByDSName("tms",updateSql);	

              /* var deleteSql = "delete from tlk_lesson_auth_base_info where item_authRecordId='"+applyId+"'";
          deleteByDSName("tms",deleteSql);*/
              process.doUpdate(applyInfoDoc);  
              var updateSql22 = "update tlk_qualify_person_apply set ITEM_APPLYSTATUS = '1' where id = '"+applyId+"'"
              updateByDSName("tms",updateSql22);
            }
          }else{//合格
            if(writtenScore >= writtenPassScore && operateScore >= operatePassScore){
              examPersonInfoDoc.findItem("cardState").setValue("2");
              examPersonInfoDoc.findItem("testState").setValue("1");
              applyInfoDoc.findItem("applyStatus").setValue("1");

              examPersonInfoDoc.findItem("confirmDate").setValue(now);
              var updateSql = "update tlk_lesson_auth_base_info set item_ispass='1',item_isProgress='1' where item_authRecordId='"+applyId+"'"
              updateByDSName("tms",updateSql);	
              /* var deleteSql = "delete from tlk_lesson_auth_base_info where item_authRecordId='"+applyId+"'";
          deleteByDSName("tms",deleteSql);*/
              process.doUpdate(applyInfoDoc);  
              var updateSql22 = "update tlk_qualify_person_apply set ITEM_APPLYSTATUS = '1'where id = '"+applyId+"'"
              updateByDSName("tms",updateSql22);
            }else{//不合格
              examPersonInfoDoc.findItem("testState").setValue("0");
              applyInfoDoc.findItem("applyStatus").setValue("2");

              examPersonInfoDoc.findItem("confirmDate").setValue(now);
              /* var updateSql = "update tlk_lesson_auth_base_info set item_isdelete='1',item_isProgress='0' where item_authRecordId='"+applyId+"'"
          updateByDSName("tms",updateSql);*/
              var updateSql = "update tlk_lesson_auth_base_info set item_isdelete='1',item_isProgress='0' where item_authuserid='"+idcardno+"' and item_authlessonid = '"+authlessonid+"'"
              updateByDSName("tms",updateSql);
              var updateSql2 = "update tlk_sectioninfo set item_isStudy = '1' where ITEM_NEW_IDCARD = '"+idcardno+"'"
              updateByDSName("tms",updateSql2);	
              /*var deleteSql = "delete from tlk_lesson_auth_base_info where item_authRecordId='"+applyId+"'";
          deleteByDSName("tms",deleteSql);*/
              process.doUpdate(applyInfoDoc);  
              var updateSql22 = "update tlk_qualify_person_apply set ITEM_APPLYSTATUS = '2' where id = '"+applyId+"'"
              updateByDSName("tms",updateSql22);
            }
          }
        }
        /*var sql = "select "+
            "'"+getDomainid()+"' as DOMAINID,"+
            "ID,"+ //用户ID
            "ID as item_ID,"+
            "NAME as item_name," + 
            "FIELD11 as item_ID_TYPE," + //证件类型
            "FIELD12 as item_ID_NUMBER," + //证件号码
            "LOGINNO as item_telephone," + //手机号
            "FIELD13 as item_CERTIFICATIONSTATUS" + //实名状态
            " from " +sysfunction.DS_OBPM+".t_user"+
            " where ID='"+getWebUser().getId()+"'";*/
       // var datart = findBySQL(sql);
        var operatorname = "成绩合格，自动确认成绩"
        examPersonInfoDoc.findItem("confirmoperator").setValue(operatorname);
        process.doUpdate(examPersonInfoDoc);   
        println("确认成绩成功！！！")
      }
    }
  }

})()
]]></taskScript>
  <modifyTime>2022-08-22T08:48:40.000+08:00</modifyTime>
  <creator>Admin</creator>
  <creatorid>Ai6hllhNjS2ull9TKGb</creatorid>
  <totalRuntimes>0</totalRuntimes>
  <state>0</state>
  <startupType>2</startupType>
  <dayOfMonth>1</dayOfMonth>
  <repeatTimes>0</repeatTimes>
  <frequency>0</frequency>
  <executedCount>0</executedCount>
  <rDate></rDate>
  <rTime></rTime>
</task>