Search in sources :

Example 16 with Record

use of cn.cerc.jdb.core.Record in project summer-mis by cn-cerc.

the class SvrUserLogin method getMachInfo.

// 获取用户的移动设备信息
public boolean getMachInfo() throws DataValidateException {
    Record headIn = getDataIn().getHead();
    String userCode = headIn.getString("UserCode_");
    DataValidateException.stopRun("用户帐号不允许为空", "".equals(userCode));
    String corpNo = headIn.getString("CorpNo_");
    DataValidateException.stopRun("用户帐套不允许为空", "".equals(corpNo));
    SqlQuery cdsTmp = new SqlQuery(this);
    cdsTmp.add("select * from %s", SystemTable.get(SystemTable.getDeviceVerify));
    cdsTmp.add("where CorpNo_='%s'and UserCode_='%s'", corpNo, userCode);
    /*
         * FIXME MachineType_代表设备类型,6-iOS、7-Android,用于极光推送 JPushRecord
         * 
         * 黄荣君 2017-06-19
         */
    cdsTmp.add("and Used_=1 and MachineType_ in (6,7)");
    cdsTmp.add("and ifnull(MachineCode_,'')<>''");
    cdsTmp.open();
    getDataOut().appendDataSet(cdsTmp);
    return true;
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery) Record(cn.cerc.jdb.core.Record)

Example 17 with Record

use of cn.cerc.jdb.core.Record in project summer-mis by cn-cerc.

the class SvrUserMessages method readAsyncService.

/**
 * @return 读取指定的消息记录
 */
public boolean readAsyncService() {
    String msgId = getDataIn().getHead().getString("msgId");
    SqlQuery ds = new SqlQuery(this);
    ds.add("select * from %s", SystemTable.get(SystemTable.getUserMessages));
    ds.add("where Level_=%s", MessageLevel.Service.ordinal());
    ds.add("and Process_=%s", MessageProcess.wait.ordinal());
    ds.add("and UID_='%s'", msgId);
    ds.open();
    if (// 此任务可能被其它主机抢占
    ds.eof())
        return false;
    Record headOut = getDataOut().getHead();
    headOut.setField("corpNo", ds.getString("CorpNo_"));
    headOut.setField("userCode", ds.getString("UserCode_"));
    headOut.setField("subject", ds.getString("Subject_"));
    headOut.setField("content", ds.getString("Content_"));
    return true;
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery) Record(cn.cerc.jdb.core.Record) MessageRecord(cn.cerc.jmis.message.MessageRecord) JPushRecord(cn.cerc.jmis.message.JPushRecord)

Example 18 with Record

use of cn.cerc.jdb.core.Record in project summer-mis by cn-cerc.

the class RangeField method output.

@Override
public void output(HtmlWriter html) {
    Record record = dataSource != null ? dataSource.getDataSet().getCurrent() : null;
    if (this.hidden) {
        html.print("<input");
        html.print(" type=\"hidden\"");
        html.print(" name=\"%s\"", this.getId());
        html.print(" id=\"%s\"", this.getId());
        String value = this.getText(record);
        if (value != null)
            html.print(" value=\"%s\"", value);
        html.println("/>");
    } else {
        html.println("<label for=\"%s\">%s</label>", this.getId(), this.getName() + ":");
        AbstractField child = null;
        for (Component component : this.getComponents()) {
            if (component instanceof AbstractField) {
                if (child != null)
                    html.print("-");
                child = (AbstractField) component;
                String val = child.getCSSClass_phone();
                child.setCSSClass_phone("price");
                child.outputInput(html, record);
                child.setCSSClass_phone(val);
            }
        }
        if (this.dialog != null) {
            html.print("<span>");
            html.print("<a href=\"javascript:%s('%s')\">", this.dialog, this.getId());
            html.print("<img src=\"images/select-pic.png\">");
            html.print("</a>");
            html.print("</span>");
        } else {
            html.print("<span></span>");
        }
    }
}
Also used : Record(cn.cerc.jdb.core.Record) UIComponent(cn.cerc.jui.parts.UIComponent) Component(cn.cerc.jpage.core.Component)

Example 19 with Record

use of cn.cerc.jdb.core.Record in project summer-mis by cn-cerc.

the class RemoteServiceTest method test.

@Test
@Ignore
public void test() {
    RemoteService app = new RemoteService();
    // app.setHost("r1.knowall.cn");
    app.setService("SvrUserLogin.check");
    DataSet datain = app.getDataIn();
    Record head = datain.getHead();
    head.setField("Account_", "admin");
    head.setField("Password_", "123456");
    head.setField("MachineID_", "webclient");
    boolean result = app.exec();
    assertTrue(app.getMessage(), result);
}
Also used : RemoteService(cn.cerc.jbean.client.RemoteService) DataSet(cn.cerc.jdb.core.DataSet) Record(cn.cerc.jdb.core.Record) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 20 with Record

use of cn.cerc.jdb.core.Record in project summer-mis by cn-cerc.

the class SvrUserLoginTest method testCheck2.

@Test
@Ignore
public void testCheck2() throws SecurityCheckException {
    StubHandle handle = new StubHandle();
    String userCode = handle.getUserCode();
    SvrUserLogin app = new SvrUserLogin();
    app.init(handle);
    Record headIn = app.getDataIn().getHead();
    headIn.setField("Account_", userCode);
    boolean ok = app.Check();
    assertEquals(app.getMessage(), "您的登录密码错误,禁止登录!");
    assertThat(app.getDataOut().getJSON(), is("{\"head\":{\"errorNo\":0}}"));
    assertTrue(!ok);
}
Also used : StubHandle(cn.cerc.jbean.rds.StubHandle) Record(cn.cerc.jdb.core.Record) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Record (cn.cerc.jdb.core.Record)53 SqlQuery (cn.cerc.jdb.mysql.SqlQuery)15 LocalService (cn.cerc.jbean.client.LocalService)9 Webfunc (cn.cerc.jbean.core.Webfunc)4 DataSet (cn.cerc.jdb.core.DataSet)4 Ignore (org.junit.Ignore)4 Test (org.junit.Test)4 MemoryBuffer (cn.cerc.jbean.other.MemoryBuffer)3 StubHandle (cn.cerc.jbean.rds.StubHandle)3 IMemcache (cn.cerc.jdb.cache.IMemcache)3 MessageRecord (cn.cerc.jmis.message.MessageRecord)3 UrlRecord (cn.cerc.jpage.core.UrlRecord)3 Label (jxl.write.Label)3 CustomHandle (cn.cerc.jbean.core.CustomHandle)2 IService (cn.cerc.jbean.core.IService)2 IStatus (cn.cerc.jbean.core.IStatus)2 UserNotFindException (cn.cerc.jbean.other.UserNotFindException)2 QueueQuery (cn.cerc.jdb.queue.QueueQuery)2 Column (cn.cerc.jexport.excel.Column)2 JPushRecord (cn.cerc.jmis.message.JPushRecord)2