Search in sources :

Example 11 with CheckedServiceException

use of com.bc.pmpheep.service.exception.CheckedServiceException in project pmph by BCSquad.

the class AreaServiceImpl method getAreaTreeVO.

@Override
public List<AreaTreeVO> getAreaTreeVO(Long parentId) throws CheckedServiceException {
    if (null == parentId) {
        throw new CheckedServiceException(CheckedExceptionBusiness.AREA, CheckedExceptionResult.NULL_PARAM, "参数为空");
    }
    Long id = parentId;
    AreaTreeVO areaTreeVO = new AreaTreeVO(id);
    this.getAreaTree(areaTreeVO, new ArrayList<Long>());
    return areaTreeVO.getChirldren();
}
Also used : CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) AreaTreeVO(com.bc.pmpheep.back.vo.AreaTreeVO)

Example 12 with CheckedServiceException

use of com.bc.pmpheep.service.exception.CheckedServiceException in project pmph by BCSquad.

the class BookCorrectionServiceImpl method updateToAcceptancing.

@Override
public Integer updateToAcceptancing(Long id) throws CheckedServiceException {
    if (null == id) {
        throw new CheckedServiceException(CheckedExceptionBusiness.BOOK_CORRECTION, CheckedExceptionResult.NULL_PARAM, "主键为空");
    }
    BookCorrection bookCorrection = this.getBookCorrectionById(id);
    if (!bookCorrection.getIsAuthorReplied()) {
    // throw new CheckedServiceException(CheckedExceptionBusiness.BOOK_CORRECTION,
    // CheckedExceptionResult.NULL_PARAM, "请先主编审核");
    }
    bookCorrection.setIsEditorHandling(true);
    return this.updateBookCorrection(bookCorrection);
}
Also used : BookCorrection(com.bc.pmpheep.back.po.BookCorrection) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException)

Example 13 with CheckedServiceException

use of com.bc.pmpheep.service.exception.CheckedServiceException in project pmph by BCSquad.

the class BookUserCommentServiceImpl method deleteBookUserCommentById.

@Override
public String deleteBookUserCommentById(Long[] ids) throws CheckedServiceException {
    if (ArrayUtil.isEmpty(ids)) {
        throw new CheckedServiceException(CheckedExceptionBusiness.BOOK, CheckedExceptionResult.NULL_PARAM, "评论id为空");
    }
    String result = "FAIL";
    for (Long id : ids) {
        BookUserComment bookUserComment = bookUserCommentDao.getBookUserCommentById(id);
        Long bookId = bookUserComment.getBookId();
        if (bookUserComment.getIsAuth() == 1) {
            bookService.updateDownComments(bookId);
        }
    }
    int num = bookUserCommentDao.deleteBookUserCommentById(ids);
    if (num > 0) {
        result = "SUCCESS";
    } else {
        throw new CheckedServiceException(CheckedExceptionBusiness.BOOK, CheckedExceptionResult.NULL_PARAM, "删除失败");
    }
    return result;
}
Also used : BookUserComment(com.bc.pmpheep.back.po.BookUserComment) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) WriterPoint(com.bc.pmpheep.back.po.WriterPoint)

Example 14 with CheckedServiceException

use of com.bc.pmpheep.service.exception.CheckedServiceException in project pmph by BCSquad.

the class BookUserCommentServiceImpl method updateBookUserCommentByAuth.

