xin
5 days ago 982313135d1c239fe3b20e4c5664781f92d40aca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.oying.modules.pc.store.domain.dto;
 
import com.oying.utils.StringUtils;
import lombok.Data;
import org.springframework.util.DigestUtils;
 
import java.util.StringJoiner;
 
@Data
public class StoreCustomerQueryCriteria {
 
    private Long storeId;
 
    private Long platformCategoryId;
 
    private String blurry;
 
    private Double longitude; // 中心点经度
 
    private Double latitude;  // 中心点纬度
 
    private Integer radius = 10000; // 搜索半径(米)
 
    private Integer limit = 20; // 返回数量限制
 
    private Integer page = 1;
 
    private Integer size = 10;
 
    public String buildConditionCacheKey() {
        StringJoiner baseKeyJoiner = new StringJoiner("|");
        if (platformCategoryId != null) {
            baseKeyJoiner.add("platformCategoryId=" + platformCategoryId);
        }
        if (StringUtils.isNotEmpty(blurry)) {
            baseKeyJoiner.add("blurry=" + blurry);
        }
        if (longitude != null && latitude != null) {
            baseKeyJoiner.add("longitude=" + longitude);
            baseKeyJoiner.add("latitude=" + latitude);
        }
        if (StringUtils.isNotEmpty(blurry)) {
            baseKeyJoiner.add("radius=" + radius);
        }
        // 使用MD5或SHA缩短键长度
        return "store:search:page:" + DigestUtils.md5DigestAsHex(baseKeyJoiner.toString().getBytes());
    }
 
}