SceneBaseRequest.java
5.29 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
package cn.com.glsx.dj.request.output;
import cn.com.glsx.dj.request.MerchantIdPermissionRequest;
import cn.com.glsx.dj.smartcarlife.enums.SceneTypeEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.google.common.collect.Lists;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Slf4j
public class SceneBaseRequest extends AbstractRopRequest implements Serializable {
private static final long serialVersionUID = -1;
@ApiModelProperty(notes = "业务场景(0.会员权益,1.精品升级),必须,默认会员权益")
private Byte sceneType = SceneTypeEnum.SCENE1_0.getValue();
@ApiModelProperty(notes = "业务类型(1.延保 2.轻改 3.权益)")
private Integer bizs;
@ApiModelProperty(notes = "周期类型(1.按天,2.按周,3.按月,4.自定义,5.按年),必须", required = true)
private Integer cycleType;
@ApiModelProperty(notes = "开始时间", required = true)
private String startTime;
@ApiModelProperty(notes = "结束时间")
private String endTime;
@ApiModelProperty(notes = "车品牌ID")
private Integer carBrandId;
@ApiModelProperty(notes = "省份编码")
private String provinceId;
@ApiModelProperty(notes = "门店类型 1新店 2老店")
private Byte storeType;
@ApiModelProperty(notes = "经营品类 1单品类 2多品类")
private Byte businessCategory;
@ApiModelProperty(notes = "业务性质(1:直营4S店,2:合资收公司,3:服务商")
private Byte businessType;
@ApiModelProperty(notes = "排序")
private String orderBy;
@ApiModelProperty(notes = "排序方式 1.Desc 2.asc")
private Integer orderType;
@ApiModelProperty(notes = "门店号列表")
private List<Integer> merchantIds;
@ApiModelProperty(notes = "门店号聚合")
private Map<String, List<Integer>> merchantMap;
@ApiModelProperty(notes = "员工编号列表")
private List<String> staffUuids;
@ApiModelProperty(notes = "模糊搜索")
private String search;
@ApiModelProperty(notes = "指定指标码(默认无需指定)")
private List<String> itemCodeList;
@ApiModelProperty(notes = "指标数据聚合规则:merchantIds按门店,staffIds按员工(默认无需指定)")
private String exts;
@ApiModelProperty(notes = "查询类型")
private int queryType;
@ApiModelProperty(notes = "是否查询达成率趋势")
private boolean withTargetRatio;
@ApiModelProperty(notes = "是否预估趋势")
private boolean isPredictTrend;
@ApiModelProperty(notes = "兜底预警门店 1.是")
private Byte ddyjMerchantFlag;
@ApiModelProperty(notes = "生态预警门店 1.是")
private Byte styjMerchantFlag;
@ApiModelProperty(notes = "项目组id")
private Integer projectGroupId;
@ApiModelProperty(notes = "预警类型")
private Integer warningType;
/**
* 构建门店过滤条件
*/
public MerchantIdPermissionRequest getMerchantFilter(){
return getMerchantFilter(false);
}
public MerchantIdPermissionRequest getMerchantFilter(boolean withQueryDataStat){
MerchantIdPermissionRequest request = new MerchantIdPermissionRequest();
BeanUtils.copyProperties(this, request);
request.setMerchantNameOrStaffName(search);
request.setCycleTime(startTime);
request.setCycleTimeEnd(endTime);
request.setProvinceCode(provinceId);
request.setMerchantIds(merchantIds);
// request.setIgnorePreCycleTime(true);
request.setQueryWithDataStat(withQueryDataStat);
if (businessType != null) {
switch (businessType){
case 1:
request.setBusinessTypeList(Lists.newArrayList((byte) 2));
break;
case 2:
request.setBusinessTypeList(Lists.newArrayList((byte) 4, (byte) 5, (byte) 7, (byte) 8));
break;
case 3:
request.setBusinessTypeList(Lists.newArrayList((byte) 6));
break;
default:
log.error("不支持的业务性质:{}", businessType);
}
request.setBusinessType(null);
}
return request;
}
/**
* 转换周期传参,适配指标传参
*
* permissionRequest.cycleType:request筛选参数:1.按天,2.按周,3.按月,4.自定义
* queryParams.dataType:指标参数:0,按指定时段;1,按周;2,按月;3,按年;4,全部
*/
@JsonIgnoreProperties
public Integer convertQueryParamCycleType() {
switch (cycleType) {
case 1:
case 4:
return 0;
case 2:
return 1;
case 3:
return 2;
case 5:
return 3;
default:
throw new RpcServiceException("不支持的周期类型");
}
}
}