fwq
2022-08-10 812cb5c916502f02379bb9c0f1475f0cd4977240
人群包查询
1 文件已重命名
3个文件已添加
1个文件已修改
147 ■■■■■ 已修改文件
phis-feign/src/main/java/com/hz/his/dto/dcp/FilterUserDto.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phis-feign/src/main/java/com/hz/his/dto/dcp/FilterUserTagDto.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phis-feign/src/main/java/com/hz/his/dto/dcp/FilterUserTagIdDto.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phis-feign/src/main/java/com/hz/his/feign/service/dcp/SUserTagInfoService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
phis-feign/src/main/java/com/hz/his/util/PageHelperUtil.java 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phis-feign/src/main/java/com/hz/his/dto/dcp/FilterUserDto.java
New file
@@ -0,0 +1,22 @@
package com.hz.his.dto.dcp;
import lombok.Data;
import java.util.List;
@Data
public class FilterUserDto {
    /**总数量*/
    private Integer total;
    /**每页数量*/
    private Integer pages;
    /**页*/
    private Integer pageNum;
    /**每页数量*/
    private Integer pageSize;
    /**是否最后一页*/
    private Boolean isLastPage;
    /**标签列表*/
    private List<FilterUserTagDto> list;
}
phis-feign/src/main/java/com/hz/his/dto/dcp/FilterUserTagDto.java
File was renamed from phis-feign/src/main/java/com/hz/his/dto/dcp/FilterUserTagInfoDto.java
@@ -1,18 +1,14 @@
package com.hz.his.dto.dcp;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import java.util.List;
/**
 * 标签筛选用户数据Dto
 */
@Data
public class FilterUserTagInfoDto {
public class FilterUserTagDto {
    /**排序关键信息 内包含(userId platformCode) 排序结果*/
    private JSONObject id;
    private FilterUserTagIdDto id;
    /**用户编号*/
    private String userNo;
@@ -22,8 +18,4 @@
    /**标签列表*/
    private List<String> tagList;
    public FilterUserTagInfoDto() {
    }
}
phis-feign/src/main/java/com/hz/his/dto/dcp/FilterUserTagIdDto.java
New file
@@ -0,0 +1,18 @@
package com.hz.his.dto.dcp;
import lombok.Data;
/**
 * 标签筛选用户数据Dto
 */
@Data
public class FilterUserTagIdDto {
    private String userId;
    private String platformCode;
    public FilterUserTagIdDto() {
    }
}
phis-feign/src/main/java/com/hz/his/feign/service/dcp/SUserTagInfoService.java
@@ -20,7 +20,7 @@
    @PostMapping("/user/tag/info/list")
    Result userTagInfoListData(@RequestBody UserTagInfoDto userTagInfoDto);
    /**查询用户标签用户列表 返回(FilterUserTagInfoDto)*/
    /**查询用户标签用户列表 返回(FilterUserDto)*/
    @RequestMapping("/user/tag/info/user/list")
    Result userListData(@RequestBody UserTagInfoDto userTagInfoDto);
phis-feign/src/main/java/com/hz/his/util/PageHelperUtil.java
New file
@@ -0,0 +1,93 @@
package com.hz.his.util;
import com.github.pagehelper.PageInfo;
import java.util.List;
/**
 * @author fwq
 * PageHelperTool
 * 分页工具类:对查询结果处理后再进行分页
 */
public class PageHelperUtil {
    public static <T> PageInfo<T> pageInfo(int currentPage, int pageSize, List list) {
        int fromIndex = 0;
        int toIndex = 0;
        //取出总记录数
        int total = list.size();
        //当前页码
        currentPage = (currentPage <= 0) ? 1 : currentPage;
        //当前页条目数
        pageSize = (pageSize <= 0) ? 10 : (Math.min(pageSize, total));
        if (total / pageSize == 0 && total % pageSize > 0) {
            fromIndex = 0;
            toIndex = total;
        } else {
            if (total / pageSize >= 1 && total % pageSize >= 0) {
                fromIndex = pageSize * (currentPage - 1);
                if (pageSize * currentPage >= total) {
                    toIndex = total;
                } else {
                    toIndex = pageSize * currentPage;
                }
            }
        }
        List pageList = list.subList(fromIndex, toIndex);
        PageInfo pageInfo = new PageInfo<>(pageList);
        return initPageInfoObj(currentPage, total, pageSize, pageInfo);
    }
    private static <T> PageInfo<T> initPageInfoObj(int currentPage, int total, int pageSize, PageInfo<T> pageInfo) {
        pageInfo.setNextPage(currentPage < ((total + pageSize - 1) / pageSize) ? currentPage + 1 : currentPage);
        pageInfo.setTotal(total);
        pageInfo.setPageNum(currentPage);
        pageInfo.setPages((total + pageSize - 1) / pageSize);
        pageInfo.setPrePage(currentPage > 1 ? currentPage - 1 : currentPage);
        pageInfo.setIsFirstPage(currentPage == 1);
        pageInfo.setIsLastPage(currentPage == (total + pageSize - 1) / pageSize);
        pageInfo.setHasPreviousPage(currentPage != 1);
        pageInfo.setHasNextPage(currentPage != (total + pageSize - 1) / pageSize);
        return calcNavigatepageNums(pageInfo);
    }
    private static <T> PageInfo<T> calcNavigatepageNums(PageInfo<T> pageInfo) {
        //当总页数小于或等于导航页码数时
        if (pageInfo.getPages() <= pageInfo.getNavigatePages()) {
            pageInfo.setNavigatepageNums(new int[pageInfo.getPages()]);
            for (int i = 0; i < pageInfo.getPages(); i++) {
                pageInfo.getNavigatepageNums()[i] = i + 1;
            }
        } else { //当总页数大于导航页码数时
            pageInfo.setNavigatepageNums(new int[pageInfo.getNavigatePages()]);
            int startNum = pageInfo.getPageNum() - pageInfo.getNavigatePages() / 2;
            int endNum = pageInfo.getPageNum() + pageInfo.getNavigatePages() / 2;
            if (startNum < 1) {
                startNum = 1;
                //(最前navigatePages页
                for (int i = 0; i < pageInfo.getNavigatePages(); i++) {
                    pageInfo.getNavigatepageNums()[i] = startNum++;
                }
            } else if (endNum > pageInfo.getPages()) {
                endNum = pageInfo.getPages();
                //最后navigatePages页
                for (int i = pageInfo.getNavigatePages() - 1; i >= 0; i--) {
                    pageInfo.getNavigatepageNums()[i] = endNum--;
                }
            } else {
                //所有中间页
                for (int i = 0; i < pageInfo.getNavigatePages(); i++) {
                    pageInfo.getNavigatepageNums()[i] = startNum++;
                }
            }
        }
        return pageInfo;
    }
}