<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Api id="__XosUx0XVv02zrDd2JMa">
  <name>是否有模拟考试</name>
  <parentId>__LgZds5MVHW3o08T7UcX</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <status>published</status>
  <apiGroup></apiGroup>
  <encode>UTF-8</encode>
  <requestType>post</requestType>
  <requestUrl>/mock/check</requestUrl>
  <tags></tags>
  <responseType>json</responseType>
  <responseScript><![CDATA[(function(){
  var result = new Packages.java.util.HashMap();
  var userName= getWebUser().getName();
  var userid = getWebUser().getId();
  var jsonStr = getParameter("_content");
  if(isNotNull(jsonStr)){
    var json = JSON.parse(jsonStr);
    var idcard = json["idcard"]
    var domainid = getDomainid();
    var areacode = "";
    var sqlp = "SELECT supervise_region_code FROM obpm2.tenant_organizations where id IN ('"+domainid+"')"
    var datasp = queryByDSName("tms",sqlp);
    if(datasp!=null){
      for(var iterator = datasp.iterator();iterator.hasNext();){
        var map1 = iterator.next();//取值
        areacode= map1.get("supervise_region_code");
      }
    }
    if(isNotNull(areacode)){
      areacode = areacode.substr(0,2);
    }
    if("11".equals(areacode)){
      var checksql="select 1 from tlk_train_order_person where ITEM_idcard_no='"+idcard+"' and  item_pay_status='2'  "
      var datas = queryByDSName("tms",checksql);
      if(datas.size()>0){
        result.put("hasMock",true);
        result.put("code","200");
        result.put("msg","OK");
        result.put("state", true);
        return result;
      }
    }

    if("61".equals(areacode)||"14".equals(areacode)){
      var checksql="select 1 from tlk_learn_order_person where ITEM_idCardNo='"+idcard+"' and  item_orderState='1' and  (item_order_no_refund_status='' or  item_order_no_refund_status is null) "
      var datas = queryByDSName("tms",checksql);
      if(datas.size()>0){
        result.put("hasMock",true);
        result.put("code","200");
        result.put("msg","OK");
        result.put("state", true);
        return result;
      }else {
        result.put("hasMock",false);
        result.put("code","200");
        result.put("msg","OK");
        result.put("state", true);
        return result;

      }
    }else{
      result.put("hasMock",false);
      result.put("code","200");
      result.put("msg","OK");
      result.put("state", true);
      return result;
    }
  }else{
    result.put("code","500");
    result.put("msg","请求体不能为空！");
    result.put("state", false);
    return result;
  }

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