提交 | 用户 | age
|
4f0006
|
1 |
package com.yc.sdk.shopping.action.jiazhuang; |
J |
2 |
|
c19dc5
|
3 |
import java.text.ParseException; |
4f0006
|
4 |
import java.text.SimpleDateFormat; |
c19dc5
|
5 |
import java.util.Date; |
4f0006
|
6 |
import java.util.List; |
J |
7 |
import java.util.stream.Collectors; |
|
8 |
|
|
9 |
import javax.servlet.http.HttpServletRequest; |
|
10 |
import javax.servlet.http.HttpServletResponse; |
|
11 |
import javax.servlet.http.HttpSession; |
|
12 |
|
|
13 |
import org.slf4j.Logger; |
|
14 |
import org.slf4j.LoggerFactory; |
|
15 |
import org.springframework.beans.factory.annotation.Autowired; |
|
16 |
import org.springframework.context.annotation.Scope; |
|
17 |
import org.springframework.dao.DataAccessException; |
|
18 |
import org.springframework.stereotype.Controller; |
|
19 |
import org.springframework.web.bind.annotation.GetMapping; |
c19dc5
|
20 |
import org.springframework.web.bind.annotation.RequestBody; |
4f0006
|
21 |
import org.springframework.web.bind.annotation.RequestMapping; |
J |
22 |
|
|
23 |
import com.google.gson.JsonArray; |
|
24 |
import com.google.gson.JsonObject; |
|
25 |
import com.yc.action.BaseAction; |
|
26 |
import com.yc.entity.DataSourceEntity; |
17b39f
|
27 |
import com.yc.exception.ApplicationException; |
4f0006
|
28 |
import com.yc.multiData.MultiDataSource; |
J |
29 |
import com.yc.multiData.SpObserver; |
|
30 |
import com.yc.sdk.miniapp.entity.LiveGoodsEntity; |
|
31 |
import com.yc.sdk.miniapp.entity.LiveReplayVideoEntity; |
|
32 |
import com.yc.sdk.miniapp.entity.LiveRoomEntity; |
|
33 |
import com.yc.sdk.miniapp.entity.LiveRoomEntity.RoomInfo; |
|
34 |
import com.yc.sdk.miniapp.service.MaLiveIfc; |
|
35 |
import com.yc.sdk.shopping.action.api.LiveRoomVideo; |
|
36 |
import com.yc.sdk.shopping.action.api.ShopCcCode; |
c19dc5
|
37 |
import com.yc.sdk.shopping.entity.CreateLiveRoomParameterStep1Entity; |
J |
38 |
import com.yc.sdk.shopping.entity.CreateLiveRoomParameterStep2Entity; |
|
39 |
import com.yc.sdk.shopping.entity.CreateLiveRoomParameterStep3Entity; |
|
40 |
import com.yc.sdk.shopping.entity.CreateLiveRoomResultEntity; |
4f0006
|
41 |
import com.yc.sdk.shopping.entity.PanicBuyingEntity; |
J |
42 |
import com.yc.sdk.shopping.entity.SettingEntity; |
|
43 |
import com.yc.sdk.shopping.entity.ShopCcCodeEntity; |
|
44 |
import com.yc.sdk.shopping.service.SettingIfc; |
|
45 |
import com.yc.sdk.shopping.service.panicBuying.PanicBuyingIfc; |
|
46 |
import com.yc.sdk.shopping.util.SettingKey; |
b8896c
|
47 |
import com.yc.sdk.shopping.util.StringLengthUtil; |
4f0006
|
48 |
import com.yc.utils.SessionKey; |
b8896c
|
49 |
|
J |
50 |
import me.chanjar.weixin.common.error.WxErrorException; |
|
51 |
|
4f0006
|
52 |
import com.yc.factory.FactoryBean; |
J |
53 |
|
|
54 |
@Controller |
|
55 |
@Scope("prototype") |
|
56 |
@RequestMapping("/shopping/panicBuyingLive/") |
|
57 |
public class PanicBuyingLive extends BaseAction{ |
|
58 |
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
59 |
@Autowired |
|
60 |
MaLiveIfc maLiveIfc ; |
|
61 |
|
|
62 |
@Autowired |
|
63 |
SettingIfc settingIfc; |
|
64 |
@Autowired |
|
65 |
PanicBuyingIfc panicBuyingIfc; |
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
/** |
|
70 |
* 获取我的直播间列信息(包含已经创建和未创建的,用于新建直接间) |
|
71 |
* @param request |
|
72 |
* @param response |
|
73 |
*/ |
|
74 |
@GetMapping("/getLiveRoomListForOpenId.do") |
|
75 |
public void getLiveRoomListForOpenId(HttpServletRequest request, HttpServletResponse response) { |
|
76 |
HttpSession session=request.getSession(); |
|
77 |
JsonObject json = new JsonObject(); |
|
78 |
JsonObject errJson = new JsonObject(); |
|
79 |
//String roomId = request.getParameter("roomid") ; |
|
80 |
//String docCode = request.getParameter(SettingKey.DOCCODE) ; |
|
81 |
String hostUrl = SettingKey.getHostUrl(request); |
|
82 |
|
|
83 |
//String userCode = (String) session.getAttribute(SessionKey.HRCODE) ; |
|
84 |
String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID) == null ? "": (String) session.getAttribute(SessionKey.WEIXIN_OPENID)); |
|
85 |
try { |
|
86 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
87 |
SpObserver.setDBtoInstance("_"+dataSourceEntity.getDbId());//切换数据源 |
|
88 |
|
|
89 |
//刷新房间及状态信息 ,不需要刷新,因为设置了定时刷新功能 |
|
90 |
//refreshLiveRoom(dataSourceEntity); |
|
91 |
|
22907b
|
92 |
//SettingEntity settingEntity = settingIfc.getSettingEntity(request) ; |
4f0006
|
93 |
|
J |
94 |
//取网店 shopcccode |
|
95 |
//ShopCcCodeEntity shopCcCodeEntity = ShopCcCode.getShopCcCode(settingEntity,request); |
|
96 |
|
|
97 |
//重新获取房间列表 |
|
98 |
//直播计划 |
|
99 |
LiveRoomEntity dataList = maLiveIfc.getLiveRoomListForOpenId(openId) ; |
|
100 |
List<RoomInfo> liveList = dataList.getRoomInfo().stream().filter(s->s.getLiveStatus()==null||s.getLiveStatus().intValue()==101||s.getLiveStatus().intValue()==102).collect(Collectors.toList()); |
|
101 |
JsonArray liveRoomListArray = new JsonArray(); |
|
102 |
for (int i = 0 ; liveList!= null && i < liveList.size();i++) { |
|
103 |
RoomInfo roomInfo = liveList.get(i) ; |
|
104 |
|
|
105 |
JsonObject jsonItem = getRoomJsonObject( roomInfo, hostUrl, dataSourceEntity.getDbId()); |
|
106 |
liveRoomListArray.add(jsonItem) ; |
|
107 |
} |
|
108 |
json.add("liveList", liveRoomListArray); |
|
109 |
|
|
110 |
//历史直播 |
|
111 |
List<RoomInfo> historyList = dataList.getRoomInfo().stream().filter(s->s.getLiveStatus()!=null&&s.getLiveStatus().intValue()!=101&&s.getLiveStatus().intValue()!=102).collect(Collectors.toList()); |
|
112 |
JsonArray historyRoomListArray = new JsonArray(); |
|
113 |
for (int i = 0 ; historyList!= null && i < historyList.size();i++) { |
|
114 |
RoomInfo roomInfo = historyList.get(i) ; |
|
115 |
|
|
116 |
JsonObject jsonItem = getRoomJsonObject( roomInfo, hostUrl, dataSourceEntity.getDbId()); |
|
117 |
historyRoomListArray.add(jsonItem) ; |
|
118 |
} |
|
119 |
json.add("historyList", historyRoomListArray); |
|
120 |
|
|
121 |
|
|
122 |
json.addProperty("state", "success"); |
|
123 |
this.printJson(response, json.toString()); |
|
124 |
return; |
|
125 |
}catch (Exception e) { |
|
126 |
this.logger.error(e.getMessage(), e); |
|
127 |
e.printStackTrace(); |
|
128 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())+"【/shopping/live/getLiveRoomListForMe.do】"); |
|
129 |
json.add("error", errJson); |
|
130 |
this.printJson(response, json.toString()); |
|
131 |
}finally { |
|
132 |
SpObserver.setDBtoInstance(); |
|
133 |
} |
|
134 |
} |
|
135 |
|
|
136 |
/** |
|
137 |
* 获取直播间明细 |
|
138 |
* @param request |
|
139 |
* @param response |
|
140 |
*/ |
|
141 |
@GetMapping("/getLiveRoomDetailByDocCode.do") |
|
142 |
public void getLiveRoomDetailByDocCode(HttpServletRequest request, HttpServletResponse response) { |
|
143 |
//HttpSession session=request.getSession(); |
|
144 |
JsonObject json = new JsonObject(); |
|
145 |
JsonObject errJson = new JsonObject(); |
|
146 |
//String roomId = request.getParameter("roomid") ; |
|
147 |
String docCode = request.getParameter(SettingKey.DOCCODE) ; |
|
148 |
String hostUrl = SettingKey.getHostUrl(request); |
|
149 |
|
|
150 |
//String userCode = (String) session.getAttribute(SessionKey.HRCODE) ; |
|
151 |
try { |
|
152 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
153 |
SpObserver.setDBtoInstance("_"+dataSourceEntity.getDbId());//切换数据源 |
|
154 |
|
|
155 |
//刷新房间及状态信息 ,不需要刷新,因为设置了定时刷新功能 |
|
156 |
//refreshLiveRoom(dataSourceEntity); |
|
157 |
|
22907b
|
158 |
//SettingEntity settingEntity = settingIfc.getSettingEntity(request) ; |
4f0006
|
159 |
|
J |
160 |
//取网店 shopcccode |
|
161 |
//ShopCcCodeEntity shopCcCodeEntity = ShopCcCode.getShopCcCode(settingEntity,request); |
|
162 |
|
|
163 |
//重新获取房间列表 |
|
164 |
LiveRoomEntity liveRoomList = maLiveIfc.getLiveRoom(docCode) ; |
|
165 |
JsonArray roomListArray = new JsonArray(); |
|
166 |
for (int i = 0 ; liveRoomList!= null && liveRoomList.getRoomInfo() != null && i < liveRoomList.getRoomInfo().size();i++) { |
|
167 |
RoomInfo roomInfo = liveRoomList.getRoomInfo().get(i) ; |
|
168 |
|
|
169 |
JsonObject jsonItem = getRoomJsonObject( roomInfo, hostUrl, dataSourceEntity.getDbId()); |
|
170 |
roomListArray.add(jsonItem) ; |
|
171 |
} |
|
172 |
json.add("list", roomListArray); |
|
173 |
json.addProperty("state", "success"); |
|
174 |
this.printJson(response, json.toString()); |
|
175 |
return; |
|
176 |
}catch (Exception e) { |
|
177 |
this.logger.error(e.getMessage(), e); |
|
178 |
e.printStackTrace(); |
|
179 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())+"【/shopping/live/getLiveRoomListForMe.do】"); |
|
180 |
json.add("error", errJson); |
|
181 |
this.printJson(response, json.toString()); |
|
182 |
}finally { |
|
183 |
SpObserver.setDBtoInstance(); |
|
184 |
} |
|
185 |
} |
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
|
191 |
/** |
|
192 |
* 获取所有直播间信息(已经创建了的直播间) |
|
193 |
* @param request |
|
194 |
* @param response |
|
195 |
*/ |
|
196 |
@GetMapping("/getLiveRoomList.do") |
|
197 |
public void getLiveRoomList(HttpServletRequest request, HttpServletResponse response) { |
|
198 |
HttpSession session=request.getSession(); |
|
199 |
JsonObject json = new JsonObject(); |
|
200 |
JsonObject errJson = new JsonObject(); |
|
201 |
String roomId = request.getParameter("roomid") ; |
|
202 |
String docCode = request.getParameter(SettingKey.DOCCODE) ; |
|
203 |
String hostUrl = SettingKey.getHostUrl(request); |
|
204 |
|
|
205 |
@Deprecated |
|
206 |
String isShowBannerPhotoOnHomePage = request.getParameter("isShowBannerPhotoOnHomePage") ; //是否只显示带有首页广告的直播间信息: true , false |
|
207 |
|
|
208 |
String userCode = (String) session.getAttribute(SessionKey.HRCODE) ; |
|
209 |
String isShowOwnerLiveRoom = request.getParameter("isShowOwnerLiveRoom") ; //只显示自己的直播间 ,包括没有正式创建成功的,因为没创建成功的记录可以再次创建 |
|
210 |
try { |
|
211 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
212 |
SpObserver.setDBtoInstance("_"+dataSourceEntity.getDbId());//切换数据源 |
|
213 |
|
|
214 |
//刷新房间及状态信息 ,不需要刷新,因为设置了定时刷新功能 |
|
215 |
//refreshLiveRoom(dataSourceEntity); |
|
216 |
|
22907b
|
217 |
SettingEntity settingEntity = settingIfc.getSettingEntity(request) ; |
4f0006
|
218 |
|
J |
219 |
//取网店 shopcccode |
|
220 |
ShopCcCodeEntity shopCcCodeEntity = ShopCcCode.getShopCcCode(settingEntity,request); |
|
221 |
|
|
222 |
//重新获取房间列表 |
|
223 |
LiveRoomEntity liveRoomList = maLiveIfc.getLiveRoomList(roomId==null?null:Integer.valueOf(roomId),shopCcCodeEntity.getShopCcCode(), |
|
224 |
isShowBannerPhotoOnHomePage!=null&&"true".equalsIgnoreCase(isShowBannerPhotoOnHomePage), |
|
225 |
isShowOwnerLiveRoom!=null&&"true".equalsIgnoreCase(isShowOwnerLiveRoom), |
|
226 |
userCode,docCode) ; |
|
227 |
JsonArray roomListArray = new JsonArray(); |
|
228 |
for (int i = 0 ; liveRoomList!= null && liveRoomList.getRoomInfo() != null && i < liveRoomList.getRoomInfo().size();i++) { |
|
229 |
RoomInfo roomInfo = liveRoomList.getRoomInfo().get(i) ; |
|
230 |
if (isShowOwnerLiveRoom==null||!"true".equalsIgnoreCase(isShowOwnerLiveRoom) ) { |
bff6b6
|
231 |
if (roomInfo.getId() == null&& (docCode==null||"".equals(docCode))) { |
4f0006
|
232 |
continue; |
J |
233 |
} |
|
234 |
} |
|
235 |
|
|
236 |
JsonObject jsonItem = getRoomJsonObject( roomInfo, hostUrl, dataSourceEntity.getDbId()); |
|
237 |
roomListArray.add(jsonItem) ; |
|
238 |
} |
|
239 |
json.add("list", roomListArray); |
|
240 |
json.addProperty("state", "success"); |
|
241 |
this.printJson(response, json.toString()); |
|
242 |
return; |
|
243 |
}catch (Exception e) { |
|
244 |
this.logger.error(e.getMessage(), e); |
|
245 |
e.printStackTrace(); |
|
246 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())+"【/shopping/live/getLiveRoomList.do】"); |
|
247 |
json.add("error", errJson); |
|
248 |
this.printJson(response, json.toString()); |
|
249 |
}finally { |
|
250 |
SpObserver.setDBtoInstance(); |
|
251 |
} |
|
252 |
} |
|
253 |
|
|
254 |
|
|
255 |
/** |
|
256 |
* 我的商品库 |
|
257 |
* @param request |
|
258 |
* @param response |
|
259 |
*/ |
|
260 |
@RequestMapping("/getGoodsListForMe.do") |
|
261 |
public void getGoodsListForMe(HttpServletRequest request, HttpServletResponse response) { |
|
262 |
HttpSession session = request.getSession(); |
|
263 |
JsonObject json = new JsonObject(); |
|
264 |
JsonObject errJson = new JsonObject(); |
|
265 |
String hostUrl = SettingKey.getHostUrl(request); |
|
266 |
try { |
|
267 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
268 |
SpObserver.setDBtoInstance("_"+dataSourceEntity.getDbId());//切换数据源 |
22907b
|
269 |
//SettingEntity settingEntity = settingIfc.getSettingEntity(request) ; |
4f0006
|
270 |
|
J |
271 |
String openId = (String)session.getAttribute(SessionKey.WEIXIN_OPENID); |
|
272 |
JsonArray jsonArray = new JsonArray(); |
|
273 |
List<LiveGoodsEntity> list = maLiveIfc.getGoodsListForMe(openId) ; |
|
274 |
for (int i = 0; list!=null&& i < list.size(); i++) { |
|
275 |
LiveGoodsEntity liveGoodsEntity = list.get(i) ; |
|
276 |
jsonArray.add(LiveRoomVideo.getGoodsJsonObject( liveGoodsEntity, hostUrl, dataSourceEntity.getDbId()+"") ); |
|
277 |
} |
|
278 |
json.add("list", jsonArray); |
|
279 |
this.printJson(response, json.toString()); |
|
280 |
return ; |
|
281 |
} catch (DataAccessException e) { |
|
282 |
this.logger.error(e.getMessage(), e); |
|
283 |
e.printStackTrace(); |
|
284 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())+"【/shopping/live/getGoodsListForMe.do】"); |
|
285 |
json.add("error", errJson); |
|
286 |
this.printJson(response, json.toString()); |
|
287 |
return ; |
|
288 |
}catch (Exception e) { |
|
289 |
this.logger.error(e.getMessage(), e); |
|
290 |
e.printStackTrace(); |
|
291 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())+"【/shopping/live/getGoodsListForMe.do】"); |
|
292 |
json.add("error", errJson); |
|
293 |
this.printJson(response, json.toString()); |
|
294 |
return ; |
|
295 |
}finally { |
|
296 |
SpObserver.setDBtoInstance(); |
|
297 |
} |
|
298 |
} |
|
299 |
|
|
300 |
|
|
301 |
/** |
|
302 |
* 直播间商品列表 |
|
303 |
* @param request |
|
304 |
* @param response |
|
305 |
*/ |
|
306 |
@RequestMapping("/goodsListInRoom.do") |
|
307 |
public void goodsListInRoom(HttpServletRequest request, HttpServletResponse response) { |
|
308 |
//HttpSession session = request.getSession(); |
|
309 |
JsonObject json = new JsonObject(); |
|
310 |
JsonObject errJson = new JsonObject(); |
|
311 |
//CallBackMessage callBackMessage=new CallBackMessage(); |
|
312 |
String roomId = request.getParameter("roomid") ; |
|
313 |
//String goodsId = request.getParameter("goodsid") ; |
|
314 |
//String onSaleStr = request.getParameter("onSale") ; |
|
315 |
//String nickName = request.getParameter("nickName") ; |
|
316 |
//String goodsId = request.getParameter("goodsid") ; |
|
317 |
if (roomId == null || "".equals(roomId) || "null".equals(roomId)) { |
|
318 |
errJson.addProperty("warning","必须指定 roomid 参数【/shopping/live/goodsListInRoom.do】"); |
|
319 |
json.add("error", errJson); |
|
320 |
this.printJson(response, json.toString()); |
|
321 |
return ; |
|
322 |
} |
|
323 |
|
|
324 |
String hostUrl = SettingKey.getHostUrl(request); |
|
325 |
try { |
|
326 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
327 |
SpObserver.setDBtoInstance("_"+dataSourceEntity.getDbId());//切换数据源 |
|
328 |
|
|
329 |
List<LiveGoodsEntity> list = maLiveIfc.getGoodsListInRoom(Integer.parseInt(roomId)); |
|
330 |
JsonArray goodsJsonArray = new JsonArray(); |
|
331 |
for (int i = 0;list!=null&& i < list.size(); i++) { |
|
332 |
LiveGoodsEntity liveGoodsEntity = list.get(i) ; |
|
333 |
|
|
334 |
goodsJsonArray.add(LiveRoomVideo.getGoodsJsonObject( liveGoodsEntity, hostUrl, dataSourceEntity.getDbId()+"") ); |
|
335 |
|
|
336 |
} |
|
337 |
json.add("list", goodsJsonArray); |
|
338 |
|
|
339 |
json.addProperty("state", "success"); |
|
340 |
this.printJson(response, json.toString()); |
|
341 |
} catch (DataAccessException e) { |
|
342 |
this.logger.error(e.getMessage(), e); |
|
343 |
e.printStackTrace(); |
|
344 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())+"【/shopping/live/goodsListInRoom.do】"); |
|
345 |
json.add("error", errJson); |
|
346 |
this.printJson(response, json.toString()); |
|
347 |
return ; |
|
348 |
}catch (Exception e) { |
|
349 |
this.logger.error(e.getMessage(), e); |
|
350 |
e.printStackTrace(); |
|
351 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())+"【/shopping/live/goodsListInRoom.do】"); |
|
352 |
json.add("error", errJson); |
|
353 |
this.printJson(response, json.toString()); |
|
354 |
return ; |
|
355 |
}finally { |
|
356 |
SpObserver.setDBtoInstance(); |
|
357 |
} |
|
358 |
} |
|
359 |
|
|
360 |
|
|
361 |
|
|
362 |
/** |
|
363 |
* 获取可导入直播间的商品 |
|
364 |
* @param request |
|
365 |
* @param response |
|
366 |
*/ |
|
367 |
@RequestMapping("/getGoodsListForImportRoom.do") |
|
368 |
public void getGoodsListForImportRoom(HttpServletRequest request, HttpServletResponse response) { |
|
369 |
HttpSession session = request.getSession(); |
|
370 |
JsonObject json = new JsonObject(); |
|
371 |
JsonObject errJson = new JsonObject(); |
|
372 |
String hostUrl = SettingKey.getHostUrl(request); |
|
373 |
String roomId = request.getParameter("roomid") ; |
|
374 |
if (roomId == null||"".equals(roomId)) { |
|
375 |
errJson.addProperty("warning","请传递 roomid 参数【/shopping/live/getGoodsListForImportRoom.do】"); |
|
376 |
json.add("error", errJson); |
|
377 |
this.printJson(response, json.toString()); |
|
378 |
return ; |
|
379 |
} |
|
380 |
|
|
381 |
try { |
|
382 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
383 |
SpObserver.setDBtoInstance("_"+dataSourceEntity.getDbId());//切换数据源 |
22907b
|
384 |
//SettingEntity settingEntity = settingIfc.getSettingEntity(request) ; |
4f0006
|
385 |
|
J |
386 |
String openId = (String)session.getAttribute(SessionKey.WEIXIN_OPENID); |
|
387 |
JsonArray jsonArray = new JsonArray(); |
|
388 |
List<LiveGoodsEntity> list = maLiveIfc.getGoodsListForImportRoom(Integer.parseInt(roomId),openId) ; |
|
389 |
for (int i = 0; list!=null&& i < list.size(); i++) { |
|
390 |
LiveGoodsEntity liveGoodsEntity = list.get(i) ; |
|
391 |
jsonArray.add(LiveRoomVideo.getGoodsJsonObject( liveGoodsEntity, hostUrl, dataSourceEntity.getDbId()+"") ); |
|
392 |
} |
|
393 |
json.add("list", jsonArray); |
|
394 |
this.printJson(response, json.toString()); |
|
395 |
return ; |
|
396 |
} catch (DataAccessException e) { |
|
397 |
this.logger.error(e.getMessage(), e); |
|
398 |
e.printStackTrace(); |
|
399 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())+"【/shopping/live/getGoodsListForImportRoom.do】"); |
|
400 |
json.add("error", errJson); |
|
401 |
this.printJson(response, json.toString()); |
|
402 |
return ; |
|
403 |
}catch (Exception e) { |
|
404 |
this.logger.error(e.getMessage(), e); |
|
405 |
e.printStackTrace(); |
|
406 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())+"【/shopping/live/getGoodsListForImportRoom.do】"); |
|
407 |
json.add("error", errJson); |
|
408 |
this.printJson(response, json.toString()); |
|
409 |
return ; |
|
410 |
}finally { |
|
411 |
SpObserver.setDBtoInstance(); |
|
412 |
} |
|
413 |
} |
|
414 |
|
|
415 |
|
|
416 |
|
|
417 |
/** |
|
418 |
* 获取可导入商品库的活动列表 |
|
419 |
* @param request |
|
420 |
* @param response |
|
421 |
*/ |
|
422 |
@RequestMapping("/getPanicBuyingListForImportGoods.do") |
|
423 |
//@RequestMapping("/shopping/live/getPanicBuyingListForLiveGoods.do") |
|
424 |
public void getPanicBuyingListForImportGoods(HttpServletRequest request, HttpServletResponse response) { |
|
425 |
HttpSession session = request.getSession(); |
|
426 |
JsonObject json = new JsonObject(); |
|
427 |
JsonObject errJson = new JsonObject(); |
|
428 |
//String cltCode = (session.getAttribute(SettingKey.CLTCODE) == null?"": (String)session.getAttribute(SettingKey.CLTCODE)) ; |
|
429 |
String hostUrl = SettingKey.getHostUrl(request); |
|
430 |
String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID) == null ? "": (String) session.getAttribute(SessionKey.WEIXIN_OPENID)); |
|
431 |
|
|
432 |
DataSourceEntity dataSourceEntity ; |
|
433 |
try { |
|
434 |
dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
435 |
}catch (DataAccessException e) { |
|
436 |
errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); |
|
437 |
json.add("error", errJson); |
|
438 |
this.printJson(response, json.toString()); |
|
439 |
return; |
|
440 |
}catch (Exception e ){ |
|
441 |
errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); |
|
442 |
json.add("error", errJson); |
|
443 |
this.printJson(response, json.toString()); |
|
444 |
return; |
|
445 |
} |
|
446 |
|
|
447 |
try { |
|
448 |
SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());// 切换数据源 |
|
449 |
//SettingEntity settingEntity = settingIfc.getSettingEntity(); |
|
450 |
|
|
451 |
List<PanicBuyingEntity> dataList = panicBuyingIfc.getPanicBuyingListForImportGoods(openId) ; |
|
452 |
//草稿 |
|
453 |
JsonArray draftListJsonArray = new JsonArray(); |
|
454 |
for (int i = 0;dataList!=null&& i < dataList.size(); i++) { |
152948
|
455 |
draftListJsonArray.add(PanicBuying.getPanicBuyingJsonObject( dataList.get(i), hostUrl, dataSourceEntity.getDbId()+"",openId)); |
4f0006
|
456 |
} |
J |
457 |
json.add("list", draftListJsonArray); |
|
458 |
|
|
459 |
json.addProperty("state", "success"); |
|
460 |
this.printJson(response, json.toString()); |
|
461 |
return; |
|
462 |
} catch (DataAccessException e) { |
|
463 |
errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); |
|
464 |
json.add("error", errJson); |
|
465 |
this.printJson(response, json.toString()); |
|
466 |
return; |
|
467 |
}catch (Exception e ){ |
|
468 |
errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); |
|
469 |
json.add("error", errJson); |
|
470 |
this.printJson(response, json.toString()); |
|
471 |
return; |
|
472 |
} finally { |
|
473 |
SpObserver.setDBtoInstance(); |
|
474 |
} |
|
475 |
} |
|
476 |
|
|
477 |
public static JsonObject getRoomJsonObject(RoomInfo roomInfo,String hostUrl,Integer dbId) { |
|
478 |
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
479 |
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); |
|
480 |
JsonObject jsonItem = new JsonObject(); |
|
481 |
|
|
482 |
jsonItem.addProperty("DocCode", roomInfo.getDocCode()); |
|
483 |
jsonItem.addProperty("FormId", roomInfo.getFormId()); |
|
484 |
jsonItem.addProperty("DocDate", roomInfo.getDocDate()==null?"":format2.format( roomInfo.getDocDate())); |
|
485 |
jsonItem.addProperty("EnterCode", roomInfo.getEnterCode()); |
|
486 |
jsonItem.addProperty("EnterName", roomInfo.getEnterName()); |
|
487 |
jsonItem.addProperty("EnterDate", roomInfo.getEnterDate()==null?"":format.format( roomInfo.getEnterDate())); |
bff6b6
|
488 |
jsonItem.addProperty("RoomId", roomInfo.getId()); //房间号 |
4f0006
|
489 |
jsonItem.addProperty("RoomName", roomInfo.getName()); //直播标题 |
J |
490 |
jsonItem.addProperty("CoverImg", roomInfo.getCoverImg()); //直播间背景墙 |
|
491 |
jsonItem.addProperty("CoverImgUnid",roomInfo.getCoverImgUnid()); //直播间背景墙UNID |
|
492 |
jsonItem.addProperty("CoverImgUnidUrl", SettingKey.getUrl(hostUrl, roomInfo.getCoverImgUnidUrl(), dbId+"",null)); //直播间背景墙URL |
|
493 |
jsonItem.addProperty("LiveStatus", roomInfo.getLiveStatus()); //直播状态:101 直播中,102 未开始,103 已结束 ,104 禁播,105 暂停中,106 异常,107 已过期 |
|
494 |
jsonItem.addProperty("StartTime", roomInfo.getStartDateTime() == null ?"": format.format(roomInfo.getStartDateTime())); //开播开始时间 |
|
495 |
jsonItem.addProperty("EndTime", roomInfo.getEndDateTime() == null ? "" :format.format(roomInfo.getEndDateTime())); //开播结束时间 |
|
496 |
|
|
497 |
jsonItem.addProperty("AnchorWechat", roomInfo.getAnchorWechat()); //主播微信号 |
|
498 |
jsonItem.addProperty("AnchorName", roomInfo.getAnchorName()); //主播昵称 |
|
499 |
jsonItem.addProperty("AnchorImg", roomInfo.getAnchorImg()); //主播头像 |
|
500 |
jsonItem.addProperty("AnchorImgUnid", roomInfo.getAnchorImgUnid()); //主播头像Unid |
|
501 |
jsonItem.addProperty("AnchorImgUnidUrl", SettingKey.getUrl(hostUrl, roomInfo.getAnchorImgUnidUrl(), dbId+"",null)); //主播头像Url |
|
502 |
jsonItem.addProperty("SubAnchorWechat", roomInfo.getSubAnchorWechat()); //主播副号微信号 |
|
503 |
jsonItem.addProperty("ShareImg", roomInfo.getShareImg()); //分享卡片封面 |
|
504 |
jsonItem.addProperty("ShareImgUnid", roomInfo.getShareImgUnid()); //分享卡片封面Unid |
|
505 |
jsonItem.addProperty("ShareImgUnidUrl", SettingKey.getUrl(hostUrl, roomInfo.getShareImgUnidUrl(), dbId+"",null)); //分享卡片封面Url |
|
506 |
jsonItem.addProperty("ShopCcCode", roomInfo.getShopCcCode()); |
|
507 |
jsonItem.addProperty("LiveBalanceSecond", roomInfo.getLiveBalanceSecond().longValue()<0?0:roomInfo.getLiveBalanceSecond()); //直播到计时 |
|
508 |
jsonItem.addProperty("isShowBannerPhotoOnHomePage", roomInfo.isShowBannerPhotoOnHomePage()); |
|
509 |
|
|
510 |
jsonItem.addProperty("BannerPhoto", roomInfo.getBannerPhoto()); //广告图片Unid |
|
511 |
jsonItem.addProperty("BannerPhotoUrl", SettingKey.getUrl(hostUrl, roomInfo.getBannerPhotoUrl(), dbId+"",null)); //广告图片Url |
|
512 |
jsonItem.addProperty("FeedsImg", roomInfo.getFeedsImgUnid()); //购物直播频道封面图 |
|
513 |
jsonItem.addProperty("FeedsImgUnid", roomInfo.getFeedsImgUnid()); //购物直播频道封面图Unid |
|
514 |
jsonItem.addProperty("FeedsImgUnidUrl", SettingKey.getUrl(hostUrl, roomInfo.getFeedsImgUnidUrl(), dbId+"",null)); //购物直播频道封面图Url |
1f5ccf
|
515 |
jsonItem.addProperty("isFeedsPublic", roomInfo.getIsFeedsPublic().equals(1)?true:false); //是否开启官方收录 |
4f0006
|
516 |
jsonItem.addProperty("ScreenType", roomInfo.getScreenType()); //0竖屏,1横屏、 |
J |
517 |
jsonItem.addProperty("Type", roomInfo.getType()); //直播间类型:0 手机直播, 1 推流 |
bff6b6
|
518 |
jsonItem.addProperty("isCloseLike", roomInfo.getCloseLike().equals(1)?true:false); //是否关闭点赞 |
J |
519 |
jsonItem.addProperty("isCloseGoods", roomInfo.getCloseGoods().equals(1)?true:false); //是否关闭货架 |
|
520 |
jsonItem.addProperty("isCloseComment", roomInfo.getCloseComment().equals(1)?true:false); //是否关闭评论 |
|
521 |
jsonItem.addProperty("isCloseReplay", roomInfo.getCloseReplay().equals(1)?true:false); //是否关闭回放 |
|
522 |
jsonItem.addProperty("isCloseShare", roomInfo.getCloseShare().equals(1)?true:false); //是否关闭分享 |
|
523 |
jsonItem.addProperty("isCloseKf", roomInfo.getCloseKf().equals(1)?true:false); //是否关闭客服 |
4f0006
|
524 |
|
J |
525 |
JsonArray replayListArray = new JsonArray(); |
|
526 |
MaLiveIfc maLiveIfc = (MaLiveIfc)FactoryBean.getBean("MaLiveImpl"); |
bff6b6
|
527 |
LiveReplayVideoEntity replayList = maLiveIfc.getReplayVideo(roomInfo.getId()) ; |
4f0006
|
528 |
for (int j =0; replayList != null && replayList.getLiveReplay()!= null && j < replayList.getLiveReplay().size();j++) { |
J |
529 |
JsonObject replayItem = new JsonObject(); |
|
530 |
replayItem.addProperty("ExpireTime", replayList.getLiveReplay().get(j).getExpireTime()); //回放过期时间 |
|
531 |
replayItem.addProperty("CreateTime", replayList.getLiveReplay().get(j).getCreateTime()); //回放生成时间 |
|
532 |
replayItem.addProperty("MediaUrl", replayList.getLiveReplay().get(j).getMediaUrl()); //回放URL |
|
533 |
replayListArray.add(replayItem); |
|
534 |
} |
|
535 |
jsonItem.add("ReplayVideoList",replayListArray ) ; //回放列表 |
6e0012
|
536 |
|
J |
537 |
jsonItem.addProperty("SubscribeTimes", roomInfo.getSubscribeTimes()); //直播间订阅次数 |
4f0006
|
538 |
return jsonItem; |
J |
539 |
} |
c19dc5
|
540 |
|
J |
541 |
|
|
542 |
/** |
|
543 |
* 保存小程序提交过来的新建直播间信息 , 第一步 |
|
544 |
* @param request |
|
545 |
* @param response |
|
546 |
*/ |
|
547 |
@RequestMapping("/saveRoomStep1.do") |
|
548 |
public void saveRoomStep1(@RequestBody CreateLiveRoomParameterStep1Entity createLiveRoomParameterStep1Entity, HttpServletRequest request, HttpServletResponse response) { |
|
549 |
HttpSession session=request.getSession(); |
|
550 |
JsonObject json = new JsonObject(); |
|
551 |
JsonObject errJson = new JsonObject(); |
|
552 |
String userCode = (String) session.getAttribute(SessionKey.HRCODE) ; |
|
553 |
String userName = (String) session.getAttribute(SessionKey.HRNAME) ; |
|
554 |
String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID) == null ? "": (String) session.getAttribute(SessionKey.WEIXIN_OPENID)); |
|
555 |
|
|
556 |
if (createLiveRoomParameterStep1Entity.getName() == null||"".equals(createLiveRoomParameterStep1Entity.getName())) { |
b8896c
|
557 |
errJson.addProperty("warning","必须传递直播间标题 name 【最短3个汉字,最长17个汉字】"); |
J |
558 |
json.add("error", errJson); |
|
559 |
this.printJson(response, json.toString()); |
|
560 |
return ; |
|
561 |
} |
|
562 |
int len = StringLengthUtil.getWordCount(createLiveRoomParameterStep1Entity.getName()); |
|
563 |
if (len < 6 || len > 34) { |
|
564 |
errJson.addProperty("warning","直播间标题最短3个汉字,最长17个汉字"); |
c19dc5
|
565 |
json.add("error", errJson); |
J |
566 |
this.printJson(response, json.toString()); |
|
567 |
return ; |
|
568 |
} |
|
569 |
if (createLiveRoomParameterStep1Entity.getAnchorName() == null||"".equals(createLiveRoomParameterStep1Entity.getAnchorName())) { |
|
570 |
errJson.addProperty("warning","必须传递主播昵称 anchorName 【最短2个汉字,最长15个汉字】"); |
|
571 |
json.add("error", errJson); |
|
572 |
this.printJson(response, json.toString()); |
|
573 |
return ; |
|
574 |
} |
b8896c
|
575 |
|
J |
576 |
len = StringLengthUtil.getWordCount(createLiveRoomParameterStep1Entity.getAnchorName()); |
|
577 |
if (len < 4 || len > 30) { |
|
578 |
errJson.addProperty("warning","主播昵称最短2个汉字,最长15个汉字"); |
|
579 |
json.add("error", errJson); |
|
580 |
this.printJson(response, json.toString()); |
|
581 |
return ; |
|
582 |
} |
|
583 |
|
c19dc5
|
584 |
if (createLiveRoomParameterStep1Entity.getAnchorWechat() == null||"".equals(createLiveRoomParameterStep1Entity.getAnchorWechat())) { |
J |
585 |
errJson.addProperty("warning","必须传递主播微信号 anchorWechat 【如果未实名认证,需要先前往“小程序直播”小程序进行实名验证】"); |
|
586 |
json.add("error", errJson); |
|
587 |
this.printJson(response, json.toString()); |
|
588 |
return ; |
|
589 |
} |
|
590 |
|
|
591 |
if (createLiveRoomParameterStep1Entity.getShareImgUnid() == null||"".equals(createLiveRoomParameterStep1Entity.getShareImgUnid())) { |
|
592 |
errJson.addProperty("warning","必须上传分享卡片封面 ShareImgUnid 字段"); |
|
593 |
json.add("error", errJson); |
|
594 |
this.printJson(response, json.toString()); |
|
595 |
return ; |
|
596 |
} |
|
597 |
|
|
598 |
try { |
|
599 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
600 |
SpObserver.setDBtoInstance("_"+dataSourceEntity.getDbId());//切换数据源 |
22907b
|
601 |
SettingEntity settingEntity = settingIfc.getSettingEntity(request) ; |
c19dc5
|
602 |
//取网店 shopcccode |
J |
603 |
ShopCcCodeEntity shopCcCodeEntity = ShopCcCode.getShopCcCode(settingEntity,request); |
|
604 |
|
|
605 |
createLiveRoomParameterStep1Entity.setShopCcCode(shopCcCodeEntity.getShopCcCode()); |
|
606 |
createLiveRoomParameterStep1Entity.setOpenId(openId); |
|
607 |
createLiveRoomParameterStep1Entity.setUserCode(userCode); |
|
608 |
createLiveRoomParameterStep1Entity.setUserName(userName); |
|
609 |
|
|
610 |
String newDocCode = maLiveIfc.createRoomStep1(createLiveRoomParameterStep1Entity); |
|
611 |
|
|
612 |
json.addProperty(SettingKey.DOCCODE, newDocCode); |
|
613 |
json.addProperty("state", "success"); |
|
614 |
this.printJson(response, json.toString()); |
|
615 |
return ; |
|
616 |
|
|
617 |
}catch (Exception e) { |
|
618 |
this.logger.error(e.getMessage(), e); |
|
619 |
e.printStackTrace(); |
919552
|
620 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); |
c19dc5
|
621 |
json.add("error", errJson); |
J |
622 |
this.printJson(response, json.toString()); |
|
623 |
return ; |
|
624 |
}finally { |
|
625 |
SpObserver.setDBtoInstance(); |
|
626 |
} |
|
627 |
} |
|
628 |
|
|
629 |
/** |
|
630 |
* 保存小程序提交过来的新建直播间信息 , 第二步 |
|
631 |
* @param request |
|
632 |
* @param response |
|
633 |
*/ |
|
634 |
@RequestMapping("/saveRoomStep2.do") |
|
635 |
public void saveRoomStep2(@RequestBody CreateLiveRoomParameterStep2Entity createLiveRoomParameterStep2Entity, HttpServletRequest request, HttpServletResponse response) { |
|
636 |
//HttpSession session=request.getSession(); |
|
637 |
JsonObject json = new JsonObject(); |
|
638 |
JsonObject errJson = new JsonObject(); |
|
639 |
|
|
640 |
try { |
|
641 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
642 |
SpObserver.setDBtoInstance("_"+dataSourceEntity.getDbId());//切换数据源 |
|
643 |
|
|
644 |
maLiveIfc.createRoomStep2(createLiveRoomParameterStep2Entity); |
|
645 |
|
|
646 |
json.addProperty(SettingKey.DOCCODE, createLiveRoomParameterStep2Entity.getDocCode()); |
|
647 |
json.addProperty("state", "success"); |
|
648 |
this.printJson(response, json.toString()); |
|
649 |
return ; |
|
650 |
|
|
651 |
}catch (Exception e) { |
|
652 |
this.logger.error(e.getMessage(), e); |
|
653 |
e.printStackTrace(); |
919552
|
654 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); |
c19dc5
|
655 |
json.add("error", errJson); |
J |
656 |
this.printJson(response, json.toString()); |
|
657 |
return ; |
|
658 |
}finally { |
|
659 |
SpObserver.setDBtoInstance(); |
|
660 |
} |
|
661 |
} |
|
662 |
|
|
663 |
|
|
664 |
/** |
|
665 |
* 保存小程序提交过来的新建直播间信息 , 第三步 |
|
666 |
* @param request |
|
667 |
* @param response |
|
668 |
*/ |
|
669 |
@RequestMapping("/saveRoomStep3.do") |
|
670 |
public void saveRoomStep3(@RequestBody CreateLiveRoomParameterStep3Entity createLiveRoomParameterStep3Entity, HttpServletRequest request, HttpServletResponse response) { |
|
671 |
//HttpSession session=request.getSession(); |
|
672 |
JsonObject json = new JsonObject(); |
|
673 |
JsonObject errJson = new JsonObject(); |
|
674 |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
675 |
|
|
676 |
try { |
|
677 |
DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; |
|
678 |
SpObserver.setDBtoInstance("_"+dataSourceEntity.getDbId());//切换数据源 |
|
679 |
|
|
680 |
if (createLiveRoomParameterStep3Entity.getStartTime() == null||"".equals(createLiveRoomParameterStep3Entity.getStartTime())) { |
|
681 |
errJson.addProperty("warning","必须传递直播计划开始时间 startTime ,格式:yyyy-MM-dd HH:mm:ss"); |
|
682 |
json.add("error", errJson); |
|
683 |
this.printJson(response, json.toString()); |
|
684 |
return ; |
|
685 |
} |
|
686 |
if (createLiveRoomParameterStep3Entity.getEndTime() == null||"".equals(createLiveRoomParameterStep3Entity.getEndTime())) { |
|
687 |
errJson.addProperty("warning","必须传递直播计划结束时间 endTime ,格式:yyyy-MM-dd HH:mm:ss"); |
|
688 |
json.add("error", errJson); |
|
689 |
this.printJson(response, json.toString()); |
|
690 |
return ; |
|
691 |
} |
|
692 |
|
|
693 |
Date startDateTime = null,endDateTime = null; |
|
694 |
try { |
|
695 |
startDateTime = sdf.parse(createLiveRoomParameterStep3Entity.getStartTime()) ; |
|
696 |
} catch (ParseException e) { |
|
697 |
errJson.addProperty("warning","直播计划开始时间 startTime 不能转换为日期类型,请检查日期格式是否符合:yyyy-MM-dd HH:mm:ss "); |
|
698 |
json.add("error", errJson); |
|
699 |
this.printJson(response, json.toString()); |
|
700 |
return ; |
|
701 |
} |
|
702 |
try { |
|
703 |
endDateTime = sdf.parse(createLiveRoomParameterStep3Entity.getEndTime()) ; |
|
704 |
} catch (ParseException e) { |
|
705 |
errJson.addProperty("warning","直播计划开始时间 endTime 不能转换为日期类型,请检查日期格式是否符合:yyyy-MM-dd HH:mm:ss "); |
|
706 |
json.add("error", errJson); |
|
707 |
this.printJson(response, json.toString()); |
|
708 |
return ; |
|
709 |
} |
|
710 |
createLiveRoomParameterStep3Entity.setStartDateTime(startDateTime); |
|
711 |
createLiveRoomParameterStep3Entity.setEndDateTime(endDateTime); |
|
712 |
|
|
713 |
|
|
714 |
maLiveIfc.createRoomStep3(createLiveRoomParameterStep3Entity); |
|
715 |
|
|
716 |
//创建直播间 |
|
717 |
CreateLiveRoomResultEntity createLiveRoomResultEntity = LiveRoomVideo.CreateLiveRoom( dataSourceEntity, createLiveRoomParameterStep3Entity.getDocCode(), request); |
|
718 |
|
b8896c
|
719 |
json.addProperty("roomId", createLiveRoomResultEntity.getRoomId()); //当主播微信号没有在 “小程序直播“ 小程序实名认证 返回该字段 |
J |
720 |
json.addProperty("qrcodeUrl", createLiveRoomResultEntity.getQrCodeUrl()); //当主播微信号没有在 “小程序直播“ 小程序实名认证 返回该字段 |
17b39f
|
721 |
json.addProperty("qrcodeUrlUnid", createLiveRoomResultEntity.getQrCodeUrlUnid()); //当主播微信号没有在 “小程序直播“ 小程序实名认证 返回该字段 |
c19dc5
|
722 |
json.addProperty(SettingKey.DOCCODE, createLiveRoomParameterStep3Entity.getDocCode()); |
J |
723 |
json.addProperty("state", createLiveRoomResultEntity.getState()); |
|
724 |
this.printJson(response, json.toString()); |
|
725 |
return ; |
17b39f
|
726 |
} catch (ApplicationException e) { |
J |
727 |
this.logger.error(e.getMessage(), e); |
|
728 |
//e.printStackTrace(); //ApplicationException 例外不要输出这句话 |
|
729 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); |
|
730 |
json.add("error", errJson); |
|
731 |
this.printJson(response, json.toString()); |
|
732 |
return ; |
b8896c
|
733 |
} catch(WxErrorException e) { |
J |
734 |
this.logger.error(e.getMessage(), e); |
|
735 |
e.printStackTrace(); |
|
736 |
errJson.addProperty("warning","错误代码:" + e.getError().getErrorCode() + ",错误信息:" + e.getError().getErrorMsg()); |
|
737 |
json.add("error", errJson); |
|
738 |
this.printJson(response, json.toString()); |
|
739 |
return ; |
|
740 |
} catch (Exception e) { |
c19dc5
|
741 |
this.logger.error(e.getMessage(), e); |
J |
742 |
e.printStackTrace(); |
919552
|
743 |
errJson.addProperty("warning",(e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); |
c19dc5
|
744 |
json.add("error", errJson); |
J |
745 |
this.printJson(response, json.toString()); |
|
746 |
return ; |
|
747 |
}finally { |
|
748 |
SpObserver.setDBtoInstance(); |
|
749 |
} |
|
750 |
} |
4f0006
|
751 |
} |