<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Api id="__VuY0yOGNqA0YWZVSA1A">
  <name>监考老师人工核验</name>
  <parentId>__LgZds5MVHW3o08T7UcX</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <status>published</status>
  <apiGroup></apiGroup>
  <encode>UTF-8</encode>
  <requestType>post</requestType>
  <requestUrl>/exam/teacherUpdate</requestUrl>
  <tags></tags>
  <responseType>json</responseType>
  <responseScript><![CDATA[(function () {
  var result = new Packages.java.util.HashMap(); //创建指定类对象
  var jsonStr = getParameter("_content");
  if(isNotNull(jsonStr)){
    var json = JSON.parse(jsonStr);
    var id = json["id"];
    var type = json["orType"];
    var resuilt = json["resuilt"];
    var face_on_exam = json["item_face_on_exam"];
    var process = getDocumentProcess();
    var persondoc=findDocument(id);
    var key = persondoc.findItem("idCardNo").getValue()+persondoc.findItem("examId").getValue();
    removeFromRedis(key);
    if(isNotNull(resuilt)){//第一次人工核验
      if("1".equals(resuilt)&&"1".equals(type)){
        persondoc.findItem("jumpFace").setValue("1")
        

      }else  if("1".equals(resuilt)&&"0".equals(type)){
        persondoc.findItem("operateSignType").setValue("0")
        persondoc.findItem("operateJumpFace").setValue("1")
      }
      

      var formProcess = getFormProcess();            
      var signInfo = formProcess.doView("__5UiYEwezZJcdxIepgtj");
      var signInfoDoc = process.doNew(signInfo,getWebUser(),createParamsTable()); 
      signInfoDoc.addStringItem("exam_id",persondoc.findItem("examId").getValue());
      signInfoDoc.addStringItem("person_id",persondoc.findItem("securityId").getValue());
      signInfoDoc.addStringItem("person_name",persondoc.findItem("name").getValue());
      signInfoDoc.addStringItem("id_card",persondoc.findItem("idCardNo").getValue());
      signInfoDoc.addStringItem("type",type);
      signInfoDoc.addStringItem("resuilt",resuilt);
      process.doCreate(signInfoDoc); 
      process.doUpdate(persondoc);
      result.put("msg", "success");
      result.put("code", "0");
      result.put("type", "update");
      return result;
    }else if(isNotNull(face_on_exam)){//第二次核验
      persondoc.findItem("face_on_exam").setValue(face_on_exam)
      var formProcess = getFormProcess();            
      var signInfo = formProcess.doView("__5UiYEwezZJcdxIepgtj");
      var signInfoDoc = process.doNew(signInfo,getWebUser(),createParamsTable()); 
      signInfoDoc.addStringItem("exam_id",persondoc.findItem("examId").getValue());
      signInfoDoc.addStringItem("person_id",persondoc.findItem("securityId").getValue());
      signInfoDoc.addStringItem("person_name",persondoc.findItem("name").getValue());
      signInfoDoc.addStringItem("id_card",persondoc.findItem("idCardNo").getValue());
      signInfoDoc.addStringItem("type",type);
      signInfoDoc.addStringItem("resuilt",face_on_exam);
      process.doCreate(signInfoDoc); 
      process.doUpdate(persondoc);
      result.put("msg", "success");
      result.put("code", "0");
      result.put("type", "update");
      return result;
    }
  }
  result.put("msg", "参数不能是空");
  result.put("code", "-1");
  result.put("type", "update");
  return result;

})()]]></responseScript>
</Api>