use of cn.cerc.jbean.client.LocalService in project summer-mis by cn-cerc.
the class StartForms method checkTimeout.
protected void checkTimeout(IForm form, String funcCode, long startTime, long timeout) {
long totalTime = System.currentTimeMillis() - startTime;
if (totalTime > timeout) {
String[] tmp = form.getClass().getName().split("\\.");
String pageCode = tmp[tmp.length - 1] + "." + funcCode;
String dataIn = new Gson().toJson(form.getRequest().getParameterMap());
if (dataIn.length() > 60000)
dataIn = dataIn.substring(0, 60000);
LocalService ser = new LocalService(form.getHandle(), "SvrFormTimeout.save");
Record head = ser.getDataIn().getHead();
head.setField("pageCode", pageCode);
head.setField("dataIn", dataIn);
head.setField("tickCount", totalTime);
ser.exec();
}
}
use of cn.cerc.jbean.client.LocalService in project summer-mis by cn-cerc.
the class JPushRecord method send.
public void send(IHandle handle) {
LocalService svr = new LocalService(handle, "SvrUserLogin.getMachInfo");
if (!svr.exec("CorpNo_", corpNo, "UserCode_", userCode)) {
throw new RuntimeException(svr.getMessage());
}
// 设置极光推送平台
JiguangPush push = new JiguangPush(handle);
push.setMessage(alert);
push.setMsgId("" + msgId);
push.setTitle(title);
// 将消息推送到极光平台
DataSet dataOut = svr.getDataOut();
while (dataOut.fetch()) {
String machineCode = dataOut.getString("MachineCode_");
int machineType = dataOut.getInt("MachineType_");
switch(machineType) {
case 6:
push.send(ClientType.IOS, machineCode);
break;
case 7:
// 过滤掉没有注册IMEI码的移动设备
if (!"n_null".equals(machineCode) && !"n_000000000000000".equals(machineCode)) {
push.send(ClientType.Android, machineCode);
}
break;
default:
break;
}
}
}
use of cn.cerc.jbean.client.LocalService in project summer-mis by cn-cerc.
the class MessageRecord method send.
public String send(IHandle handle) {
if (subject == null || "".equals(subject)) {
throw new RuntimeException("消息标题不允许为空");
}
if (userCode == null || "".equals(userCode)) {
throw new RuntimeException("用户代码不允许为空");
}
String sendCorpNo = corpNo != null ? corpNo : handle.getCorpNo();
if ("".equals(sendCorpNo)) {
throw new RuntimeException("公司别不允许为空");
}
LocalService svr = new LocalService(handle, "SvrUserMessages.appendRecord");
Record headIn = svr.getDataIn().getHead();
headIn.setField("corpNo", sendCorpNo);
headIn.setField("userCode", userCode);
headIn.setField("level", level.ordinal());
headIn.setField("subject", subject);
headIn.setField("content", content.toString());
headIn.setField("process", process);
if (!svr.exec()) {
throw new RuntimeException(svr.getMessage());
}
// 返回消息的编号
return svr.getDataOut().getHead().getString("msgId");
}
use of cn.cerc.jbean.client.LocalService in project summer-mis by cn-cerc.
the class ProcessService method processService.
/**
* 处理一个服务
*/
private void processService(String msgId) {
LocalService svr1 = new LocalService(this, "SvrUserMessages.readAsyncService");
if (// 此任务可能被其它主机抢占
!svr1.exec("msgId", msgId))
return;
Record ds = svr1.getDataOut().getHead();
String corpNo = ds.getString("corpNo");
String userCode = ds.getString("userCode");
String content = ds.getString("content");
String subject = ds.getString("subject");
// 读取并标识为工作中,以防被其它用户抢占
AsyncService svr2 = new AsyncService(null);
svr2.read(content);
svr2.setProcess(MessageProcess.working.ordinal());
updateMessage(svr2, msgId, subject);
try {
try (AutoService svr3 = new AutoService(corpNo, userCode, svr2.getService())) {
svr3.getDataIn().appendDataSet(svr2.getDataIn(), true);
if (svr3.exec()) {
svr2.getDataOut().appendDataSet(svr3.getDataOut(), true);
svr2.setProcess(MessageProcess.ok.ordinal());
} else {
svr2.getDataOut().appendDataSet(svr3.getDataOut(), true);
svr2.setProcess(MessageProcess.error.ordinal());
}
svr2.getDataOut().getHead().setField("_message_", svr3.getMessage());
updateMessage(svr2, msgId, subject);
}
} catch (Throwable e) {
e.printStackTrace();
svr2.setProcess(MessageProcess.error.ordinal());
svr2.getDataOut().getHead().setField("_message_", e.getMessage());
updateMessage(svr2, msgId, subject);
}
}
use of cn.cerc.jbean.client.LocalService in project summer-mis by cn-cerc.
the class ProcessService method execute.
@Override
public void execute() {
LocalService svr = new LocalService(this, "SvrUserMessages.getWaitList");
if (!svr.exec())
throw new RuntimeException(svr.getMessage());
DataSet ds = svr.getDataOut();
while (ds.fetch()) {
log.info("开始处理异步任务,UID=" + ds.getString("UID_"));
processService(ds.getString("UID_"));
}
}
Aggregations