use of cn.cerc.jbean.client.LocalService in project summer-mis by cn-cerc.
the class ProcessQueue method execute.
@Override
public void execute() throws Exception {
QueueQuery query = new QueueQuery(this);
query.setQueueMode(QueueMode.recevie);
query.add("select * from %s ", QueueSession.defaultQueue);
query.open();
if (!query.getActive())
return;
query.remove();
// 建立服务执行环境
String corpNo = query.getHead().getString("_corpNo_");
if ("".equals(corpNo)) {
log.error("_corpNo_ is null");
return;
}
String userCode = query.getHead().getString("_userCode_");
if ("".equals(userCode)) {
log.error("_userCode_ is null");
return;
}
String service = query.getHead().getString("_service_");
if ("".equals(service)) {
log.error("_service_ is null");
return;
}
// 调用队列内容中指定的服务
BookHandle bh = new BookHandle(this, corpNo);
bh.setUserCode(userCode);
LocalService svr = new LocalService(bh);
svr.setService(service);
svr.getDataIn().appendDataSet(query, true);
String msgId = query.getHead().getString("_queueId_");
JSONObject content = JSONObject.fromObject(query.getHead().getString("_content_"));
LocalService app = new LocalService(bh, "SvrUserMessages.updateAsyncService");
if (svr.exec()) {
content.element("processTime", TDateTime.Now());
content.element("dataOut", svr.getDataOut().getJSON());
if (!app.exec("msgId", msgId, "process", MessageProcess.ok.ordinal(), "content", content.toString()))
log.error(app.getMessage());
} else {
content.element("processTime", TDateTime.Now());
content.element("dataOut", svr.getDataOut().getJSON());
if (!app.exec("msgId", msgId, "process", MessageProcess.error.ordinal(), "content", content.toString()))
log.error(app.getMessage());
}
}
use of cn.cerc.jbean.client.LocalService in project summer-mis by cn-cerc.
the class ResourceBuffer method getValue.
private String getValue(IHandle handle, String text) {
LocalService svr = new LocalService(handle, "SvrLanguage.download");
Record headIn = svr.getDataIn().getHead();
headIn.setField("key_", text);
headIn.setField("lang_", lang);
if (!svr.exec()) {
log.error(svr.getMessage());
return text;
}
return svr.getDataOut().getHead().getString("value");
}
use of cn.cerc.jbean.client.LocalService in project summer-mis by cn-cerc.
the class ResourceBuffer method get.
public String get(IHandle handle, String text) {
if (items.size() == 0) {
LocalService svr = new LocalService(handle, "SvrLanguage.downloadAll");
Record headIn = svr.getDataIn().getHead();
headIn.setField("lang_", lang);
if (!svr.exec()) {
log.error(svr.getMessage());
return text;
}
for (Record item : svr.getDataOut()) {
items.put(item.getString("key_"), item.getString("value_"));
}
if (items.size() == 0) {
log.error("没有找到相应的语言字典数据!!!");
}
}
if (items.containsKey(text)) {
return items.get(text);
}
String result = getValue(handle, text);
items.put(text, result);
return result;
}
use of cn.cerc.jbean.client.LocalService in project summer-mis by cn-cerc.
the class ExportService method export.
public void export() throws WriteException, IOException, AccreditException {
if (service == null || "".equals(service))
throw new RuntimeException("错误的调用:service is null");
if (exportKey == null || "".equals(exportKey))
throw new RuntimeException("错误的调用:exportKey is null");
IHandle handle = (IHandle) this.getHandle();
LocalService app = new LocalService(handle);
app.setService(service);
try (MemoryBuffer buff = new MemoryBuffer(BufferType.getExportKey, handle.getUserCode(), exportKey)) {
app.getDataIn().close();
app.getDataIn().setJSON(buff.getString("data"));
}
if (!app.exec()) {
this.export(app.getMessage());
return;
}
DataSet dataOut = app.getDataOut();
// 对分类进行处理
dataOut.first();
while (dataOut.fetch()) {
if (dataOut.getBoolean("IsType_"))
dataOut.delete();
}
this.getTemplate().setDataSet(dataOut);
super.export();
}
Aggregations