Search in sources :

Example 6 with WriterUser

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"));
}
Also used : WriterUser(com.bc.pmpheep.back.po.WriterUser) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest)

Example 7 with WriterUser

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()));
}
Also used : WriterUser(com.bc.pmpheep.back.po.WriterUser) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 8 with WriterUser

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);
}
Also used : WriterUser(com.bc.pmpheep.back.po.WriterUser) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 9 with WriterUser

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);
}
Also used : CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) WriterUser(com.bc.pmpheep.back.po.WriterUser)

Example 10 with WriterUser

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;
}
Also used : MessageAttachment(com.bc.pmpheep.back.po.MessageAttachment) UserMessage(com.bc.pmpheep.back.po.UserMessage) WebScocketMessage(com.bc.pmpheep.websocket.WebScocketMessage) Message(com.bc.pmpheep.general.po.Message) HashMap(java.util.HashMap) PmphUser(com.bc.pmpheep.back.po.PmphUser) OrgUser(com.bc.pmpheep.back.po.OrgUser) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) UserMessage(com.bc.pmpheep.back.po.UserMessage) WriterUser(com.bc.pmpheep.back.po.WriterUser)

Aggregations

WriterUser (com.bc.pmpheep.back.po.WriterUser)49 BaseTest (com.bc.pmpheep.test.BaseTest)26 Test (org.junit.Test)26 Rollback (org.springframework.test.annotation.Rollback)24 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)17 ArrayList (java.util.ArrayList)14 PmphUser (com.bc.pmpheep.back.po.PmphUser)11 UserMessage (com.bc.pmpheep.back.po.UserMessage)7 OrgUser (com.bc.pmpheep.back.po.OrgUser)6 WebScocketMessage (com.bc.pmpheep.websocket.WebScocketMessage)6 DesRun (com.bc.pmpheep.back.util.DesRun)4 Message (com.bc.pmpheep.general.po.Message)4 HashMap (java.util.HashMap)4 PageResult (com.bc.pmpheep.back.plugin.PageResult)3 MyMessageVO (com.bc.pmpheep.back.vo.MyMessageVO)3 PageParameter (com.bc.pmpheep.back.plugin.PageParameter)2 Material (com.bc.pmpheep.back.po.Material)2 MessageAttachment (com.bc.pmpheep.back.po.MessageAttachment)2 Org (com.bc.pmpheep.back.po.Org)2 PmphRole (com.bc.pmpheep.back.po.PmphRole)2