use of cn.cerc.jbean.other.UserNotFindException in project summer-bean by cn-cerc.
the class CustomHandle method init.
@Override
public boolean init(String corpNo, String userCode, String clientCode) {
String token = GuidFixStr(cn.cerc.jdb.other.utils.newGuid());
this.setProperty(Application.token, token);
this.setProperty(Application.bookNo, corpNo);
this.setProperty(Application.userCode, userCode);
this.setProperty(Application.clientIP, clientCode);
LocalService svr = new LocalService(this, "AppSessionRestore.byUserCode");
if (!svr.exec("userCode", userCode)) {
throw new RuntimeException(new UserNotFindException(userCode));
}
Record headOut = svr.getDataOut().getHead();
this.setProperty(Application.userId, headOut.getString("UserID_"));
this.setProperty(Application.loginTime, headOut.getDateTime("LoginTime_"));
this.setProperty(Application.roleCode, headOut.getString("RoleCode_"));
this.setProperty(Application.ProxyUsers, headOut.getString("ProxyUsers_"));
this.setProperty(Application.userName, headOut.getString("UserName_"));
this.setProperty(Application.deviceLanguage, headOut.getString("Language_"));
try (MemoryBuffer buff = new MemoryBuffer(BufferType.getSessionBase, token)) {
buff.setField("LoginTime_", headOut.getDateTime("LoginTime_"));
buff.setField("UserID_", headOut.getString("UserID_"));
buff.setField("UserCode_", userCode);
buff.setField("CorpNo_", corpNo);
buff.setField("UserName_", headOut.getString("UserName_"));
buff.setField("RoleCode_", headOut.getString("RoleCode_"));
buff.setField("ProxyUsers_", headOut.getString("ProxyUsers_"));
buff.setField("Language_", headOut.getString("Language_"));
buff.setField("exists", true);
}
return true;
}
use of cn.cerc.jbean.other.UserNotFindException in project summer-bean by cn-cerc.
the class AppSessionRestore method byUserCode.
public boolean byUserCode() throws ServiceException, UserNotFindException {
Record headIn = getDataIn().getHead();
DataValidateException.stopRun("用户id不允许为空", !headIn.hasValue("userCode"));
String userCode = headIn.getString("userCode");
SqlQuery cdsUser = new SqlQuery(this);
cdsUser.add("select ID_,Code_,RoleCode_,DiyRole_,CorpNo_, Name_ as UserName_,ProxyUsers_");
cdsUser.add("from %s ", SystemTable.get(SystemTable.getUserInfo));
cdsUser.add("where Code_= '%s' ", userCode);
cdsUser.open();
if (cdsUser.eof()) {
throw new UserNotFindException(userCode);
}
Record headOut = getDataOut().getHead();
headOut.setField("LoginTime_", TDateTime.Now());
copyData(cdsUser, headOut);
return true;
}
Aggregations