Search in sources :

Example 51 with PageResult

use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.

the class SysOperationSeviceTest method testGetListSysOperation.

@Test
@Rollback(Const.ISROLLBACK)
public void testGetListSysOperation() {
    PageParameter<SysOperation> pageParameter = new PageParameter<SysOperation>();
    PageResult<SysOperation> pageResult = new PageResult<SysOperation>();
    SysOperation sysOperation = new SysOperation(1L, "a", "a", DateUtil.getCurrentTime(), "/cms/content", "192.168.200.209", "aaaa", "pc");
    pageParameter.setPageNumber(1);
    pageParameter.setPageSize(10);
    pageParameter.setParameter(sysOperation);
    pageResult = sysOperationService.getListSysOperation(pageParameter);
    Assert.assertNotNull("获取SysOperation列表失败", pageResult);
}
Also used : SysOperation(com.bc.pmpheep.back.po.SysOperation) PageParameter(com.bc.pmpheep.back.plugin.PageParameter) PageResult(com.bc.pmpheep.back.plugin.PageResult) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 52 with PageResult

use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.

the class WriterPointLogServiceTest method getListWriterPointLog.

@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
@Test
@Rollback(Const.ISROLLBACK)
public void getListWriterPointLog() {
    Integer writerPointLog = this.addWriterPointLogs();
    PageParameter pageParameter = new PageParameter<>();
    PageResult pageResult = new PageResult<>();
    WriterPointLogVO writerPointLogVO = new WriterPointLogVO();
    pageParameter.setParameter(writerPointLogVO);
    pageParameter.setPageSize(10);
    pageResult = writerPointLogService.getListWriterPointLog(pageParameter);
    Assert.assertNotNull("分页数据失败", pageResult);
}
Also used : WriterPointLogVO(com.bc.pmpheep.back.vo.WriterPointLogVO) PageParameter(com.bc.pmpheep.back.plugin.PageParameter) PageResult(com.bc.pmpheep.back.plugin.PageResult) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 53 with PageResult

use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.

the class WriterPointRuleServiceTest method getListWriterPointRule.

@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
@Test
@Rollback(Const.ISROLLBACK)
public void getListWriterPointRule() {
    WriterPointRule writerPointRule = this.addWriterPointRules();
    PageParameter pageParameter = new PageParameter<>();
    PageResult pageResult = new PageResult<>();
    WriterPointRuleVO writerPointRuleVO = new WriterPointRuleVO();
    pageParameter.setParameter(writerPointRuleVO);
    pageParameter.setPageSize(10);
    pageResult = writerPointRuleService.getListWriterPointRule(pageParameter);
    Assert.assertNotNull("分页数据失败", pageResult);
}
Also used : WriterPointRuleVO(com.bc.pmpheep.back.vo.WriterPointRuleVO) PageParameter(com.bc.pmpheep.back.plugin.PageParameter) WriterPointRule(com.bc.pmpheep.back.po.WriterPointRule) PageResult(com.bc.pmpheep.back.plugin.PageResult) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 54 with PageResult

use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.

the class PmphGroupFileServiceImpl method listGroupFile.

@Override
public PageResult<PmphGroupFileVO> listGroupFile(PageParameter<PmphGroupFileVO> pageParameter) {
    if (ObjectUtil.isNull(pageParameter.getParameter().getGroupId())) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "小组id不能为空");
    }
    String fileName = pageParameter.getParameter().getFileName();
    if (StringUtil.notEmpty(fileName)) {
        pageParameter.getParameter().setFileName(fileName);
    }
    PageResult<PmphGroupFileVO> pageResult = new PageResult<PmphGroupFileVO>();
    PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
    int total = pmphGroupFileDao.getGroupFileTotal(pageParameter);
    if (total > 0) {
        List<PmphGroupFileVO> list = pmphGroupFileDao.listGroupFile(pageParameter);
        for (PmphGroupFileVO pmphGroupFileVO : list) {
            Double fileSize = pmphGroupFileVO.getFileSize();
            if (ObjectUtil.notNull(fileSize)) {
                if (fileSize > 0) {
                    pmphGroupFileVO.setFileLenth(String.format("%.2f", fileSize) + " KB");
                } else {
                    pmphGroupFileVO.setFileLenth("0 KB");
                }
                if (fileSize > 1024) {
                    pmphGroupFileVO.setFileLenth(String.format("%.2f", fileSize / 1024) + " M");
                }
                if (fileSize > 1024 * 1024) {
                    pmphGroupFileVO.setFileLenth(String.format("%.2f", fileSize / 1024 / 1024) + " G");
                }
            } else {
                pmphGroupFileVO.setFileLenth("大小不详");
            }
            pmphGroupFileVO.setFileId(RouteUtil.MONGODB_GROUP_FILE + pmphGroupFileVO.getFileId());
        }
        pageResult.setRows(list);
    }
    pageResult.setTotal(total);
    return pageResult;
}
Also used : PmphGroupFileVO(com.bc.pmpheep.back.vo.PmphGroupFileVO) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) PageResult(com.bc.pmpheep.back.plugin.PageResult)

