85 lines
2.6 KiB
Java
85 lines
2.6 KiB
Java
package com.ample.esb.controller;
|
|
|
|
import com.amarsoft.are.jbo.*;
|
|
import com.ample.esb.bean.afs.AccountSyncRequest;
|
|
import com.ample.esb.bean.esb.Transaction;
|
|
import com.ample.esb.service.EsbServise;
|
|
import com.ample.esb.service.impl.AccountSyncServiceImpl;
|
|
import jbo.sys.USER_INFO;
|
|
|
|
public class AccountSyncController {
|
|
private String operatorId;
|
|
private String userId;
|
|
private String userName;
|
|
private String afsState;
|
|
public String accountSyncDo(JBOTransaction tx) {
|
|
EsbServise es = new AccountSyncServiceImpl(getRequestBody());
|
|
Transaction tran = es.transactionDo();
|
|
String result = resultAnalysis(tran);
|
|
return result;
|
|
}
|
|
public AccountSyncRequest getRequestBody(){
|
|
AccountSyncRequest accountSyncRequest = new AccountSyncRequest();
|
|
accountSyncRequest.setOperatorId(operatorId);
|
|
accountSyncRequest.setUserId(userId);
|
|
accountSyncRequest.setUserName(userName);
|
|
accountSyncRequest.setSystemState(afsState);
|
|
return accountSyncRequest;
|
|
}
|
|
public String resultAnalysis(Transaction tran){
|
|
String response = "";
|
|
String retCode = tran.getMessageEsbHead().getRetCode();
|
|
if("000000".equals(retCode)){
|
|
String result = tran.getMessageBody().getResponse().getResult();
|
|
if("Successful".equals(result)){
|
|
BizObjectManager bm = null;
|
|
try {
|
|
bm = JBOFactory.getBizObjectManager(USER_INFO.CLASS_NAME);
|
|
BizObject bo = bm.createQuery("USERID=:USERID").setParameter("USERID",userId).getSingleResult(true);
|
|
bo.setAttributeValue("ATTRIBUTE1",afsState);
|
|
bm.saveObject(bo);
|
|
} catch (JBOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
response = "操作成功!";
|
|
}
|
|
}else{
|
|
response = "请求出现错误,错误码:"+retCode+".请联系系统管理员!";
|
|
}
|
|
return response;
|
|
}
|
|
|
|
public String getUserId() {
|
|
return userId;
|
|
}
|
|
|
|
public void setUserId(String userId) {
|
|
this.userId = userId;
|
|
}
|
|
|
|
public String getUserName() {
|
|
return userName;
|
|
}
|
|
|
|
public void setUserName(String userName) {
|
|
this.userName = userName;
|
|
}
|
|
|
|
public String getAfsState() {
|
|
return afsState;
|
|
}
|
|
|
|
public void setAfsState(String afsState) {
|
|
this.afsState = afsState;
|
|
}
|
|
|
|
public String getOperatorId() {
|
|
return operatorId;
|
|
}
|
|
|
|
public void setOperatorId(String operatorId) {
|
|
this.operatorId = operatorId;
|
|
}
|
|
}
|