package paymentInfoUpdate; import java.math.BigDecimal; import java.rmi.RemoteException; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; import jbo.com.tenwa.lease.comm.BC_PAY_INFO_LOG; import org.datacontract.schemas._2004._07.Cap_Infrastructure_Entities_UpdateStatus.Application; import org.datacontract.schemas._2004._07.Cap_Infrastructure_Entities_UpdateStatus.Request; import org.datacontract.schemas._2004._07.Cap_Infrastructure_Entities_UpdateStatus.Response; import org.tempuri.IUpdateStatusProxy; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.are.util.StringFunction; import com.amarsoft.awe.Configure; import com.tenwa.reckon.util.Conn; public class UpdatePaymentInfo { private String Ids; public String action(List> requests) throws Exception { String resulst="FAIL"; JBOTransaction bcLogs = null; Configure config = Configure.getInstance(); String url = config.getConfigure("BC_URL") ; IUpdateStatusProxy Iudsp = new IUpdateStatusProxy(url); Request request = new Request(); List requestList = new ArrayList(); for(int i=0;i requestInfo = requests.get(i); Application alct = new Application(); String fact_money = requestInfo.get("fact_money"); String project_no = requestInfo.get("project_no"); String customername = requestInfo.get("customername"); String certid = requestInfo.get("certid"); alct.setAmount_Disbursed(new BigDecimal(fact_money)); alct.setApplication_Number(project_no); alct.setBorrower_Name(customername); alct.setID_Card_No(certid); requestList.add(alct); } //将遍历的信息放进Application[]中 Application[] alcts = requestList.toArray(new Application[requestList.size()]); request.setApplications(alcts); //发送信息并解析回复结果 Response results = null; String message_Code = null; String message_Description = null; try { results = Iudsp.updateApplicationStatus(request); } catch (RemoteException e1) { System.out.println("调用通信异常!!!"); e1.printStackTrace(); } if(results != null){ message_Code = results.getMessage_Code(); message_Description = results.getMessage_Description(); } try { bcLogs =JBOFactory.createJBOTransaction(); BizObjectManager BJM_bcPay = JBOFactory.getBizObjectManager(BC_PAY_INFO_LOG.CLASS_NAME,bcLogs); for(int i=0;i requestInfo = requests.get(i); String fact_money = requestInfo.get("fact_money"); String project_no = requestInfo.get("project_no"); String customername = requestInfo.get("customername"); String certid = requestInfo.get("certid"); BizObject BJ_Info = BJM_bcPay.newObject(); BJ_Info.setAttributeValue("project_no",project_no); BJ_Info.setAttributeValue("customername",customername); BJ_Info.setAttributeValue("certid",certid); BJ_Info.setAttributeValue("fact_money",fact_money); BJ_Info.setAttributeValue("INPUTTIME",StringFunction.getTodayNow()); BJ_Info.setAttributeValue("result","成功"); BJ_Info.setAttributeValue("resultInfo","付款信息更新成功"); BJ_Info.setAttributeValue("final_result","Y"); if(results==null||message_Code==null||"".equals(message_Code)){ BJ_Info.setAttributeValue("result","失败"); BJ_Info.setAttributeValue("resultInfo","通信异常"); BJ_Info.setAttributeValue("final_result","N"); } if(project_no==null||"".equals(project_no) ||customername==null||"".equals(customername) ||certid==null||"".equals(certid) ||fact_money==null||"".equals(fact_money)){ BJ_Info.setAttributeValue("final_result","失败"); BJ_Info.setAttributeValue("resultInfo","发送信息有空值"); BJ_Info.setAttributeValue("final_result","N"); } if("Fail".equalsIgnoreCase(message_Code)&&(message_Description.indexOf(project_no))!=-1){ BJ_Info.setAttributeValue("result","失败"); BJ_Info.setAttributeValue("resultInfo","付款信息更新失败"); BJ_Info.setAttributeValue("responseInfo",message_Description); BJ_Info.setAttributeValue("final_result","N"); } BJM_bcPay.saveObject(BJ_Info); String sql = "update O set final_result='Y' where project_no='"+project_no+"'"; if("Y".equals(BJ_Info.getAttribute("final_result").toString())){ BJM_bcPay.createQuery(sql).executeUpdate(); } } bcLogs.commit(); System.out.println("北汽财务数据更新状态:"+message_Code); System.out.println("描述信息:"+message_Description); resulst="SUCCESS"; } catch (JBOException e) { e.printStackTrace(); } return resulst; } public String requestAndAction (JBOTransaction tx) throws Exception{ Conn conn = new Conn(tx); String sql = "select project_no,customername,certid,fact_money from BC_PAY_INFO_LOG where ID =?"; List> requests = null; String [] IdsArray = Ids.split("@"); try { for(int i=0;i> request = conn.executeQuery(sql, IdsArray[i]); if(requests==null){ requests=request; }else{ requests.addAll(request); } } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(!(requests.size()>0)){ return "FAIL"; } return this.action(requests); } public String getIds() { return Ids; } public void setIds(String ids) { Ids = ids; } }