Search in sources :

Example 1 with DeclarationListVO

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

the class DeclarationServiceImpl method pageDeclaration.

@Override
public PageResult<DeclarationListVO> pageDeclaration(Integer pageNumber, Integer pageSize, Long materialId, String textBookids, String realname, String position, String title, String orgName, Long orgId, String unitName, Integer positionType, Integer onlineProgress, Integer offlineProgress, Boolean haveFile) throws CheckedServiceException {
    if (null == materialId) {
        throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.NULL_PARAM, "教材为空");
    }
    Gson gson = new Gson();
    List<Long> bookIds = gson.fromJson(textBookids, new TypeToken<ArrayList<Long>>() {
    }.getType());
    // 拼装复合参数
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("materialId", materialId);
    if (null != bookIds && bookIds.size() > 0) {
        // 书籍ids
        map.put("bookIds", bookIds);
    }
    if (StringUtil.notEmpty(realname)) {
        // 账号或者姓名
        map.put("realname", StringUtil.toAllCheck(realname));
    }
    if (StringUtil.notEmpty(position)) {
        // 职务
        map.put("position", StringUtil.toAllCheck(position));
    }
    if (StringUtil.notEmpty(title)) {
        // 职称
        map.put("title", StringUtil.toAllCheck(title));
    }
    if (StringUtil.notEmpty(orgName)) {
        // 工作单位
        map.put("orgName", StringUtil.toAllCheck(orgName));
    }
    if (null != orgId) {
        // 申报单位
        map.put("orgId", orgId);
    }
    if (StringUtil.notEmpty(unitName)) {
        // 申报单位
        map.put("unitName", StringUtil.toAllCheck(unitName));
    }
    if (null != positionType && positionType != 0) {
        // 申报职位
        map.put("positionType", positionType);
    }
    if (null != onlineProgress && onlineProgress != 0) {
        // 学校审核进度
        map.put("onlineProgress", onlineProgress);
    }
    if (null != offlineProgress) {
        // 0 未收到 // 2 已收到
        // 纸质表进度
        map.put("offlineProgress", offlineProgress);
    }
    if (null != haveFile) {
        // 有无教材大纲
        map.put("haveFile", haveFile);
    }
    // 包装参数实体
    PageParameter<Map<String, Object>> pageParameter = new PageParameter<Map<String, Object>>(pageNumber, pageSize, map);
    // 返回实体
    PageResult<DeclarationListVO> pageResult = new PageResult<>();
    PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
    // 获取总数
    Integer total = declarationDao.listDeclarationTotal(pageParameter);
    if (null != total && total > 0) {
        List<DeclarationListVO> rows = declarationDao.listDeclaration(pageParameter);
        pageResult.setRows(rows);
    }
    pageResult.setTotal(total);
    return pageResult;
}
Also used : HashMap(java.util.HashMap) DeclarationListVO(com.bc.pmpheep.back.vo.DeclarationListVO) Gson(com.google.gson.Gson) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) PageParameter(com.bc.pmpheep.back.plugin.PageParameter) PageResult(com.bc.pmpheep.back.plugin.PageResult) TypeToken(com.google.gson.reflect.TypeToken) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

PageParameter (com.bc.pmpheep.back.plugin.PageParameter)1 PageResult (com.bc.pmpheep.back.plugin.PageResult)1 DeclarationListVO (com.bc.pmpheep.back.vo.DeclarationListVO)1 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)1 Gson (com.google.gson.Gson)1 TypeToken (com.google.gson.reflect.TypeToken)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1