PickUpPointServiceImpl.java
11.3 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
package com.diligrp.website.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Resource;
import com.diligrp.website.dao.PickUpCityDao;
import com.diligrp.website.dao.PickUpPointDao;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import com.diligrp.website.domain.PickUpCity;
import com.diligrp.website.domain.PickUpPerson;
import com.diligrp.website.domain.PickUpPointDomain;
import com.diligrp.website.manager.PickUpCityManager;
import com.diligrp.website.manager.PickUpPointManager;
import com.diligrp.website.service.PickUpPointService;
import com.diligrp.website.util.dao.BaseQuery;
import com.diligrp.website.util.web.PageTemplate;
/**
* <B>Description</B> TODO <br />
* <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
* 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
* <B>Company</B> 地利集团
*
* @author liujie
* @createTime 2014年8月13日 下午5:03:50
*/
@Service
public class PickUpPointServiceImpl implements PickUpPointService {
@Resource
private PickUpPointManager pickUpPointManager;
@Resource
private PickUpCityManager pickUpCityManager;
/*
* (non-Javadoc)
* @see
* com.diligrp.website.service.PickUpPointService#getPickInfo(com.diligrp
* .website.util.dao.BaseQuery)
*/
@Override
public PageTemplate getPickInfo(BaseQuery bq) {
try {
PageTemplate page = new PageTemplate();
List<PickUpPointDomain> list = pickUpPointManager.getPickInfo(bq);
for (int i = 0; i < list.size(); i++) {
list.get(i).getPersonList();
}
Integer totalSize = pickUpPointManager.getCountPickInfo(bq);
page.setList(list);
page.setCurrPage(bq.getCurrPage());
page.setPageSize(bq.getPageSize());
page.setTotalSize(totalSize);
page.setQuery(bq);
return page;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/*
* (non-Javadoc)
* @see
* com.diligrp.website.service.PickUpPointService#getCountPickInfo(com.diligrp
* .website.util.dao.BaseQuery)
*/
@Override
public Integer getCountPickInfo(BaseQuery bq) {
try {
return pickUpPointManager.getCountPickInfo(bq);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/*
* (non-Javadoc)
* @see
* com.diligrp.website.service.PickUpPointService#savePickUpInfo(com.diligrp
* .website.domain.PickUpPointDomain)
*/
@Override
public boolean savePickUpInfo(PickUpPointDomain pickUpPointDomain,
List<String> personName, List<String> personTel, String cityDetail) {
try {
List<PickUpPerson> personlist = new ArrayList<PickUpPerson>();
for (int i = 0; i < personName.size(); i++) {
PickUpPerson person = new PickUpPerson();
person.setContactName(personName.get(i).toString());
person.setContactPhone(personTel.get(i).toString());
personlist.add(person);
}
if (!StringUtils.isBlank(cityDetail)) {
List<PickUpCity> citylist = new ArrayList<PickUpCity>();
String[] city = cityDetail.split(",");
List<?> list = Arrays.asList(city);
for (int i = 0; i < list.size(); i++) {
PickUpCity pickCity = new PickUpCity();
pickCity.setCityId(Long.parseLong(String.valueOf(list
.get(i))));
citylist.add(pickCity);
}
pickUpPointDomain.setCityList(citylist);
}
pickUpPointDomain.setPersonList(personlist);
pickUpPointDomain.setRecommend(1);
return pickUpPointManager.savePickUpInfo(pickUpPointDomain);
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/*
* (non-Javadoc)
* @see
* com.diligrp.website.service.PickUpPointService#modifyPickUpInfo(com.diligrp
* .website.domain.PickUpPointDomain)
*/
@Override
public boolean modifyPickUpInfo(PickUpPointDomain pickUpPointDomain,
List<String> personName, List<String> personTel, String cityDetail) {
try {
List<PickUpPerson> personlist = new ArrayList<PickUpPerson>();
for (int i = 0; i < personName.size(); i++) {
PickUpPerson person = new PickUpPerson();
person.setContactName(personName.get(i).toString());
person.setContactPhone(personTel.get(i).toString());
personlist.add(person);
}
if (!StringUtils.isBlank(cityDetail)) {
List<PickUpCity> citylist = new ArrayList<PickUpCity>();
String[] city = cityDetail.split(",");
List<String> list = Arrays.asList(city);
for (int i = 0; i < list.size(); i++) {
PickUpCity pickCity = new PickUpCity();
pickCity.setCityId(Long.parseLong(String.valueOf(list
.get(i))));
citylist.add(pickCity);
}
pickUpPointDomain.setCityList(citylist);
}
pickUpPointDomain.setPersonList(personlist);
return pickUpPointManager.modifyPickUpInfo(pickUpPointDomain);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
/*
* (non-Javadoc)
* @see
* com.diligrp.website.service.PickUpPointService#modifyPickUpInfoDeafult
* (com.diligrp.website.domain.PickUpPointDomain)
*/
@Override
public boolean modifyPickUpInfoDeafult(Long id) {
try {
return pickUpPointManager.modifyPickUpInfoDeafult(id);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
/*
* (non-Javadoc)
* @see
* com.diligrp.website.service.PickUpPointService#getPickUpPointDomainInfo
* (java.lang.Long)
*/
@Override
public PickUpPointDomain getPickUpPointDomainInfo(Long id) {
try {
return pickUpPointManager.getPickUpPointDomainInfo(id);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/*
* (non-Javadoc)
* @see
* com.diligrp.website.service.PickUpPointService#getRelationPickInfo(java
* .lang.Long)
*/
@Override
public List<PickUpPointDomain> getRelationPickInfo(Long id) {
try {
return pickUpPointManager.getRelationPickInfo(id);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/*
* (non-Javadoc)
* @see
* com.diligrp.website.service.PickUpPointService#getNotMarketPickInfo()
*/
@Override
public List<PickUpPointDomain> getNotMarketPickInfo(Long pid) {
try {
List<PickUpPointDomain> list = pickUpPointManager.getRelationPickInfo(pid);
List<PickUpPointDomain> pickList = pickUpPointManager.getNotMarketPickInfo();
list.addAll(pickList);
return list;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/*
* (non-Javadoc)
* @see
* com.diligrp.website.service.PickUpPointService#modifyRelationPoint(java
* .util.Map)
*/
@Override
public boolean modifyRelationPoint(List<Long> list, Long pickId) {
try {
return pickUpPointManager.modifyRelationPoint(list, pickId);
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/* (non-Javadoc)
* @see com.diligrp.website.service.PickUpPointService#getIsMarketPickUpInfo()
*/
@Override
public List<PickUpPointDomain> getIsMarketPickUpInfo() {
try {
return pickUpPointManager.getIsMarketPickUpInfo();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/* (non-Javadoc)
* @see com.diligrp.website.service.PickUpPointService#getIsNotMarketPickUpInfo()
*/
@Override
public List<PickUpPointDomain> getIsNotMarketPickUpInfo() throws Exception {
return pickUpPointManager.getIsNotMarketPickUpInfo();
}
/* (non-Javadoc)
* @see com.diligrp.website.service.PickUpPointService#getAllMarketPickUpInfo()
*/
@Override
public List<PickUpPointDomain> getAllMarketPickUpInfo() throws Exception {
return pickUpPointManager.getAllMarketPickUpInfo();
}
/* (non-Javadoc)
* @see com.diligrp.website.service.PickUpPointService#getCodeByPickUpInfo(java.lang.String)
*/
@Override
public PickUpPointDomain getCodeByPickUpInfo(String code) throws Exception {
return pickUpPointManager.getCodeByPickUpInfo(code);
}
@Override
public PickUpPointDomain getPickInfoByCityId(Long cityId) throws Exception {
PickUpCity pickUpCity = pickUpCityManager.getPickIdByCityId(cityId);
if (pickUpCity != null) {
return pickUpPointManager.getPickUpPointDomainInfo(pickUpCity.getPickId());
} else {
return pickUpPointManager.getDefaultPickUpInfo();
}
}
@Override
public List<PickUpPointDomain> getPickUpInfoByName(String pickName) {
return pickUpPointManager.getPickUpInfoByName(pickName);
}
@Override
public List<PickUpPointDomain> getRecommendPickUp() {
return pickUpPointManager.getRecommendPickUp();
}
@Override
public List<PickUpPointDomain> getPickUpListByCityId(Long cityId) {
List<PickUpCity> pickUpCityList = pickUpCityManager.getPickUpIdListByCityId(cityId);
List<PickUpPointDomain> pickList = new ArrayList<PickUpPointDomain>();
if (pickUpCityList != null && pickUpCityList.size() > 0) {
for (int i = 0; i < pickUpCityList.size(); i++) {
PickUpCity pickUpCity = pickUpCityList.get(i);
try {
PickUpPointDomain pickUpPointDomain = pickUpPointManager.getPickUpPointDomainInfo(pickUpCity.getPickId());
pickList.add(pickUpPointDomain);
} catch (Exception e) {
e.printStackTrace();
}
}
return pickList;
}
return null;
}
@Override
public boolean configRecommend(PickUpPointDomain pickUpPointDomain) {
try {
return pickUpPointManager.configRecommend(pickUpPointDomain);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
@Override
public List<PickUpPointDomain> getPickUpInfoByCityName(String cityName) {
return pickUpPointManager.getPickUpInfoByCityName(cityName);
}
@Override
public List<PickUpPointDomain> getAllPickUpListByCityId(Long cityId) {
return pickUpPointManager.getAllPickUpListByCityId(cityId);
}
}