139 lines
5.4 KiB
Java
139 lines
5.4 KiB
Java
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.tenwa.reckon.util.Conn;
|
|
|
|
public class UpdatePaymentInfo {
|
|
private String Ids;
|
|
public String action(List<Map<String,String>> requests) {
|
|
String resulst="FAIL";
|
|
JBOTransaction bcLogs = null;
|
|
String url= "http://219.141.202.98:8000/UpdateStatusService/NFS.Business.UpdateStatusService.ServicesImpl.UpdateStatus.svc";
|
|
IUpdateStatusProxy Iudsp = new IUpdateStatusProxy(url);
|
|
Request request = new Request();
|
|
List<Application> requestList = new ArrayList<Application>();
|
|
for(int i=0;i<requests.size();i++){
|
|
Map<String,String> 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<requests.size();i++){
|
|
Map<String,String> 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){
|
|
Conn conn = new Conn(tx);
|
|
String sql = "select project_no,customername,certid,fact_money from BC_PAY_INFO_LOG where ID in(?)";
|
|
List<Map<String, String>> requests = null;
|
|
try {
|
|
requests = conn.executeQuery(sql, Ids);
|
|
} 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;
|
|
}
|
|
}
|