⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 forumserviceimp.java

📁 天乙虚拟社区8.05版本。只支持Mysql
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        pl.setPages(pages);
        return pl;
    }

    public PageList findForumsCommend(long commend, Pages pages) {
        PageList pl = new PageList();
        if (pages.getTotalNum() == -1) {
            pages.setTotalNum(this.getForumNumCommend(commend));
        }
        pages.executeCount();

        List l = this.getForumDAO().findForumsCommend(commend, -1, 0, 0, "postTime", Constant.ORDER_DESC,
                pages.getSpage(), pages.getPerPageNum());
        pl.setObjectList(l);
        pl.setPages(pages);
        return pl;
    }

    public PageList findForumsDel(long bid, Pages pages) {
        OrderObj[] oo = {new OrderObj("delTime", Constant.ORDER_DESC)};
        return this.findForums(bid, -1, 1, -1, -1, oo, pages);
    }

    public List findForumsElite(long bid, long elite, long eliteId) {
        return this.getForumDAO().findForumsElite(bid, elite, eliteId);
    }

    public PageList findForumsHotTopic(long bid, int reNum, int click, Pages pages) {
        PageList pl = new PageList();
        if (pages.getTotalNum() == -1) {
            pages.setTotalNum(this.getForumNumHotTopic(bid, reNum, click));
        }
        pages.executeCount();

        List l = this.getForumDAO().findForumsHotTopic(bid, reNum, click, pages.getSpage(), pages.getPerPageNum());
        pl.setObjectList(l);
        pl.setPages(pages);
        return pl;
    }

    public List findForumsInIds(long bid, List ids) {
        return this.getForumDAO().findForumsInIds(bid, ids);
    }

    public List findForumsInIds(List ids) {
        return this.getForumDAO().findForumsInIds(ids);
    }

    public PageList findForumsMainLastRe(long bid, Pages pages) {
        OrderObj oo0 = new OrderObj("isTop", Constant.ORDER_DESC);
        OrderObj oo1 = new OrderObj("lastTime", Constant.ORDER_DESC);
        OrderObj[] oo = {oo0, oo1};
        return this.findForums(bid, 1, 0, 0, -1, oo, pages);
    }

    public PageList findForumsMainLastRe(long bid, String tagID, Pages pages) {
        OrderObj oo0 = new OrderObj("isTop", Constant.ORDER_DESC);
        OrderObj oo1 = new OrderObj("lastTime", Constant.ORDER_DESC);
        OrderObj[] oo = {oo0, oo1};
        PageList pl = new PageList();
        if (pages.getTotalNum() == -1) {
            pages.setTotalNum(this.getForumDAO().getForumNum(bid, tagID, 1, 0, 0));
        }

        pages.executeCount();
        List l = this.getForumDAO().findForums(bid, tagID, 1, 0, 0, oo, pages.getSpage(), pages.getPerPageNum());
        pl.setObjectList(l);
        pl.setPages(pages);
        return pl;
    }

    public PageList findForumsMainWWW(long bid, Pages pages) {
        OrderObj oo0 = new OrderObj("isTop", Constant.ORDER_DESC);
        OrderObj oo1 = new OrderObj("postTime", Constant.ORDER_DESC);
        OrderObj[] oo = {oo0, oo1};
        return this.findForums(bid, 1, 0, 0, -1, oo, pages);
    }

    public PageList findForumsMainWWW(long bid, String tagID, Pages pages) {
        OrderObj oo0 = new OrderObj("isTop", Constant.ORDER_DESC);
        OrderObj oo1 = new OrderObj("postTime", Constant.ORDER_DESC);
        OrderObj[] oo = {oo0, oo1};
        PageList pl = new PageList();
        if (pages.getTotalNum() == -1) {
            pages.setTotalNum(this.getForumDAO().getForumNum(bid, tagID, 1, 0, 0));
        }

        pages.executeCount();
        List l = this.getForumDAO().findForums(bid, tagID, 1, 0, 0, oo, pages.getSpage(), pages.getPerPageNum());
        pl.setObjectList(l);
        pl.setPages(pages);
        return pl;
    }

    public PageList findForumsOwner(String userID, int isNew, Pages pages) {
        PageList pl = new PageList();
        if (pages.getTotalNum() == -1) {
            pages.setTotalNum(this.getForumOwnerNum(userID));
        }
        pages.executeCount();

        List l = this.getForumDAO().findForumsOwner(userID, isNew, 0, 0, "postTime", Constant.ORDER_DESC,
                pages.getSpage(), pages.getPerPageNum());
        pl.setObjectList(l);
        pl.setPages(pages);
        return pl;
    }

    public PageList findForumsOwner(long bid, String userID, String mainID, Pages pages) {
        PageList pl = new PageList();
        if (pages.getTotalNum() == -1) {
            pages.setTotalNum(this.getForumOwnerNum(bid, userID, mainID));
        }
        // System.out.println(pages.getTotalNum());
        pages.executeCount();

        // System.out.println(pages.getTotalNum());

        List l = this.getForumDAO().findForumsInMainIDByUserID(bid, mainID, userID, -1, 0, 0, "postTime",
                Constant.ORDER_ASC, pages.getSpage(), pages.getPerPageNum());
        pl.setObjectList(l);
        pl.setPages(pages);
        return pl;
    }

    public PageList findForumsTopic(long bid, String mainID, int delSign, int auditing, OrderObj[] oo, Pages pages) {
        PageList pl = new PageList();
        if (pages.getTotalNum() == -1) {
            pages.setTotalNum(this.getForumDAO().getForumTopicNum(bid, mainID, delSign, auditing));
        }
        pages.executeCount();

        List l = this.getForumDAO().findForumsTopic(bid, mainID, delSign, auditing, oo, pages.getSpage(),
                pages.getPerPageNum());
        pl.setObjectList(l);
        pl.setPages(pages);
        return pl;
    }

    public PageList findForumsTopic(long bid, String mainID, Pages pages) {
        OrderObj[] oo = {new OrderObj("postTime", Constant.ORDER_ASC)};
        return this.findForumsTopic(bid, mainID, 0, 0, oo, pages);
    }

    public List findForumsTopicAll(long bid, String mainID, int delSign, int auditing, OrderObj[] oo) {
        return this.getForumDAO().findForumsTopic(bid, mainID, delSign, auditing, -1, oo);
    }

    public List findForumsTopicAuditing(long bid, String mainID) {
        OrderObj[] oo = {new OrderObj("postTime", Constant.ORDER_ASC)};
        return this.getForumDAO().findForumsTopic(bid, mainID, 0, 1, -1, oo);
    }

    public List findForumsTopicAuditingAttachFile(long bid, String mainID) {
        OrderObj[] oo = {new OrderObj("postTime", Constant.ORDER_ASC)};
        return this.getForumDAO().findForumsTopic(bid, mainID, 0, -1, 1, oo);
    }

    public List findForumsTopicDel(long bid, String mainID) {
        OrderObj[] oo = {new OrderObj("postTime", Constant.ORDER_ASC)};
        return this.getForumDAO().findForumsTopic(bid, mainID, 1, -1, -1, oo);
    }

    public long getForumAuditingNum(long bid) {
        return this.getForumDAO().getForumNum(bid, -1, 0, 1, -1);
    }

    public long getForumBuyNumByPostId(String postId) {
        return this.getForumBuyDAO().getForumBuyNumByPostId(postId);
    }

    public long getForumDelNum(long bid) {
        return this.getForumDAO().getForumNum(bid, -1, 1, -1, -1);
    }

    public long getForumMainNum(long bid) {
        return this.getForumDAO().getForumNum(bid, 1, 0, 0, -1);
    }

    public long getForumNum(long bid, int isNew, int delSign, int auditing, int auditingAttachFile) {
        return this.getForumDAO().getForumNum(bid, isNew, delSign, auditing, auditingAttachFile);
    }

    public long getForumNum(long bid) {
        return this.getForumDAO().getForumNum(bid, -1, 0, 0, -1);
    }

    public long getForumNumCommend(long bid, long commen) {
        return this.getForumDAO().getForumNumCommend(bid, commen, -1, 0, 0);
    }

    public long getForumNumCommend(long commend) {
        return this.getForumDAO().getForumNumCommend(commend, -1, 0, 0);
    }

    public long getForumNumHotTopic(long bid, int reNum, int click) {
        return this.getForumDAO().getForumNumHotTopic(bid, reNum, click);
    }

    public long getForumOwnerNum(String userID) {
        return this.getForumDAO().getForumOwnerNum(userID, -1, 0, 0);
    }

    public long getForumOwnerNum(long bid, String userID, String mainID) {
        return this.getForumDAO().getForumNumInMainIDByUserID(bid, mainID, userID, -1, 0, 0);
    }

    public long getForumTopicAuditingNum(long bid, String mainID) {
        return this.getForumDAO().getForumTopicNum(bid, mainID, 0, 1);
    }

    public long getForumTopicDelNum(long bid, String mainID) {
        return this.getForumDAO().getForumTopicNum(bid, mainID, 1, -1);
    }

    public long getForumTopicNum(long bid, String mainID, int delSign, int auditing) {
        return this.getForumDAO().getForumTopicNum(bid, mainID, delSign, auditing);
    }

    public long getForumTopicNum(long bid, String mainID) {
        return this.getForumDAO().getForumTopicNum(bid, mainID, 0, 0);
    }

    public long getForumsAuditingAttachFileNum(long bid) {
        return this.getForumDAO().getForumNum(bid, -1, 0, -1, 1);
    }

    public PageList getSearchList(long bid, String con, String text, int delSign, int auditing, String orderby,
                                  int ascOrDesc, Pages pages) {
        PageList pl = new PageList();
        if (pages.getTotalNum() == -1) {
            pages.setTotalNum(this.getForumDAO().getSearchNum(bid, con, text, delSign, auditing));
        }
        pages.executeCount();

        List l = this.getForumDAO().getSearchList(bid, con, text, delSign, auditing, orderby, ascOrDesc,
                pages.getSpage(), pages.getPerPageNum());
        pl.setObjectList(l);
        pl.setPages(pages);
        return pl;
    }

    public PageList getSearchList(long bid, String con, String text, Pages pages) {
        return this.getSearchList(bid, con, text, 0, 0, "postTime", Constant.ORDER_DESC, pages);
    }

    public long getSearchNum(long bid, String con, String text, int delSign, int auditing) {
        return this.getForumDAO().getSearchNum(bid, con, text, delSign, auditing);
    }

    public long getSearchNum(long bid, String con, String text) {
        return this.getForumDAO().getSearchNum(bid, con, text, 0, 0);
    }

    public boolean isReedUser(long bid, String mainID, String userID) {
        long num = this.getForumDAO().getForumNumInMainIDByUserID(bid, mainID, userID, 0, 0, 0);
        if (num > 0) {
            return true;
        } else {
            return false;
        }
    }

    public void removeAllAttachFile(Forum forum) throws BbscsException {
        if (forum.getHaveAttachFile() == 1) {
            List fl = forum.getAttachFileName();
            // String filePath = BBSCSUtil.getUpFilePath(forum.getBoardID(),
            // forum.getPostTime());
            try {
                /*
                     * for (int i = 0; i < fl.size(); i++) { File attachFile = new
                     * File(filePath + (String) fl.get(i)); if (attachFile.exists()) {
                     * FileUtils.forceDelete(attachFile); } File attachFileSmall =
                     * new File(filePath + (String) fl.get(i) +
                     * Constant.IMG_SMALL_FILEPREFIX); if (attachFileSmall.exists()) {
                     * FileUtils.forceDelete(attachFileSmall); } }
                     */
                this.getForumUploadFile().delUploadFile(forum);
                fl.clear();
                forum.setAttachFileName(fl);
                forum.setAuditingAttachFile(0);
                forum.setHaveAttachFile(0);
                this.getForumDAO().saveOrUpdateForum(forum);
            } catch (Exception ex) {
                logger.error(ex);
                throw new BbscsException(ex);
            }
        }
    }

    public void removeAttachFile(Forum forum, List fileNames) throws BbscsException {
        // List fl = forum.getAttachFileName();
        // String filePath = BBSCSUtil.getUpFilePath(forum.getBoardID(),
        // forum.getPostTime());
        try {
            /*
                * for (int i = 0; i < fileNames.size(); i++) { String fn = (String)
                * fileNames.get(i); File attachFile = new File(filePath + fn); if
                * (attachFile.exists()) { FileUtils.forceDelete(attachFile); } File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -