|
@@ -11,12 +11,9 @@ import com.github.pagehelper.PageHelper;
|
11
|
11
|
import com.google.common.collect.Lists;
|
12
|
12
|
import com.google.common.collect.Maps;
|
13
|
13
|
import lombok.extern.slf4j.Slf4j;
|
14
|
|
-import org.apache.commons.collections.ListUtils;
|
15
|
|
-import org.apache.commons.lang.ObjectUtils;
|
16
|
14
|
import org.springframework.beans.BeanUtils;
|
17
|
15
|
import org.springframework.beans.factory.annotation.Autowired;
|
18
|
16
|
import org.springframework.stereotype.Service;
|
19
|
|
-import sun.security.krb5.internal.Ticket;
|
20
|
17
|
|
21
|
18
|
import java.util.List;
|
22
|
19
|
import java.util.Map;
|
|
@@ -36,17 +33,12 @@ public class TicketServiceImpl implements ITicketService {
|
36
|
33
|
private TpTicketRecordCommentMapper tpTicketRecordCommentMapper;
|
37
|
34
|
|
38
|
35
|
@Override
|
39
|
|
- public ResponseBean getList(TpTicket tpTicket,Integer pageCode, Integer pageSize) {
|
|
36
|
+ public ResponseBean getList(TpTicket tpTicket,Integer pageNum, Integer pageSize) {
|
40
|
37
|
|
41
|
38
|
ResponseBean<Map<String,Object>> responseBean = new ResponseBean();
|
42
|
39
|
// 最终返回值
|
43
|
40
|
Map<String,Object> result = Maps.newHashMap();
|
44
|
41
|
|
45
|
|
- // 查询参数
|
46
|
|
- Map<String,Object> lastRecordMap = Maps.newHashMap();
|
47
|
|
- lastRecordMap.put("size",1);
|
48
|
|
-
|
49
|
|
-
|
50
|
42
|
Map<String,Object> parameter = Maps.newHashMap();
|
51
|
43
|
parameter.put("communityId",tpTicket.getCommunityId());
|
52
|
44
|
parameter.put("taUserId",tpTicket.getTaUserId());
|
|
@@ -55,66 +47,26 @@ public class TicketServiceImpl implements ITicketService {
|
55
|
47
|
|
56
|
48
|
|
57
|
49
|
// 报修
|
58
|
|
- PageHelper.startPage(pageCode,pageSize);
|
|
50
|
+ PageHelper.startPage(pageNum,pageSize);
|
59
|
51
|
List<TpTicket> tpTicketRepairsList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
|
60
|
|
-
|
61
|
52
|
List<TpTicketVO> repairsList = Lists.newArrayList();
|
62
|
|
- tpTicketRepairsList.stream().forEach(e->{
|
63
|
|
- TpTicketVO tpTicketVO = new TpTicketVO();
|
64
|
|
- BeanUtils.copyProperties(e,tpTicketVO);
|
65
|
|
- // 设置工单编号
|
66
|
|
- lastRecordMap.put("tickerId",e.getId());
|
67
|
|
- TpTicketRecordComment comment = getTicketRecordComment(lastRecordMap);
|
68
|
|
- if (null != comment) {
|
69
|
|
- tpTicketVO.setCommentContent(comment.getContent());
|
70
|
|
- tpTicketVO.setCommentCreateDate(comment.getCreateDate());
|
71
|
|
- }
|
72
|
|
-
|
73
|
|
-
|
74
|
|
- repairsList.add(tpTicketVO);
|
75
|
|
- });
|
|
53
|
+ tpTicketVOConvert(tpTicketRepairsList,repairsList);
|
76
|
54
|
|
77
|
55
|
// 投诉
|
78
|
56
|
// 0 代表 报修 1 代表 投诉 2代表 联系单
|
79
|
57
|
parameter.put("type",1);
|
80
|
|
- PageHelper.startPage(pageCode,pageSize);
|
|
58
|
+ PageHelper.startPage(pageNum,pageSize);
|
81
|
59
|
List<TpTicket> tpTicketComplaintList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
|
82
|
|
-
|
83
|
60
|
List<TpTicketVO> complaintList = Lists.newArrayList();
|
84
|
|
- tpTicketComplaintList.stream().forEach(e->{
|
85
|
|
- TpTicketVO tpTicketVO = new TpTicketVO();
|
86
|
|
- BeanUtils.copyProperties(e,tpTicketVO);
|
87
|
|
- // 设置工单编号
|
88
|
|
- lastRecordMap.put("tickerId",e.getId());
|
89
|
|
- TpTicketRecordComment comment = getTicketRecordComment(lastRecordMap);
|
90
|
|
- if (null != comment) {
|
91
|
|
- tpTicketVO.setCommentContent(comment.getContent());
|
92
|
|
- tpTicketVO.setCommentCreateDate(comment.getCreateDate());
|
93
|
|
- }
|
94
|
|
-
|
95
|
|
- complaintList.add(tpTicketVO);
|
96
|
|
- });
|
|
61
|
+ tpTicketVOConvert(tpTicketComplaintList, complaintList);
|
97
|
62
|
|
98
|
63
|
// 联系工单
|
99
|
64
|
// 0 代表 报修 1 代表 投诉 2代表 联系单
|
100
|
65
|
parameter.put("type",2);
|
101
|
|
- PageHelper.startPage(pageCode,pageSize);
|
|
66
|
+ PageHelper.startPage(pageNum,pageSize);
|
102
|
67
|
List<TpTicket> tpTicketLiaisonList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
|
103
|
|
-
|
104
|
68
|
List<TpTicketVO> liaisonList = Lists.newArrayList();
|
105
|
|
- tpTicketLiaisonList.stream().forEach(e->{
|
106
|
|
- TpTicketVO tpTicketVO = new TpTicketVO();
|
107
|
|
- BeanUtils.copyProperties(e,tpTicketVO);
|
108
|
|
- // 设置工单编号
|
109
|
|
- lastRecordMap.put("tickerId",e.getId());
|
110
|
|
- TpTicketRecordComment comment = getTicketRecordComment(lastRecordMap);
|
111
|
|
- if (null != comment) {
|
112
|
|
- tpTicketVO.setCommentContent(comment.getContent());
|
113
|
|
- tpTicketVO.setCommentCreateDate(comment.getCreateDate());
|
114
|
|
- }
|
115
|
|
-
|
116
|
|
- liaisonList.add(tpTicketVO);
|
117
|
|
- });
|
|
69
|
+ tpTicketVOConvert(tpTicketLiaisonList, liaisonList);
|
118
|
70
|
|
119
|
71
|
result.put("repairs",repairsList);
|
120
|
72
|
result.put("complaint",complaintList);
|
|
@@ -136,29 +88,32 @@ public class TicketServiceImpl implements ITicketService {
|
136
|
88
|
?null:list.get(0);
|
137
|
89
|
}
|
138
|
90
|
|
139
|
|
-// public <T> List<T> setTicketData(T t, List<Ticket> source, Map map){
|
140
|
|
-// List<T> list = Lists.newArrayList();
|
141
|
|
-//
|
142
|
|
-// // 查询参数
|
143
|
|
-// Map<String,Object> lastRecordMap = Maps.newHashMap();
|
144
|
|
-// lastRecordMap.put("size",1);
|
145
|
|
-//
|
146
|
|
-// source.stream().forEach(e->{
|
147
|
|
-// TpTicketVO tpTicketVO = new TpTicketVO();
|
148
|
|
-// BeanUtils.copyProperties(e,tpTicketVO);
|
149
|
|
-// // 设置工单编号
|
150
|
|
-// lastRecordMap.put("tickerId",e.getId());
|
151
|
|
-// TpTicketRecordComment comment = getTicketRecordComment(lastRecordMap);
|
152
|
|
-// if (null != comment) {
|
153
|
|
-// tpTicketVO.setCommentContent(comment.getContent());
|
154
|
|
-// tpTicketVO.setCommentCreateDate(comment.getCreateDate());
|
155
|
|
-// }
|
156
|
|
-//
|
157
|
|
-// liaisonList.add(tpTicketVO);
|
158
|
|
-// });
|
159
|
|
-
|
160
|
|
-
|
161
|
|
- //return list;
|
162
|
|
- //}
|
|
91
|
+ /**
|
|
92
|
+ * 数据转换,并填充数据
|
|
93
|
+ * @param target
|
|
94
|
+ * @param source
|
|
95
|
+ * @return
|
|
96
|
+ */
|
|
97
|
+ public void tpTicketVOConvert(List<TpTicket> source, List<TpTicketVO> target){
|
|
98
|
+
|
|
99
|
+ // 查询参数
|
|
100
|
+ Map<String,Object> lastRecordMap = Maps.newHashMap();
|
|
101
|
+ // 表示查询出最新的一条
|
|
102
|
+ lastRecordMap.put("size",1);
|
|
103
|
+
|
|
104
|
+ source.stream().forEach(e->{
|
|
105
|
+ TpTicketVO tpTicketVO = new TpTicketVO();
|
|
106
|
+ BeanUtils.copyProperties(e,tpTicketVO);
|
|
107
|
+ // 设置工单编号
|
|
108
|
+ lastRecordMap.put("tickerId",e.getId());
|
|
109
|
+ TpTicketRecordComment comment = getTicketRecordComment(lastRecordMap);
|
|
110
|
+ if (null != comment) {
|
|
111
|
+ tpTicketVO.setCommentContent(comment.getContent());
|
|
112
|
+ tpTicketVO.setCommentCreateDate(comment.getCreateDate());
|
|
113
|
+ }
|
|
114
|
+
|
|
115
|
+ target.add(tpTicketVO);
|
|
116
|
+ });
|
|
117
|
+ }
|
163
|
118
|
|
164
|
119
|
}
|