Search in sources :

Example 26 with SqlQuery

use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.

the class SvrUserLogin method getTelToUserCode.

// 判断手机号码且账号类型为5是否已存在账号
@Webfunc
public boolean getTelToUserCode() {
    Record headIn = getDataIn().getHead();
    String userCode = headIn.getString("UserCode_");
    Record headOut = getDataOut().getHead();
    if ("".equals(userCode)) {
        headOut.setField("Msg_", "手机号不允许为空!");
        return false;
    }
    SqlQuery ds = new SqlQuery(this);
    ds.add("select a.Code_ from %s oi ", SystemTable.get(SystemTable.getBookInfo));
    ds.add("inner join %s a on oi.CorpNo_=a.CorpNo_ and oi.Status_ in(1,2)", SystemTable.get(SystemTable.getUserInfo));
    ds.add("where a.Mobile_='%s' and ((a.BelongAccount_ is null) or (a.BelongAccount_=''))", userCode);
    ds.open();
    if (ds.size() == 0) {
        headOut.setField("Msg_", "您的手机号码不存在于系统中,如果您需要注册帐号,请 <a href='TFrmContact'>联系客服</a> 进行咨询");
        return false;
    }
    if (ds.size() != 1) {
        headOut.setField("Msg_", String.format("您的手机绑定了多个帐号,无法登录,建议您使用主账号登陆后,在【我的账号--更改我的资料】菜单中设置主附帐号关系后再使用手机号登录!", userCode));
        return false;
    }
    headOut.setField("UserCode_", ds.getString("Code_"));
    return true;
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery) Record(cn.cerc.jdb.core.Record) Webfunc(cn.cerc.jbean.core.Webfunc)

Example 27 with SqlQuery

use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.

the class SvrUserLogin method isStopUsed.

private boolean isStopUsed(String userCode, String deviceId) {
    SqlQuery ds = new SqlQuery(this);
    ds.add("select * from %s ", SystemTable.get(SystemTable.getDeviceVerify));
    ds.add("where UserCode_='%s' and MachineCode_='%s' ", userCode, deviceId);
    ds.open();
    ds.edit();
    ds.setField("LastTime_", TDateTime.Now());
    ds.post();
    if (ds.getInt("Used_") == 2) {
        return false;
    }
    return true;
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery)

Example 28 with SqlQuery

use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.

the class SvrUserMessages method appendRecord.

/**
 * @return 增加一条新的消息记录
 */
public boolean appendRecord() {
    Record headIn = getDataIn().getHead();
    String corpNo = headIn.getString("corpNo");
    String userCode = headIn.getString("userCode");
    String subject = headIn.getString("subject");
    String content = headIn.getString("content");
    int process = headIn.getInt("process");
    int level = headIn.getInt("level");
    // 若为异步任务消息请求
    if (level == MessageLevel.Service.ordinal()) {
        // 若已存在同一公司别同一种回算请求在排队或者执行中,则不重复插入回算请求
        SqlQuery ds2 = new SqlQuery(handle);
        ds2.setMaximum(1);
        ds2.add("select UID_ from %s ", SystemTable.get(SystemTable.getUserMessages));
        ds2.add("where CorpNo_='%s' ", corpNo);
        ds2.add("and Subject_='%s' ", subject);
        ds2.add("and Level_=4 and (Process_ = 1 or Process_=2)");
        ds2.open();
        if (ds2.size() > 0) {
            // 返回消息的编号
            getDataOut().getHead().setField("msgId", ds2.getBigInteger("UID_"));
            return true;
        }
    }
    SqlQuery cdsMsg = new SqlQuery(this);
    cdsMsg.add("select * from %s", SystemTable.get(SystemTable.getUserMessages));
    cdsMsg.setMaximum(0);
    cdsMsg.open();
    // 保存到数据库
    cdsMsg.append();
    cdsMsg.setField("CorpNo_", corpNo);
    cdsMsg.setField("UserCode_", userCode);
    cdsMsg.setField("Level_", level);
    cdsMsg.setField("Subject_", subject);
    if (content.length() > 0)
        cdsMsg.setField("Content_", content.toString());
    cdsMsg.setField("AppUser_", handle.getUserCode());
    cdsMsg.setField("AppDate_", TDateTime.Now());
    // 日志类消息默认为已读
    cdsMsg.setField("Status_", level == MessageLevel.Logger.ordinal() ? 1 : 0);
    cdsMsg.setField("Process_", process);
    cdsMsg.setField("Final_", false);
    cdsMsg.post();
    // 清除缓存
    IMemcache buff = Application.getMemcache();
    String buffKey = String.format("%d.%s.%s.%s", BufferType.getObject.ordinal(), MessageRecord.class, corpNo, userCode);
    buff.delete(buffKey);
    // 返回消息的编号
    getDataOut().getHead().setField("msgId", cdsMsg.getBigInteger("UID_"));
    return true;
}
Also used : IMemcache(cn.cerc.jdb.cache.IMemcache) 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 29 with SqlQuery

