use of com.bc.pmpheep.back.po.WriterUser in project pmph by BCSquad.
the class WriterUserServiceTest method testAddWriterUserOfBack.
@Test
public void testAddWriterUserOfBack() {
WriterUser writerUser = new WriterUser();
writerUser.setUsername("username");
writerUser.setRealname("用户名");
writerUser.setNickname("昵称");
writerUser.setOrgId(727L);
String result = writerUserService.addWriterUserOfBack(writerUser);
Assert.assertTrue("添加失败", result.equals("SUCCESS"));
}
use of com.bc.pmpheep.back.po.WriterUser in project pmph by BCSquad.
the class WriterUserTest method testGetWriterUserPermissionByUserId.
/**
* 根据id查询用户权限
*/
@Test
@Rollback(Const.ISROLLBACK)
public void testGetWriterUserPermissionByUserId() {
WriterUser writerUser = this.addWriterUser();
Assert.assertNotNull("获取用户权限失败", userService.getWriterUserPermissionByUserId(writerUser.getId()));
}
use of com.bc.pmpheep.back.po.WriterUser in project pmph by BCSquad.
the class WriterUserTest method testCount.
@Test
@Rollback(Const.ISROLLBACK)
public void testCount() {
WriterUser writerUser = this.addWriterUser();
Long num = writerUserDao.getWriterUserCount();
Assert.assertNotNull("获取条数失败", num);
}
use of com.bc.pmpheep.back.po.WriterUser 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);
}
use of com.bc.pmpheep.back.po.WriterUser in project pmph by BCSquad.
the class UserMessageServiceImpl method getUserMessageById.
@Override
public Map<String, Object> getUserMessageById(Long userMsgId) {
Map<String, Object> resultMap = new HashMap<String, Object>();
if (ObjectUtil.isNull(userMsgId)) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "消息ID为空!");
}
UserMessage userMessage = userMessageDao.getUserMessageById(userMsgId);
if (ObjectUtil.isNull(userMessage)) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "用户消息对象为空!");
}
String realName = null;
if (Const.SENDER_TYPE_0 == userMessage.getSenderType() || Const.SENDER_TYPE_1 == userMessage.getSenderType()) {
PmphUser pmphUser = pmphUserService.get(userMessage.getSenderId());
realName = pmphUser.getRealname();
}
if (Const.SENDER_TYPE_2 == userMessage.getSenderType()) {
WriterUser writerUser = writerUserService.get(userMessage.getSenderId());
realName = writerUser.getRealname();
}
if (Const.SENDER_TYPE_3 == userMessage.getSenderType()) {
OrgUser orgUser = orgUserService.getOrgUserById(userMessage.getSenderId());
realName = orgUser.getRealname();
}
// 主键ID
resultMap.put("msgId", userMessage.getId());
// 标题
resultMap.put("title", userMessage.getTitle());
// 发送者
resultMap.put("senderName", realName);
// 发送时间
resultMap.put("senderDate", userMessage.getGmtCreate());
// 获取消息内容
Message message = messageService.get(userMessage.getMsgId());
if (ObjectUtil.notNull(message)) {
// throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE,
// CheckedExceptionResult.NULL_PARAM, "消息对象为空!");
// 内容
resultMap.put("content", message.getContent());
List<MessageAttachment> messageAttachments = messageAttachmentService.getMessageAttachmentByMsgId(message.getId());
if (CollectionUtil.isNotEmpty(messageAttachments)) {
for (MessageAttachment mAttachment : messageAttachments) {
String attachmentId = mAttachment.getAttachment();
mAttachment.setAttachment(Const.FILE_DOWNLOAD + attachmentId);
}
}
// 内容附件
resultMap.put("MessageAttachment", messageAttachments);
}
return resultMap;
}
Aggregations