package com.tenwa.insurance; import com.alibaba.fastjson.JSONObject; import com.amarsoft.are.jbo.*; import com.amarsoft.awe.util.ASResultSet; import com.amarsoft.awe.util.SqlObject; import com.amarsoft.awe.util.Transaction; public class InsuranceInfo { private String contractNo; public String getContractNo() { return contractNo; } public void setContractNo(String contractNo) { this.contractNo = contractNo; } public String checkInsuranceInfo(JBOTransaction tx) throws JBOException{//校验姓名是否存在 System.out.println("合同id="+ contractNo); Transaction Sqlca=null; JSONObject resJson = new JSONObject(); try { Sqlca=Transaction.createTransaction(tx); String sql = "SELECT lec.id as equipmentId,lec.FRAME_NUMBER,lec.LICENSE_PLATE_NUMBER,lcp.plate_number, " + " ci.customerid,ci.customername,ci.certid, " + " di.distributor_no,di.DISTRIBUTOR_NAME, " + " lci.PRODUCT_ID,lci.PRODUCT_NAME,lci.SUBJECTID,lci.SUBJECTNAME,lci.PROJECT_ID,lci.PROJECT_NAME,lci.ID as contractId, lci.CONTRACT_NUMBER " + " FROM lb_contract_info lci " + " left join distributor_info di on di.distributor_no=lci.distributor_id " + " left join lb_union_lessee lul on lul.CONTRACT_ID=lci.id " + " left join customer_info ci on ci.customerid=lul.CUSTOMER_ID " + " left join lb_equipment_car lec on lec.CONTRACT_ID=lci.id " + " left join LB_CAR_LICENSE_PLATE_INFO lcp on lcp.CONTRACT_ID=lci.id " + " WHERE lci.CONTRACT_NUMBER='" + contractNo + "'"; ASResultSet res = Sqlca.getASResultSet(new SqlObject(sql)); while (res.next()) { resJson.put("equipmentId", res.getString("equipmentId")); resJson.put("FRAME_NUMBER", res.getString("FRAME_NUMBER")); resJson.put("LICENSE_PLATE_NUMBER", res.getString("LICENSE_PLATE_NUMBER")); resJson.put("plate_number", res.getString("plate_number")); resJson.put("customerid", res.getString("customerid")); resJson.put("PRODUCT_ID", res.getString("PRODUCT_ID")); resJson.put("PRODUCT_NAME", res.getString("PRODUCT_NAME")); resJson.put("SUBJECTID", res.getString("SUBJECTID")); resJson.put("SUBJECTNAME", res.getString("SUBJECTNAME")); resJson.put("PROJECT_ID", res.getString("PROJECT_ID")); resJson.put("PROJECT_NAME", res.getString("PROJECT_NAME")); resJson.put("contractId", res.getString("contractId")); resJson.put("distributor_no", res.getString("distributor_no")); resJson.put("DISTRIBUTOR_NAME", res.getString("DISTRIBUTOR_NAME")); } } catch (Exception e) { e.printStackTrace(); return "ERROR"; }finally{ if(Sqlca !=null){ Sqlca.commit(); } } return resJson.toJSONString(); } }