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();
}
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);
}
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;
}
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;
}
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);
}
Aggregations