Search in sources :

Example 6 with UicBean

use of com.akaxin.site.storage.bean.UicBean in project openzaly by akaxincom.

the class HttpUICService method list.

/**
 * 分页获取UIC
 *
 * @param command
 * @return
 */
public CommandResponse list(Command command) {
    CommandResponse commandResponse = new CommandResponse();
    ErrorCode2 errCode = ErrorCode2.ERROR;
    try {
        HaiUicListProto.HaiUicListRequest request = HaiUicListProto.HaiUicListRequest.parseFrom(command.getParams());
        int pageNum = request.getPageNumber();
        int pageSize = request.getPageSize();
        int status = request.getStatusValue();
        LogUtils.requestDebugLog(logger, command, request.toString());
        List<UicBean> uicList = SiteUicDao.getInstance().getUicList(pageNum, pageSize, status);
        if (uicList != null) {
            HaiUicListProto.HaiUicListResponse.Builder responseBuilder = HaiUicListProto.HaiUicListResponse.newBuilder();
            for (UicBean bean : uicList) {
                responseBuilder.addUicInfo(getUicInfo(bean));
            }
            commandResponse.setParams(responseBuilder.build().toByteArray());
            errCode = ErrorCode2.SUCCESS;
        }
    } catch (Exception e) {
        errCode = ErrorCode2.ERROR_SYSTEMERROR;
        LogUtils.requestErrorLog(logger, command, e);
    }
    return commandResponse.setErrCode2(errCode);
}
Also used : ErrorCode2(com.akaxin.common.constant.ErrorCode2) CommandResponse(com.akaxin.common.command.CommandResponse) UicBean(com.akaxin.site.storage.bean.UicBean) HaiUicListProto(com.akaxin.proto.plugin.HaiUicListProto)

Example 7 with UicBean

use of com.akaxin.site.storage.bean.UicBean in project openzaly by akaxincom.

the class UserUic method updateUicUsed.

public boolean updateUicUsed(String uic, String siteUserId) {
    UicBean bean = new UicBean();
    bean.setUic(uic);
    bean.setSiteUserId(siteUserId);
    bean.setStatus(UicProto.UicStatus.USED_VALUE);
    bean.setUseTime(System.currentTimeMillis());
    return SiteUicDao.getInstance().updateUic(bean);
}
Also used : UicBean(com.akaxin.site.storage.bean.UicBean)

Example 8 with UicBean

use of com.akaxin.site.storage.bean.UicBean in project openzaly by akaxincom.

the class SQLiteJDBCManager method initAdminUic.

private static void initAdminUic(String uic) {
    boolean result = false;
    try {
        UicBean bean = new UicBean();
        bean.setUic(uic);
        bean.setStatus(UicProto.UicStatus.UNUSED_VALUE);
        bean.setCreateTime(System.currentTimeMillis());
        result = SQLiteUICDao.getInstance().addUIC(bean);
    } catch (SQLException e) {
        logger.warn("add new uic to db error,you can ignore it");
    }
    if (result) {
        logger.info("init addmin uic success");
    } else {
        logger.warn("init admin uic fail");
    }
}
Also used : SQLException(java.sql.SQLException) UicBean(com.akaxin.site.storage.bean.UicBean)

Aggregations

UicBean (com.akaxin.site.storage.bean.UicBean)8 CommandResponse (com.akaxin.common.command.CommandResponse)3 ErrorCode2 (com.akaxin.common.constant.ErrorCode2)3 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 ArrayList (java.util.ArrayList)2 HaiUicCreateProto (com.akaxin.proto.plugin.HaiUicCreateProto)1 HaiUicInfoProto (com.akaxin.proto.plugin.HaiUicInfoProto)1 HaiUicListProto (com.akaxin.proto.plugin.HaiUicListProto)1 SQLException (java.sql.SQLException)1