Search in sources :

Example 1 with PmphUserManagerVO

use of com.bc.pmpheep.back.vo.PmphUserManagerVO in project pmph by BCSquad.

the class PmphUserServiceTest method testTetListPmphUserVO.

@Test
public void testTetListPmphUserVO() {
    PageResult pageResult = new PageResult<>();
    PageParameter pageParameter = new PageParameter<>();
    PmphUserManagerVO managerVO = new PmphUserManagerVO();
    managerVO.setUsername(null);
    managerVO.setRealname(null);
    managerVO.setPath("0-92-174");
    managerVO.setDepartmentId(176L);
    pageParameter.setParameter(managerVO);
    pageParameter.setPageNumber(1);
    pageParameter.setPageSize(30);
    pageResult = userService.getListPmphUser(pageParameter, null);
    Assert.assertNotNull("查找失败", pageResult);
}
Also used : PageParameter(com.bc.pmpheep.back.plugin.PageParameter) PmphUserManagerVO(com.bc.pmpheep.back.vo.PmphUserManagerVO) PageResult(com.bc.pmpheep.back.plugin.PageResult) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest)

Example 2 with PmphUserManagerVO

use of com.bc.pmpheep.back.vo.PmphUserManagerVO in project pmph by BCSquad.

the class PmphUserController method pmphUser.

/**
 * 功能描述:分页查询社内用户
 *
 * @param page
 *            分页条件
 * @param pmphUserManagerVO
 *            查询条件
 * @return 分好页的结果集
 */
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "分页查询社内用户")
@RequestMapping(value = "/list/pmphUser", method = RequestMethod.GET)
public ResponseBean pmphUser(Integer pageSize, Integer pageNumber, String name, @RequestParam("path") String path, Long departmentId, Long groupId, Long roleId) {
    PageParameter pageParameter = new PageParameter<>();
    PmphUserManagerVO pmphUserManagerVO = new PmphUserManagerVO();
    if (StringUtil.notEmpty(name)) {
        // 去除空格
        pmphUserManagerVO.setName(name.replaceAll(" ", ""));
    }
    pmphUserManagerVO.setPath(path);
    pmphUserManagerVO.setDepartmentId(departmentId);
    pmphUserManagerVO.setRoleIds(roleId != null ? roleId.toString() : "");
    pageParameter.setPageNumber(pageNumber);
    pageParameter.setPageSize(pageSize);
    pageParameter.setParameter(pmphUserManagerVO);
    return new ResponseBean(userService.getListPmphUser(pageParameter, groupId));
}
Also used : PageParameter(com.bc.pmpheep.back.plugin.PageParameter) PmphUserManagerVO(com.bc.pmpheep.back.vo.PmphUserManagerVO) ResponseBean(com.bc.pmpheep.controller.bean.ResponseBean) LogDetail(com.bc.pmpheep.annotation.LogDetail) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with PmphUserManagerVO

use of com.bc.pmpheep.back.vo.PmphUserManagerVO in project pmph by BCSquad.

the class UserMessageServiceImpl method listMessage.