@Override
public String updateBookUserCommentByAuth(Long[] ids, Integer isAuth, String sessionId) throws CheckedServiceException {
    String result = "FAIL";
    PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
    if (ArrayUtil.isEmpty(ids)) {
        throw new CheckedServiceException(CheckedExceptionBusiness.BOOK, CheckedExceptionResult.NULL_PARAM, "评论id为空");
    }
    if (ObjectUtil.isNull(isAuth)) {
        throw new CheckedServiceException(CheckedExceptionBusiness.BOOK, CheckedExceptionResult.NULL_PARAM, "审核内容为空");
    }
    int num = 0;
    for (Long id : ids) {
        BookUserComment bookUserComment = bookUserCommentDao.getBookUserCommentById(id);
        if (bookUserComment.getIsAuth() != 0) {
            throw new CheckedServiceException(CheckedExceptionBusiness.BOOK, CheckedExceptionResult.ILLEGAL_PARAM, "您选中的评论中有已经审核完成的评论,请确认后再次提交");
        }
        if (isAuth == 1) {
            WriterUserTrendst writerUserTrendst = new WriterUserTrendst();
            writerUserTrendst.setUserId(bookUserComment.getWriterId());
            writerUserTrendst.setType(5);
            writerUserTrendst.setBookId(bookUserComment.getBookId());
            writerUserTrendst.setBookCommentId(id);
            writerUserTrendstService.addWriterUserTrendst(writerUserTrendst);
        }
        bookUserComment.setId(id);
        bookUserComment.setIsAuth(isAuth);
        bookUserComment.setAuthUserId(pmphUser.getId());
        bookUserComment.setAuthDate(DateUtil.getCurrentTime());
        num += bookUserCommentDao.updateBookUserComment(bookUserComment);
        if (isAuth == 1) {
            // 更新评分
            bookService.updateBookCore(bookUserComment.getBookId());
            // 更新书的评论数
            bookService.updateUpComments(bookUserComment.getBookId());
        }
        // 当用户评论过后 增加相应积分
        if (isAuth == 1) {
            String ruleName = "图书评论";
            writerPointLogService.addWriterPointLogByRuleName(ruleName, bookUserComment.getWriterId());
        }
    }
    if (num > 0) {
        result = "SUCCESS";
    }
    return result;
}
Also used : WriterUserTrendst(com.bc.pmpheep.back.po.WriterUserTrendst) PmphUser(com.bc.pmpheep.back.po.PmphUser) BookUserComment(com.bc.pmpheep.back.po.BookUserComment) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) WriterPoint(com.bc.pmpheep.back.po.WriterPoint)

Example 15 with CheckedServiceException

use of com.bc.pmpheep.service.exception.CheckedServiceException in project pmph by BCSquad.

the class BookVideoServiceImpl method addBookVideoFront.

@Override
public Integer addBookVideoFront(Long userId, BookVideo bookVideo, MultipartFile cover) throws CheckedServiceException, IOException {
    WriterUser user = writerUserService.get(userId);
    if (ObjectUtil.isNull(user)) {
        throw new CheckedServiceException(CheckedExceptionBusiness.BOOK_VEDIO, CheckedExceptionResult.NULL_PARAM, "用户为空");
    }
    if (ObjectUtil.isNull(bookVideo.getBookId()) || StringUtil.isEmpty(bookVideo.getTitle()) || StringUtil.isEmpty(bookVideo.getFileName()) || StringUtil.isEmpty(bookVideo.getPath()) || StringUtil.isEmpty(bookVideo.getOrigFileName()) || StringUtil.isEmpty(bookVideo.getOrigPath()) || ObjectUtil.isNull(bookVideo.getFileSize()) || ObjectUtil.isNull(bookVideo.getOrigFileSize())) {
        throw new CheckedServiceException(CheckedExceptionBusiness.BOOK_VEDIO, CheckedExceptionResult.NULL_PARAM, "参数为空");
    }
    bookVideo.setUserId(userId);
    bookVideo.setIsAuth(false);
    // 暂设为默认值
    bookVideo.setCover("DEFAULT");
    bookVideoDao.addBookVideo(bookVideo);
    /* 保存封面 */
    String coverId = fileService.save(cover, FileType.BOOKVEDIO_CONER, bookVideo.getId());
    bookVideo.setCover(coverId);
    return bookVideoDao.updateBookVideo(bookVideo);
}
Also used : CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) WriterUser(com.bc.pmpheep.back.po.WriterUser)

Aggregations

CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)208 PmphUser (com.bc.pmpheep.back.po.PmphUser)81 ArrayList (java.util.ArrayList)73 PageResult (com.bc.pmpheep.back.plugin.PageResult)33 Material (com.bc.pmpheep.back.po.Material)30 IOException (java.io.IOException)30 HashMap (java.util.HashMap)27 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)25 WebScocketMessage (com.bc.pmpheep.websocket.WebScocketMessage)24 Workbook (org.apache.poi.ss.usermodel.Workbook)23 UserMessage (com.bc.pmpheep.back.po.UserMessage)22 LogDetail (com.bc.pmpheep.annotation.LogDetail)20 Message (com.bc.pmpheep.general.po.Message)20 Textbook (com.bc.pmpheep.back.po.Textbook)18 WriterUser (com.bc.pmpheep.back.po.WriterUser)17 OutputStream (java.io.OutputStream)17 CmsContent (com.bc.pmpheep.back.po.CmsContent)16 BufferedOutputStream (java.io.BufferedOutputStream)16 PmphGroupMemberVO (com.bc.pmpheep.back.vo.PmphGroupMemberVO)14 UnsupportedEncodingException (java.io.UnsupportedEncodingException)14