use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.

the class SvrUserMessages method updateAsyncService.

/**
 * @return 更新异步服务进度
 */
public boolean updateAsyncService() {
    String msgId = getDataIn().getHead().getString("msgId");
    String content = getDataIn().getHead().getString("content");
    int process = getDataIn().getHead().getInt("process");
    SqlQuery cdsMsg = new SqlQuery(this);
    cdsMsg.add("select * from %s", SystemTable.get(SystemTable.getUserMessages));
    cdsMsg.add("where UID_='%s'", msgId);
    cdsMsg.open();
    if (cdsMsg.eof()) {
        // 此任务可能被其它主机抢占
        this.setMessage(String.format("消息号UID_ %s 不存在", msgId));
        return false;
    }
    cdsMsg.edit();
    cdsMsg.setField("Content_", content);
    cdsMsg.setField("Process_", process);
    cdsMsg.post();
    // 极光推送
    pushToJiGuang(cdsMsg);
    return true;
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery)

Example 30 with SqlQuery

use of cn.cerc.jdb.mysql.SqlQuery in project summer-mis by cn-cerc.

the class R method validateKey.

private static void validateKey(IHandle handle, String text, String language) {
    SqlQuery dsLang = new SqlQuery(handle);
    dsLang.add("select value_ from %s", SystemTable.getLanguage);
    dsLang.add("where key_='%s'", Utils.safeString(text));
    dsLang.add("and lang_='%s'", language);
    dsLang.open();
    if (dsLang.eof()) {
        dsLang.append();
        dsLang.setField("key_", Utils.safeString(text));
        dsLang.setField("lang_", language);
        dsLang.setField("value_", "");
        dsLang.setField("supportAndroid_", false);
        dsLang.setField("supportIphone_", false);
        dsLang.setField("enable_", true);
        dsLang.setField("updateUser_", handle.getUserCode());
        dsLang.setField("updateDate_", TDateTime.Now());
        dsLang.setField("createUser_", handle.getUserCode());
        dsLang.setField("createDate_", TDateTime.Now());
        dsLang.post();
    }
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery)

Aggregations

SqlQuery (cn.cerc.jdb.mysql.SqlQuery)38 Record (cn.cerc.jdb.core.Record)15 Webfunc (cn.cerc.jbean.core.Webfunc)4 MemoryBuffer (cn.cerc.jbean.other.MemoryBuffer)3 BuildQuery (cn.cerc.jdb.mysql.BuildQuery)3 CustomHandle (cn.cerc.jbean.core.CustomHandle)2 IMemcache (cn.cerc.jdb.cache.IMemcache)2 JPushRecord (cn.cerc.jmis.message.JPushRecord)2 MessageRecord (cn.cerc.jmis.message.MessageRecord)2 HashMap (java.util.HashMap)2 LocalService (cn.cerc.jbean.client.LocalService)1 DataValidateException (cn.cerc.jbean.core.DataValidateException)1 ServerConfig (cn.cerc.jbean.core.ServerConfig)1 ServiceException (cn.cerc.jbean.core.ServiceException)1 UserNotFindException (cn.cerc.jbean.other.UserNotFindException)1 StubHandle (cn.cerc.jbean.rds.StubHandle)1 DataSet (cn.cerc.jdb.core.DataSet)1 SqlSession (cn.cerc.jdb.mysql.SqlSession)1 Transaction (cn.cerc.jdb.mysql.Transaction)1 Gson (com.google.gson.Gson)1