@Override
public PageResult<UserMessageVO> listMessage(PageParameter<UserMessageVO> pageParameter, String sessionId) throws CheckedServiceException {
    PmphUser pmphUser = SessionUtil.getPmphUserBySessionId(sessionId);
    if (ObjectUtil.isNull(pmphUser)) {
        throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "用户为空");
    }
    if (ObjectUtil.isNull(pmphUser.getId())) {
        throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "用户为空");
    }
    // 如果是系统管理员,则查询所有,否则查询对应的消息
    if (Const.FALSE == pmphUser.getIsAdmin()) {
        List<Long> ids = new ArrayList<Long>();
        // 如果是主任,获取主任所在部门下的所有用户
        if (Const.TRUE == pmphUser.getIsDirector()) {
            // 社内部门父级节点ID
            Long parentId = 1L;
            PmphDepartment pmphDepartment = pmphDepartmentService.getPmphDepartmentById(pmphUser.getDepartmentId());
            // 如果是人卫社主任,则可以查看所有用户发送的消息
            if (parentId.longValue() == pmphDepartment.getId().longValue()) {
                ids = null;
            } else {
                // 如果是子级部门主任,则只可以查看子级部门下的用户发送的消息
                PageParameter<PmphUserManagerVO> parameter = new PageParameter<>(1, 2000);
                PmphUserManagerVO pmphUserManagerVO = new PmphUserManagerVO();
                pmphUserManagerVO.setPath(pmphDepartment.getPath());
                pmphUserManagerVO.setDepartmentId(pmphDepartment.getId());
                parameter.setParameter(pmphUserManagerVO);
                PageResult<PmphUserManagerVO> listPageResult = pmphUserService.getListPmphUser(parameter, null);
                List<PmphUserManagerVO> listPmphUserManagerVOs = listPageResult.getRows();
                for (PmphUserManagerVO pmManagerVO : listPmphUserManagerVOs) {
                    ids.add(pmManagerVO.getId());
                }
            }
        } else {
            ids.add(pmphUser.getId());
        }
        pageParameter.getParameter().setSenderIds(ids);
    }
    PageResult<UserMessageVO> pageResult = new PageResult<>();
    PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
    Integer total = userMessageDao.getMessageTotal(pageParameter);
    if (total > 0) {
        List<UserMessageVO> list = userMessageDao.listMessage(pageParameter);
        Message message;
        for (UserMessageVO userMessageVO : list) {
            message = messageService.get(userMessageVO.getMsgId());
            if (ObjectUtil.notNull(message)) {
                userMessageVO.setContent(message.getContent());
            }
        }
        pageResult.setRows(list);
        pageResult.setTotal(total);
    }
    return pageResult;
}
Also used : UserMessage(com.bc.pmpheep.back.po.UserMessage) WebScocketMessage(com.bc.pmpheep.websocket.WebScocketMessage) Message(com.bc.pmpheep.general.po.Message) PmphUser(com.bc.pmpheep.back.po.PmphUser) ArrayList(java.util.ArrayList) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) PageParameter(com.bc.pmpheep.back.plugin.PageParameter) PageResult(com.bc.pmpheep.back.plugin.PageResult) UserMessageVO(com.bc.pmpheep.back.vo.UserMessageVO) PmphUserManagerVO(com.bc.pmpheep.back.vo.PmphUserManagerVO) PmphDepartment(com.bc.pmpheep.back.po.PmphDepartment)

Example 4 with PmphUserManagerVO

use of com.bc.pmpheep.back.vo.PmphUserManagerVO in project pmph by BCSquad.

the class PmphUserServiceTest method testUpdatePmphUserOfBack.

@Test
public void testUpdatePmphUserOfBack() {
    PmphUser pmphUser = new PmphUser();
    pmphUser.setUsername("BBB");
    pmphUser.setPassword("666");
    pmphUser.setAvatar("110");
    pmphUser.setRealname("CCC");
    PmphUser pmphUser2 = new PmphUser();
    pmphUser2 = userService.add(pmphUser);
    pmphUser2.setPassword("777");
    PmphUserManagerVO managerVO = new PmphUserManagerVO();
    managerVO.setId(pmphUser2.getId());
    managerVO.setUsername(pmphUser2.getUsername());
    managerVO.setRealname(pmphUser2.getRealname());
    managerVO.setRealname("角色");
    managerVO.setHandphone("18728090611");
    managerVO.setEmail("1249115@qq.com");
    String result = userService.updatePmphUserOfBack(managerVO);
    Assert.assertTrue("更新失败", result.equals("SUCCESS"));
}
Also used : PmphUser(com.bc.pmpheep.back.po.PmphUser) PmphUserManagerVO(com.bc.pmpheep.back.vo.PmphUserManagerVO) JSONString(org.json.JSONString) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest)

Aggregations

PmphUserManagerVO (com.bc.pmpheep.back.vo.PmphUserManagerVO)4 PageParameter (com.bc.pmpheep.back.plugin.PageParameter)3 PageResult (com.bc.pmpheep.back.plugin.PageResult)2 PmphUser (com.bc.pmpheep.back.po.PmphUser)2 BaseTest (com.bc.pmpheep.test.BaseTest)2 Test (org.junit.Test)2 LogDetail (com.bc.pmpheep.annotation.LogDetail)1 PmphDepartment (com.bc.pmpheep.back.po.PmphDepartment)1 UserMessage (com.bc.pmpheep.back.po.UserMessage)1 UserMessageVO (com.bc.pmpheep.back.vo.UserMessageVO)1 ResponseBean (com.bc.pmpheep.controller.bean.ResponseBean)1 Message (com.bc.pmpheep.general.po.Message)1 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)1 WebScocketMessage (com.bc.pmpheep.websocket.WebScocketMessage)1 ArrayList (java.util.ArrayList)1 JSONString (org.json.JSONString)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1