Example 55 with PageResult

use of com.bc.pmpheep.back.plugin.PageResult in project pmph by BCSquad.

the class PmphGroupMemberServiceImpl method listGroupMemberManagerVOs.

@Override
public PageResult<PmphGroupMemberManagerVO> listGroupMemberManagerVOs(PageParameter<PmphGroupMemberManagerVO> pageParameter) throws CheckedServiceException {
    if (null == pageParameter.getParameter().getGroupId()) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP, CheckedExceptionResult.NULL_PARAM, "小组id不能为空");
    }
    String name = pageParameter.getParameter().getName();
    if (StringUtil.notEmpty(name)) {
        pageParameter.getParameter().setName(name);
    }
    PageResult<PmphGroupMemberManagerVO> pageResult = new PageResult<>();
    PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
    int total = pmphGroupMemberDao.groupMemberTotal(pageParameter);
    if (total > 0) {
        List<PmphGroupMemberManagerVO> list = pmphGroupMemberDao.listGroupMemberManagerVOs(pageParameter);
        for (PmphGroupMemberManagerVO pmphGroupMemberManagerVO : list) {
            pmphGroupMemberManagerVO.setAvatar(RouteUtil.userAvatar(pmphGroupMemberManagerVO.getAvatar()));
            if (pmphGroupMemberManagerVO.getIsWriter()) {
                pmphGroupMemberManagerVO.setUserType(Const.SENDER_TYPE_2);
            } else {
                pmphGroupMemberManagerVO.setUserType(Const.SENDER_TYPE_1);
            }
            // 处理position
            String position = pmphGroupMemberManagerVO.getPosition();
            if (null != position && position.contains(",")) {
                position = position.replace("无,", "").replace(",无", "");
                String[] positions = position.split(",");
                String tempPosition = positions[0];
                for (int i = 1; i < positions.length; i++) {
                    if (!("," + tempPosition + ",").contains("," + positions[i] + ",")) {
                        tempPosition += "," + positions[i];
                    }
                }
                pmphGroupMemberManagerVO.setPosition(tempPosition);
            }
        // 处理position end
        }
        pageResult.setRows(list);
    }
    pageResult.setTotal(total);
    return pageResult;
}
Also used : PmphGroupMemberManagerVO(com.bc.pmpheep.back.vo.PmphGroupMemberManagerVO) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) PageResult(com.bc.pmpheep.back.plugin.PageResult)

Aggregations

PageResult (com.bc.pmpheep.back.plugin.PageResult)57 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)33 PageParameter (com.bc.pmpheep.back.plugin.PageParameter)24 BaseTest (com.bc.pmpheep.test.BaseTest)20 Test (org.junit.Test)20 PmphUser (com.bc.pmpheep.back.po.PmphUser)17 ArrayList (java.util.ArrayList)13 Rollback (org.springframework.test.annotation.Rollback)12 HashMap (java.util.HashMap)8 CmsContentVO (com.bc.pmpheep.back.vo.CmsContentVO)4 MyMessageVO (com.bc.pmpheep.back.vo.MyMessageVO)4 OrgVO (com.bc.pmpheep.back.vo.OrgVO)4 WriterUserManagerVO (com.bc.pmpheep.back.vo.WriterUserManagerVO)4 PmphGroup (com.bc.pmpheep.back.po.PmphGroup)3 PmphRole (com.bc.pmpheep.back.po.PmphRole)3 SysOperation (com.bc.pmpheep.back.po.SysOperation)3 WriterUser (com.bc.pmpheep.back.po.WriterUser)3 PmphUserManagerVO (com.bc.pmpheep.back.vo.PmphUserManagerVO)3 Material (com.bc.pmpheep.back.po.Material)2 PmphDepartment (com.bc.pmpheep.back.po.PmphDepartment)2