Преглед изворни кода

Solr检索优化
返回结果方法优化

suxiaoyang пре 6 година
родитељ
комит
7a9daa78b4

+ 98 - 32
commons-data-solr/src/main/java/com/yihu/ehr/solr/SolrUtil.java

@ -38,20 +38,20 @@ public class SolrUtil {
    /**
     * 简单查询方法
     */
    public SolrDocumentList query(String tableName, String q, Map<String, String> sort, long start, long rows) throws Exception {
        return query(tableName, q, null, sort, start, rows, null);
    public SolrDocumentList query(String core, String q, Map<String, String> sort, long start, long rows) throws Exception {
        return query(core, q, null, sort, start, rows, null);
    }
    /**
     * 简单查询返回字段
     */
    public SolrDocumentList queryReturnFieldList(String tableName, String q, String fq, Map<String, String> sort, long start, long rows, String... fields) throws Exception {
        return query(tableName, q, fq, sort, start, rows, fields);
    public SolrDocumentList queryReturnFieldList(String core, String q, String fq, Map<String, String> sort, long start, long rows, String... fields) throws Exception {
        return query(core, q, fq, sort, start, rows, fields);
    }
    /**
     * Solr查询方法
     *
     * @param core
     * @param q      查询字符串
     * @param fq     过滤查询
     * @param sort   排序
@ -63,32 +63,89 @@ public class SolrUtil {
    public SolrDocumentList query(String core, String q, String fq, Map<String, String> sort, long start, long rows, String... fields) throws Exception {
        SolrClient conn = pool.getConnection(core);
        SolrQuery query = new SolrQuery();
        if (null != q && !q.equals("")) { //设置查询条件
        //设置查询条件
        if (StringUtils.isNotEmpty(q)) {
            query.setQuery(q);
        } else {
            query.setQuery("*:*");
        }
        if (null != fq && !fq.equals("")) { //设置过滤条件
        //设置过滤条件
        if (StringUtils.isNotEmpty(fq)) {
            query.setFilterQueries(fq);
        }
        query.setFields(fields);
        query.setStart(Integer.parseInt(String.valueOf(start)));//设置查询起始行
        query.setRows(Integer.parseInt(String.valueOf(rows)));//设置查询行数
        //设置查询起始行
        query.setStart(Integer.parseInt(String.valueOf(start)));
        //设置查询行数
        query.setRows(Integer.parseInt(String.valueOf(rows)));
        //设置排序
        if (sort != null) {
            for (Object co : sort.keySet()) {
                if (ASC == sort.get(co).toLowerCase() || ASC.equals(sort.get(co).toLowerCase())) {
                if (ASC.equals(sort.get(co).toLowerCase())) {
                    query.addSort(co.toString(), SolrQuery.ORDER.asc);
                } else {
                    query.addSort(co.toString(), SolrQuery.ORDER.desc);
                }
            }
        }
        QueryResponse rsp = conn.query(query);
        SolrDocumentList docs = rsp.getResults();
        return docs;
    }
    /**
     * Solr查询方法
     * @param core
     * @param q 查询字符串
     * @param fq 过滤查询
     * @param sort 排序
     * @param start 查询起始行
     * @param rows 查询行数
     * @param hl 高亮字段
     * @param fields 返回字段
     * @return
     * @throws Exception
     */
    public QueryResponse highlight(String core, String q, String fq, Map<String, String> sort, long start, long rows, String hl, String... fields) throws Exception {
        SolrClient conn = pool.getConnection(core);
        SolrQuery query = new SolrQuery();
        //设置查询条件
        if (StringUtils.isNotEmpty(q)) {
            query.setQuery(q);
        } else {
            query.setQuery("*:*");
        }
        //设置过滤条件
        if (StringUtils.isNotEmpty(fq)) {
            query.setFilterQueries(fq);
        }
        query.setFields(fields);
        //设置查询起始行
        query.setStart(Integer.parseInt(String.valueOf(start)));
        //设置查询行数
        query.setRows(Integer.parseInt(String.valueOf(rows)));
        //设置排序
        if (sort != null) {
            for (Object co : sort.keySet()) {
                if (ASC.equals(sort.get(co).toLowerCase())) {
                    query.addSort(co.toString(), SolrQuery.ORDER.asc);
                } else {
                    query.addSort(co.toString(), SolrQuery.ORDER.desc);
                }
            }
        }
        //高亮
        if (StringUtils.isNotEmpty(hl)) {
            query.addHighlightField(hl);
            query.setHighlightSimplePre("<em>");
            query.setHighlightSimplePost("</em>");
        }
        QueryResponse rsp = conn.query(query);
        return rsp;
    }
    /**
@ -167,14 +224,12 @@ public class SolrUtil {
        SolrClient conn = pool.getConnection(core);
        SolrQuery query = new SolrQuery();
        List<Group> groups = queryDistinctOneField(core, q, fq, sort, start, rows, fields, groupField, groupSort);
        QueryResponse response = conn.query(query);
        GroupResponse groupResponse = response.getGroupResponse();
        if (groupResponse != null) {
            List<GroupCommand> groupList = groupResponse.getValues();
            for (GroupCommand groupCommand : groupList) {
                groups = groupCommand.getValues();
                List<Group> groups = groupCommand.getValues();
                for (Group group : groups) {
                    if (group.getResult().size() > 0) {
                        solrDocumentList.add(group.getResult().get(0));
@ -209,8 +264,10 @@ public class SolrUtil {
            query.setFilterQueries(fq);
        }
        query.setStart(Integer.parseInt(String.valueOf(start)));//设置查询起始行
        query.setRows(Integer.parseInt(String.valueOf(rows)));//设置查询行数
        //设置查询起始行
        query.setStart(Integer.parseInt(String.valueOf(start)));
        //设置查询行数
        query.setRows(Integer.parseInt(String.valueOf(rows)));
        //设置排序
        if (sort != null) {
@ -241,7 +298,8 @@ public class SolrUtil {
    public long count(String core, String q, String fq) throws Exception {
        SolrClient conn = pool.getConnection(core);
        SolrQuery query = new SolrQuery();
        if (null != q && !q.equals("")) { //设置查询条件
        //设置查询条件
        if (null != q && !q.equals("")) {
            query.setQuery(q);
        } else {
            query.setQuery("*:*");
@ -254,9 +312,6 @@ public class SolrUtil {
        QueryResponse rsp = conn.query(query);
        long count = rsp.getResults().getNumFound();
        //query.setStart(start);
        //rsp = conn.query(query);
        //SolrDocumentList docs = rsp.getResults();
        return count;
    }
@ -282,13 +337,17 @@ public class SolrUtil {
        if (null != fq && !fq.equals("")) {
            query.setFilterQueries(fq);
        }
        query.setFacet(true);//设置facet=on
        //设置facet=on
        query.setFacet(true);
        query.setRows(0);
        query.addFacetField(groupField);
        query.setFacetLimit(limit);//限制每次返回结果数
        //限制每次返回结果数
        query.setFacetLimit(limit);
        query.set(FacetParams.FACET_OFFSET, start);
        query.setFacetMissing(false);//不统计null的值
        query.setFacetMinCount(0);// 设置返回的数据中每个分组的数据最小值,比如设置为0,则统计数量最小为0,不然不显示
        //不统计null的值
        query.setFacetMissing(false);
        // 设置返回的数据中每个分组的数据最小值,比如设置为0,则统计数量最小为0,不然不显示
        query.setFacetMinCount(0);
        QueryResponse rsp = conn.query(query);
        List<FacetField.Count> countList = rsp.getFacetField(groupField).getValues();
        Map<String, Long> rmap = new HashMap<>();
@ -320,13 +379,17 @@ public class SolrUtil {
            query.setFilterQueries(fq);
        }
        query.setFacet(true);//设置facet=on
        //设置facet=on
        query.setFacet(true);
        query.setRows(0);
        query.addFacetField(groupFields);
        query.setFacetLimit(-1); // 限制每次返回结果数
        // 限制每次返回结果数
        query.setFacetLimit(-1);
        query.set(FacetParams.FACET_OFFSET, 0);
        query.setFacetMissing(false); // 不统计null的值
        query.setFacetMinCount(0); // 设置返回的数据中每个分组的数据最小值,比如设置为0,则统计数量最小为0,不然不显示
        // 不统计null的值
        query.setFacetMissing(false);
        // 设置返回的数据中每个分组的数据最小值,比如设置为0,则统计数量最小为0,不然不显示
        query.setFacetMinCount(0);
        QueryResponse rsp = conn.query(query);
        return rsp.getFacetFields();
@ -354,14 +417,17 @@ public class SolrUtil {
        if (null != fq && !fq.equals("")) {
            query.setFilterQueries(fq);
        }
        query.setFacet(true);//设置facet=on
        //设置facet=on
        query.setFacet(true);
        query.setRows(0);
        query.addFacetPivotField(groupFields);
        query.set(FacetParams.FACET_OFFSET, start);
        query.setFacetLimit(limit);//限制每次返回结果数
        query.setFacetMissing(false);//不统计null的值
        query.setFacetMinCount(0);// 设置返回的数据中每个分组的数据最小值,比如设置为0,则统计数量最小为0,不然不显示
        //限制每次返回结果数
        query.setFacetLimit(limit);
        //不统计null的值
        query.setFacetMissing(false);
        // 设置返回的数据中每个分组的数据最小值,比如设置为0,则统计数量最小为0,不然不显示
        query.setFacetMinCount(0);
        QueryResponse rsp = conn.query(query);
        NamedList<List<PivotField>> namedList = rsp.getFacetPivot();

+ 101 - 25
commons-profile-core/src/main/java/com/yihu/ehr/profile/family/ResourceCells.java

@ -7,38 +7,113 @@ import java.util.Arrays;
import java.util.List;
/**
 * Created by progr1mmer on 2018/6/9.
 * @author progr1mmer
 * @date Created on 2018/6/9.
 */
public class ResourceCells {
    public static final String ROWKEY = "rowkey";
    //Basic
    public static final String PROFILE_ID = "profile_id"; //档案主索引
    public static final String PROFILE_TYPE = "profile_type"; //档案类型
    public static final String EVENT_NO = "event_no"; //事件号
    public static final String EVENT_DATE = "event_date"; //事件时间
    public static final String EVENT_TYPE = "event_type"; //事件类型
    public static final String CARD_ID = "card_id"; //就诊卡号
    public static final String CARD_TYPE = "card_type"; //就诊卡类型
    public static final String PATIENT_ID = "patient_id"; //病人ID
    public static final String PATIENT_NAME = "patient_name"; //病人姓名
    public static final String DEMOGRAPHIC_ID = "demographic_id"; //身份证号码
    public static final String ORG_CODE = "org_code"; //机构编码
    public static final String ORG_NAME = "org_name"; //机构名称
    public static final String ORG_AREA = "org_area"; //机构地区
    public static final String CDA_VERSION = "cda_version"; //CDA版本
    public static final String CREATE_DATE = "create_date"; //创建时间
    public static final String DIAGNOSIS = "diagnosis"; //ICD10诊断代码
    public static final String DIAGNOSIS_NAME = "diagnosis_name"; //ICD10诊断名称
    public static final String HEALTH_PROBLEM = "health_problem"; //健康问题诊断代码
    public static final String HEALTH_PROBLEM_NAME = "health_problem_name"; //健康问题诊断名称
    public static final String DEPT_CODE = "dept_code"; //科室编码
    public static final String SUB_ROWKEYS = "sub_rowkeys"; //细表索引
    public static final String PATIENT_AGE = "patient_age"; //就诊年龄
    public static final String PATIENT_SEX = "patient_sex"; //患者性别
    /**
     * 档案主索引
     */
    public static final String PROFILE_ID = "profile_id";
    /**
     * 档案类型
     */
    public static final String PROFILE_TYPE = "profile_type";
    /**
     * 事件号
     */
    public static final String EVENT_NO = "event_no";
    /**
     * 事件时间
     */
    public static final String EVENT_DATE = "event_date";
    /**
     * 事件类型
     */
    public static final String EVENT_TYPE = "event_type";
    /**
     * 就诊卡号
     */
    public static final String CARD_ID = "card_id";
    /**
     * 就诊卡类型
     */
    public static final String CARD_TYPE = "card_type";
    /**
     * 病人ID
     */
    public static final String PATIENT_ID = "patient_id";
    /**
     * 病人姓名
     */
    public static final String PATIENT_NAME = "patient_name";
    /**
     * 身份证号码
     */
    public static final String DEMOGRAPHIC_ID = "demographic_id";
    /**
     * 机构编码
     */
    public static final String ORG_CODE = "org_code";
    /**
     * 机构名称
     */
    public static final String ORG_NAME = "org_name";
    /**
     * 机构地区
     */
    public static final String ORG_AREA = "org_area";
    /**
     * CDA版本
     */
    public static final String CDA_VERSION = "cda_version";
    /**
     * 创建时间
     */
    public static final String CREATE_DATE = "create_date";
    /**
     * ICD10诊断代码
     */
    public static final String DIAGNOSIS = "diagnosis";
    /**
     * ICD10诊断名称
     */
    public static final String DIAGNOSIS_NAME = "diagnosis_name";
    /**
     * 健康问题诊断代码
     */
    public static final String HEALTH_PROBLEM = "health_problem";
    /**
     * 健康问题诊断名称
     */
    public static final String HEALTH_PROBLEM_NAME = "health_problem_name";
    /**
     * 科室编码
     */
    public static final String DEPT_CODE = "dept_code";
    /**
     * 细表索引
     */
    public static final String SUB_ROWKEYS = "sub_rowkeys";
    /**
     * 就诊年龄
     */
    public static final String PATIENT_AGE = "patient_age";
    /**
     * 患者性别
     */
    public static final String PATIENT_SEX = "patient_sex";
    /**
     * 全文检索字段
     */
    public static final String SEARCH_FIELD = "search_field";
    //RawFiles
    public static final String CDA_DOCUMENT_ID = "cda_document_id";
    public static final String CDA_DOCUMENT_NAME = "cda_document_name";
    public static final String FILE_LIST = "file_list";
@ -68,7 +143,8 @@ public class ResourceCells {
                        DIAGNOSIS,
                        DIAGNOSIS_NAME,
                        HEALTH_PROBLEM,
                        HEALTH_PROBLEM_NAME
                        HEALTH_PROBLEM_NAME,
                        SEARCH_FIELD
                ));
            case File:
                return new ArrayList<>(Arrays.asList(

+ 48 - 45
commons-util/src/main/java/com/yihu/ehr/util/rest/Envelop.java

@ -1,6 +1,8 @@
package com.yihu.ehr.util.rest;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
@ -17,34 +19,63 @@ import java.util.List;
 *
 * @author llh
 */
public class Envelop implements Serializable{
public class Envelop<T, J> implements Serializable{
    private static final long serialVersionUID = 2076324875575488461L;
    private boolean successFlg;
    private int pageSize = 10;
    private int pageSize = 15;
    private int currPage;
    private int currPage = 1;
    private int totalPage;
    private int totalCount;
    private List detailModelList;
    private List<T> detailModelList = new ArrayList<>();
    private Object obj;
    private J obj = (J) new HashMap<>(0);
    private String errorMsg;
    private int errorCode;
    public Object getObj() {
        return obj;
    public boolean isSuccessFlg() {
        return successFlg;
    }
    public void setObj(Object obj) {
        this.obj = obj;
    public void setSuccessFlg(boolean successFlg) {
        this.successFlg = successFlg;
    }
    public int getPageSize() {
        return pageSize;
    }
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
    public int getCurrPage() {
        return currPage;
    }
    public void setCurrPage(int currPage) {
        this.currPage = currPage;
    }
    public int getTotalPage() {
        if (totalCount % pageSize > 0) {
            totalPage = totalCount / pageSize + 1;
        } else {
            totalPage = totalCount / pageSize;
        }
        return totalPage;
    }
    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }
    public int getTotalCount() {
@ -55,20 +86,20 @@ public class Envelop implements Serializable{
        this.totalCount = totalCount;
    }
    public boolean isSuccessFlg() {
        return successFlg;
    public List<T> getDetailModelList() {
        return detailModelList;
    }
    public void setSuccessFlg(boolean successFlg) {
        this.successFlg = successFlg;
    public void setDetailModelList(List<T> detailModelList) {
        this.detailModelList = detailModelList;
    }
    public List getDetailModelList() {
        return detailModelList;
    public J getObj() {
        return obj;
    }
    public void setDetailModelList(List detailModelList) {
        this.detailModelList = detailModelList;
    public void setObj(J obj) {
        this.obj = obj;
    }
    public String getErrorMsg() {
@ -87,32 +118,4 @@ public class Envelop implements Serializable{
        this.errorCode = errorCode;
    }
    public int getPageSize() {
        return pageSize;
    }
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
    public int getCurrPage() {
        return currPage;
    }
    public void setCurrPage(int currPage) {
        this.currPage = currPage;
    }
    public int getTotalPage() {
        if (totalCount % pageSize == 0) {
            totalPage = totalCount / pageSize;
        } else {
            totalPage = totalCount / pageSize + 1;
        }
        return totalPage;
    }
    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }
}

+ 30 - 16
commons-web/src/main/java/com/yihu/ehr/controller/BaseRestEndPoint.java

@ -40,7 +40,34 @@ public class BaseRestEndPoint extends AbstractController {
    }
    /**
     * 将实体转换为模型。
     * 字符串转实体
     *
     * @param json
     * @param entityCls
     * @param <T>
     * @return
     * @throws IOException
     */
    protected <T> T toEntity(String json, Class<T> entityCls) throws IOException {
        objectMapper.setDateFormat(new SimpleDateFormat(DateTimeUtil.simpleDateTimePattern));
        T entity = objectMapper.readValue(json, entityCls);
        return entity;
    }
    /**
     * 实体转字符串
     *
     * @param obj
     * @return
     * @throws JsonProcessingException
     */
    protected String toJson(Object obj) throws JsonProcessingException {
        return objectMapper.writeValueAsString(obj);
    }
    /**
     * 将实体转换为模型
     *
     * @param source
     * @param targetCls
@ -57,19 +84,8 @@ public class BaseRestEndPoint extends AbstractController {
        return target;
    }
    protected <T> T toEntity(String json, Class<T> entityCls) throws IOException {
        objectMapper.setDateFormat(new SimpleDateFormat(DateTimeUtil.simpleDateTimePattern));
        T entity = objectMapper.readValue(json, entityCls);
        return entity;
    }
    protected String toJson(Object obj) throws JsonProcessingException {
        return objectMapper.writeValueAsString(obj);
    }
    /**
     * 将实体集合转换为模型集合。
     * 将实体集合转换为模型集合
     *
     * @param sources
     * @param targets
@ -84,12 +100,10 @@ public class BaseRestEndPoint extends AbstractController {
        Iterator iterator = sources.iterator();
        while (iterator.hasNext()) {
            Object source = iterator.next();
            T target = (T) BeanUtils.instantiate(targetCls);
            T target = BeanUtils.instantiate(targetCls);
            BeanUtils.copyProperties(source, target, propertyDiffer(StringUtils.isEmpty(properties) ? null : properties.split(","), targetCls));
            targets.add(target);
        }
        return targets;
    }

+ 83 - 28
commons-web/src/main/java/com/yihu/ehr/controller/EnvelopRestEndPoint.java

@ -7,6 +7,8 @@ import com.yihu.ehr.util.rest.Envelop;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
@ -26,6 +28,69 @@ public class EnvelopRestEndPoint extends BaseRestEndPoint {
    @Value("${deploy.region}")
    protected Short deployRegion = 3502;
    protected <T, J> Envelop<T, J> success(List<T> contents){
        return success(contents, (J)new HashMap<>(0));
    }
    protected <T, J, _T> Envelop<_T, J> success(List<T> contents, Class<_T> targetContents) {
        List<_T> _contents = (List)convertToModels(contents, new ArrayList<>(contents.size()), targetContents, null);
        return success(_contents);
    }
    protected <T, J> Envelop<T, J> success(J obj){
        return success(new ArrayList<T>(0), obj);
    }
    protected <T, J, _J> Envelop<T, _J> success(J obj, Class<_J> targetObj) {
        _J _obj = convertToModel(obj, targetObj);
        return success(_obj);
    }
    protected <T, J> Envelop<T, J> success(List<T> contents, J obj){
        return success(contents, obj, contents.size(), 1, contents.size());
    }
    protected <T, J, _T, _J> Envelop<_T, _J> success(List<T> contents, J obj, Class<_T> targetContents, Class<_J> targetObj) {
        List<_T> _contents = (List)convertToModels(contents, new ArrayList<>(contents.size()), targetContents, null);
        _J _obj = convertToModel(obj, targetObj);
        return success(_contents, _obj);
    }
    protected <T, J> Envelop<T, J> success(List<T> contents, int totalCount, int currPage, int rows) {
        return success(contents, (J)new HashMap<>(0), totalCount, currPage, rows);
    }
    protected <T, J, _T> Envelop<_T, J> success(List<T> contents, int totalCount, int currPage, int rows, Class<_T> targetContents) {
        List<_T> _contents = (List)convertToModels(contents, new ArrayList<>(contents.size()), targetContents, null);
        return success(_contents, totalCount, currPage, rows);
    }
    protected <T, J> Envelop<T, J> success(List<T> contents, J obj, int totalCount, int currPage, int rows) {
        Envelop<T, J> envelop = new Envelop<>();
        envelop.setSuccessFlg(true);
        envelop.setPageSize(rows);
        envelop.setCurrPage(currPage);
        envelop.setTotalCount(totalCount);
        envelop.setDetailModelList(contents);
        envelop.setObj(obj);
        return envelop;
    }
    protected <T, J, _T, _J> Envelop<_T, _J> success(List<T> contents, J obj, int totalCount, int currPage, int pageSize, Class<_T> targetContents, Class<_J> targetObj) {
        List<_T> _contents = (List)convertToModels(contents, new ArrayList<>(contents.size()), targetContents, null);
        _J _obj = convertToModel(obj, targetObj);
        return success(_contents, _obj, totalCount, currPage, pageSize);
    }
    @Deprecated
    protected Envelop success(Object object, List list){
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(true);
        envelop.setObj(object);
        envelop.setDetailModelList(list);
        return envelop;
    }
    /**
     * 返回一个信封对象。信封对象的返回场景参见 Envelop.
     *
@ -33,6 +98,7 @@ public class EnvelopRestEndPoint extends BaseRestEndPoint {
     * @param totalCount
     * @return
     */
    @Deprecated
    protected Envelop getResult(List modelList, int totalCount) {
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(true);
@ -41,6 +107,7 @@ public class EnvelopRestEndPoint extends BaseRestEndPoint {
        return envelop;
    }
    @Deprecated
    protected Envelop getPageResult(List detailModelList, int totalCount, int currPage, int rows) {
        Envelop result = new Envelop();
        result.setSuccessFlg(true);
@ -56,43 +123,31 @@ public class EnvelopRestEndPoint extends BaseRestEndPoint {
        return result;
    }
    protected Envelop failed(String errMsg){
        return failed(errMsg, ErrorCode.REQUEST_NOT_COMPLETED.value());
    protected <T, J> Envelop<T, J> failed(String errMsg){
        return failed(errMsg, -1);
    }
    protected Envelop failed(String errMsg, int errorCode){
        return failed(errMsg, errorCode, null);
    protected <T, J> Envelop<T, J> failed(String errMsg, int errorCode){
        return failed(errMsg, errorCode, (J)new HashMap<>(0));
    }
    protected Envelop failed(String errMsg, Object object){
        return failed(errMsg, ErrorCode.REQUEST_NOT_COMPLETED.value(), object);
    protected <T, J> Envelop<T, J> failed(String errMsg, J obj){
        return failed(errMsg, -1, obj);
    }
    protected Envelop failed(String errMsg, int errorCode, Object object){
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(false);
    protected <T, J> Envelop<T, J> failed(String errMsg, int errorCode, J obj){
        Envelop<T, J> envelop = new Envelop<>();
        envelop.setErrorMsg(errMsg);
        envelop.setErrorCode(errorCode);
        envelop.setObj(object);
        return envelop;
    }
    protected Envelop success(Object object){
        return success(object, null);
    }
    protected Envelop success(List list){
        return success(null, list);
    }
    protected Envelop success(Object object, List list){
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(true);
        envelop.setObj(object);
        envelop.setDetailModelList(list);
        envelop.setObj(obj);
        return envelop;
    }
    /**
     * 获取obj ID
     * @param bizObject
     * @return
     */
    protected String getObjectId(BizObject bizObject){
        return new ObjectId(deployRegion, bizObject).toString();
    }
@ -103,11 +158,11 @@ public class EnvelopRestEndPoint extends BaseRestEndPoint {
     * @return
     */
    protected String getRandomString(int length) {
        String str = "abcdefghigklmnopkrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ0123456789";
        String str = "abcdefghijklmnopkrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            int number = random.nextInt(str.length() - 1);//0~61
            int number = random.nextInt(str.length() - 1);
            buffer.append(str.charAt(number));
        }
        return buffer.toString();