<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<activity id="__hPuRZGSkw3z3YQ62xrG">
  <name>删除</name>
  <parentId>__WvmJVaojPRkDOsoZgz0</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <type>3</type>
  <onActionForm></onActionForm>
  <onActionView></onActionView>
  <colorType>default</colorType>
  <beforeActionScript><![CDATA[#include "sysfunction";
(function(){         
  var selectId = getParameterAsText("_selects"); 
  var process = getDocumentProcess();
  var appId=getApplication();
  var domainid = getDomainid();
  var process2 = getDomainProcess();//获取企业域对象 
  var system_name = process2.doView(domainid);
  var companyname = system_name.getName();//考试机构名称
  var senderId=getWebUser().getId()//当前用户id(作为发送者)
  var subject="您参与的保安员等级（五级）实操培训班级已将您移除！";
  var appName = "考试管理";

  if(!isNotNull(selectId)){                       	        
    return "请先勾选需要删除的人员";                               
  }      
  var arrto = splitText(selectId,";");   
  var errorMsg = "";
  for(var i=0;i<arrto.length;i++){   
    var examPersonId =  arrto[i];
    var examPersonInfo = findDocument(examPersonId);
    println(examPersonInfo);//sumScore
    var sumScore = examPersonInfo.findItem("sumScore").getValue();
    var graduationTheoryScore = examPersonInfo.findItem("graduationTheoryScore").getValue();
     var graduationOperationScore = examPersonInfo.findItem("graduationOperationScore").getValue();
    var graduationTestResults = examPersonInfo.findItem("graduationTestResults").getValue();
    var writtenStatus = examPersonInfo.findItem("writtenStatus").getValue();
    println("sumScore------------------->"+sumScore)
    var name = examPersonInfo.findItem("name").getValue();
   /* if(parseDouble(graduationTheoryScore)>0||parseDouble(graduationOperationScore)>0||!"-".equals(graduationTestResults)||"1".equals(writtenStatus)||"2".equals(writtenStatus)){
    return name+"已经存在成绩不可删除！"
    }*/
    if(parseDouble(graduationTheoryScore)>0||parseDouble(graduationOperationScore)>0||(!"".equals(graduationTestResults)&&!"-".equals(graduationTestResults))||"1".equals(writtenStatus)||"2".equals(writtenStatus)){
    return name+"已经存在成绩不可删除！"
    }
    /*if(sumScore > 0){//有成绩的情况下
      return name+"已有成绩无法删除！";  
    }*/
    var scoreMsgState = examPersonInfo.findItem("graduationTestResults").getValue();
    var scoreMsgStates = examPersonInfo.findItem("identificationTestResults").getValue();
    var name = examPersonInfo.findItem("name").getValue();
    if("1".equals(scoreMsgState)||"2".equals(scoreMsgState)){
      errorMsg += name + ";</br>";
    }
    if(isNotNull(errorMsg)){
      return errorMsg + "学员已有成绩，无法移除！";
    }
    println("开始站内信发送")
    var sql1 = "select ITEM_NAME,ITEM_CLASSID,ITEM_IDCARDNO,ITEM_securityId from tlk_level_class_student where ID='"+arrto[i]+"'";
    println("sql1------>"+sql1)
    var datass = queryByDSName("tms",sql1);
    if(datass!=null){
      var iterators = datass.iterator();
      if(iterators.hasNext()){
        var map2 = iterators.next();//取值
        var names= map2.get("ITEM_NAME");//名字
        var CLASSID= map2.get("ITEM_CLASSID");
        var idCardNo= map2.get("ITEM_IDCARDNO");//身份证
        var SECURITYID= map2.get("ITEM_securityId");//保安员id

        var examPersonInfo = findDocument(CLASSID);//班级的id
        var className = examPersonInfo.findItem("className").getValue();//班级名称

        println("senderId------------------------------------------------------------------>"+senderId)
        println("SECURITYID------------------------------------------------------------------>"+SECURITYID)
        println("CLASSID------------------------------------------------------------------>"+CLASSID)
        println("companyname------------------------------------------------------------------>"+companyname)

        var content = "";
        var texts ="";
        texts += "" + names + "，您参与的由" ;
        texts += "" + companyname + "举办的等级实操培训班级已将您移除，班级名称：" ;
        texts += "" + className + "，请等待培训学校重新安排，有任何问题可直接咨询所属保安公司或培训学校。";
        var appAvatar = "https://bcxin-saas-prod.obs.cn-north-1.myhuaweicloud.com:443/upload%2F2021-11-01%2F1635755240828768236.png";
        var title = "";
        var titleImg = "";
        var actionName = "";
        var actionUrl = "";
        content += "appName=" + appName + "&&;" ; //应用名称
        content += "appId=" + appId + "&&;" ;  //应用id
        content += "appAvatar=" + appAvatar + "&&;" ;  //应用图标
        content += "title=" + title + "&&;" ; //标题
        content += "titleImg=" + titleImg + "&&;" ;  //标题图标
        content += "actionName=" + actionName + "&&;" ;   //操作名称
        content += "actionUrl=" + actionUrl + "&&;" ;   //操作链接
        content += "content=" + texts + ""; 
        println("senderId==>" + senderId);
        println("SECURITYID======>" + SECURITYID);
        println("subject==>" + subject);
        sendMessage(senderId,SECURITYID,subject,content);
        println("站内信发送结束");
      }
    }
  }
})()]]></beforeActionScript>
  <afterActionScript><![CDATA[]]></afterActionScript>
  <hiddenScript><![CDATA[]]></hiddenScript>
  <readonlyScript><![CDATA[(function(){
  var classId=decodeURI(getParameter("classId"));
  println("classId---------------"+classId); 
   println("classId"+classId)
var classInfoDoc=findDocument(classId); 
var  classStatus=classInfoDoc.findItem("classStatus").getValue();
   println("classStatus---------------"+classStatus)////班级状态
  if("3".equals(classStatus)){//班级状态为待审核无法进行删除
    println("进来没222")
   return true
  }
  return false;
  

})()
]]></readonlyScript>
  <editMode>0</editMode>
  <fileNameScript><![CDATA[]]></fileNameScript>
  <orderno>3</orderno>
  <parentView>__WvmJVaojPRkDOsoZgz0</parentView>
  <impmappingconfigid></impmappingconfigid>
  <jumpType>0</jumpType>
  <expSub>false</expSub>
  <icon></icon>
  <disableFlowNode>false</disableFlowNode>
  <changeFlowOperator>false</changeFlowOperator>
  <changeFlowCc>false</changeFlowCc>
  <multiLanguageLabel></multiLanguageLabel>
  <dispatcherMode>0</dispatcherMode>
  <dispatcherUrl><![CDATA[]]></dispatcherUrl>
  <dispatcherParams><![CDATA[[{"paramKey":"","paramValue":""}]]]></dispatcherParams>
  <jumpMode>0</jumpMode>
  <jumpActOpenType>0</jumpActOpenType>
  <withOld>false</withOld>
  <actionType>0</actionType>
  <actionSelection>0</actionSelection>
  <workFlowType>0</workFlowType>
  <contextMenu>true</contextMenu>
  <showInToolbar>true</showInToolbar>
  <label><![CDATA[]]></label>
</activity>