ShouldBeCompletedQuery.java
2.45 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package cn.fw.valhalla.sdk.param;
import lombok.Data;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotBlank;
import java.time.YearMonth;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 应成交台数查询
*
* @author : kurisu
* @version : 1.0
* @className : ShouldBeCompletedQuery
* @description : 应成交台数查询
* @date : 2022-10-20 11:33
*/
@Data
public class ShouldBeCompletedQuery {
private final static String SEPARATOR = ",";
/**
* 跟进人员id
*/
private Long userId;
/**
* 门店ids
*/
@NotBlank(message = "门店不能为空")
private String shopIds;
/**
* 跟进开始时间 [时间戳 默认为本月月初]
*/
private Long startTime;
/**
* 跟进截止时间 [时间戳 默认为本月月底]
*/
private Long endTime;
public String getStartTime() {
if (Objects.isNull(startTime)) {
long second = YearMonth.now().atDay(1).atStartOfDay(ZoneId.systemDefault()).toEpochSecond();
return String.valueOf(second);
}
String timeStr = String.valueOf(startTime);
return timeStr.length() >= 10 ? timeStr.substring(0, 10) : timeStr;
}
public String getEndTime() {
if (Objects.isNull(endTime)) {
long second = YearMonth.now().atEndOfMonth().atStartOfDay(ZoneId.systemDefault()).toEpochSecond();
return String.valueOf(second);
}
String timeStr = String.valueOf(endTime);
return timeStr.length() >= 10 ? timeStr.substring(0, 10) : timeStr;
}
public List<Long> getShopId() {
return Arrays.stream(shopIds.split(SEPARATOR)).map(Long::valueOf).collect(Collectors.toList());
}
/**
* 设置门店
*
* @param shopId 门店id数组
*/
public void setShopId(final Long... shopId) {
if (shopId == null || shopId.length == 0) {
return;
}
this.shopIds = Arrays.stream(shopId).map(String::valueOf).collect(Collectors.joining(SEPARATOR));
}
/**
* 设置门店
*
* @param shopIdList 门店id集合
*/
public void setShopId(final List<Long> shopIdList) {
if (CollectionUtils.isEmpty(shopIdList)) {
return;
}
this.shopIds = shopIdList.stream().map(String::valueOf).collect(Collectors.joining(SEPARATOR));
}
}