MassConvert.java
3.55 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
package cn.com.glsx.entmicro.converter;
import cn.com.glsx.entmicro.entity.Mass;
import cn.com.glsx.entmicro.entity.MassConditionCrowd;
import cn.com.glsx.entmicro.entity.mass.MassTemplate;
import cn.com.glsx.entmicro.model.request.mass.CustomerInfoRequest;
import cn.com.glsx.entmicro.model.request.mass.MassConditionCrowdRequest;
import cn.com.glsx.entmicro.model.request.mass.MassFollowStaffEchoApi;
import cn.com.glsx.entmicro.model.response.*;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @author wangxw
* @version 1.0.0
* @ClassName MassConvert.java
* @description: ${description}
* @createTime 2021年11月15日 11:03:00
*/
public class MassConvert {
public static MassResponse convertMassData(Mass selectResult) {
MassResponse massResponse = new MassResponse();
BeanUtils.copyProperties(selectResult, massResponse);
return massResponse;
}
public static List<MassTemplateApiResponse> convertMassTemplateData(List<MassTemplate> list){
if (list==null||list.isEmpty()){
return null;
}
List<MassTemplateApiResponse> resp = new ArrayList<>(list.size());
list.forEach(s->{
MassTemplateApiResponse apiResponse = new MassTemplateApiResponse();
BeanUtils.copyProperties(s,apiResponse);
resp.add(apiResponse);
});
return resp;
}
public static List<MassConditionCrowd> convertMassConditionCrowdList(List<MassConditionCrowdRequest> list){
if (list==null){
return null;
}else if (list.isEmpty()){
return new ArrayList<>();
}
List<MassConditionCrowd> resp = new ArrayList<>(list.size());
list.forEach(s->{
MassConditionCrowd apiResponse = new MassConditionCrowd();
BeanUtils.copyProperties(s,apiResponse);
resp.add(apiResponse);
});
return resp;
}
public static List<MassCrowdConditionResponse> convertMassCrowdConditionResponse(List<MassConditionCrowd> list){
if (list==null){
return null;
}else if (list.isEmpty()){
return new ArrayList<>();
}
List<MassCrowdConditionResponse> resp = new ArrayList<>(list.size());
list.forEach(s->{
MassCrowdConditionResponse apiResponse = new MassCrowdConditionResponse();
BeanUtils.copyProperties(s,apiResponse);
resp.add(apiResponse);
});
return resp;
}
public static List<MassFollowStaffEchoApi> convertMassFollowStaffEchoApi(List<StaffFollowResponse> list){
if (list==null){
return null;
}else if (list.isEmpty()){
return new ArrayList<>();
}
List<MassFollowStaffEchoApi> resp = new ArrayList<>(list.size());
list.forEach(s->{
MassFollowStaffEchoApi apiResponse = new MassFollowStaffEchoApi();
BeanUtils.copyProperties(s,apiResponse);
resp.add(apiResponse);
});
return resp;
}
public static List<CustomerInfoResponse> convertCustomerInfoResponse(List<CustomerInfoRequest> list){
if (list==null){
return null;
}else if (list.isEmpty()){
return new ArrayList<>();
}
List<CustomerInfoResponse> resp = new ArrayList<>(list.size());
list.forEach(s->{
CustomerInfoResponse apiResponse = new CustomerInfoResponse();
BeanUtils.copyProperties(s,apiResponse);
resp.add(apiResponse);
});
return resp;
}
}