|
@@ -1,17 +1,13 @@
|
1
|
1
|
package com.huiju.estateagents.controller;
|
2
|
2
|
|
3
|
|
-import com.alibaba.excel.EasyExcel;
|
4
|
|
-import com.alibaba.excel.ExcelWriter;
|
5
|
|
-import com.alibaba.excel.support.ExcelTypeEnum;
|
|
3
|
+import com.alibaba.fastjson.JSON;
|
6
|
4
|
import com.alibaba.fastjson.JSONObject;
|
7
|
5
|
import com.huiju.estateagents.base.BaseController;
|
8
|
6
|
import com.huiju.estateagents.base.ResponseBean;
|
9
|
7
|
import com.huiju.estateagents.common.CommConstant;
|
10
|
8
|
import com.huiju.estateagents.entity.TaQrcode;
|
11
|
|
-import com.huiju.estateagents.excel.ActivityStatistics.VisitPersonNum;
|
12
|
9
|
import com.huiju.estateagents.service.IMiniAppService;
|
13
|
10
|
import com.huiju.estateagents.service.ITaQrcodeService;
|
14
|
|
-import org.apache.poi.sl.usermodel.Sheet;
|
15
|
11
|
import org.slf4j.Logger;
|
16
|
12
|
import org.slf4j.LoggerFactory;
|
17
|
13
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -20,8 +16,9 @@ import org.springframework.web.bind.annotation.*;
|
20
|
16
|
import javax.servlet.http.HttpServletRequest;
|
21
|
17
|
import javax.servlet.http.HttpServletResponse;
|
22
|
18
|
import java.io.IOException;
|
23
|
|
-import java.io.OutputStream;
|
|
19
|
+import java.util.HashMap;
|
24
|
20
|
import java.util.List;
|
|
21
|
+import java.util.Map;
|
25
|
22
|
|
26
|
23
|
/**
|
27
|
24
|
* <p>
|
|
@@ -208,7 +205,7 @@ public class TaQrcodeController extends BaseController {
|
208
|
205
|
* @param request
|
209
|
206
|
* @return
|
210
|
207
|
*/
|
211
|
|
- @RequestMapping(value = "/admin/getStatisticRecord", method = RequestMethod.GET)
|
|
208
|
+ @RequestMapping(value = "/admin/qrCode/getStatisticRecord", method = RequestMethod.GET)
|
212
|
209
|
public ResponseBean getStatisticRecord(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
213
|
210
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
214
|
211
|
Integer qrCodeId, Integer type, HttpServletRequest request) {
|
|
@@ -222,18 +219,20 @@ public class TaQrcodeController extends BaseController {
|
222
|
219
|
return responseBean;
|
223
|
220
|
}
|
224
|
221
|
|
225
|
|
- @RequestMapping(value = "/admin/getStatisticRecordExport", method = RequestMethod.GET)
|
226
|
|
- public void getStatisticRecordExport(Integer qrCodeId, Integer type, HttpServletRequest request, HttpServletResponse response) {
|
|
222
|
+ @RequestMapping(value = "/admin/qrCode/getStatisticRecordExport", method = RequestMethod.GET)
|
|
223
|
+ public void getStatisticRecordExport(@RequestParam(value = "qrCodeId") Integer qrCodeId,
|
|
224
|
+ @RequestParam(value = "type") Integer type, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
227
|
225
|
try {
|
228
|
226
|
iTaQrcodeService.getStatisticRecordExport(type, qrCodeId, getOrgId(request), response);
|
229
|
227
|
} catch (Exception e) {
|
230
|
|
- e.printStackTrace();
|
231
|
|
- } finally {
|
232
|
|
- try {
|
233
|
|
- response.getOutputStream().close();
|
234
|
|
- } catch (IOException e) {
|
235
|
|
- e.printStackTrace();
|
236
|
|
- }
|
|
228
|
+ logger.error("getStatisticRecordExport 异常:", e);
|
|
229
|
+ response.reset();
|
|
230
|
+ response.setContentType("application/json");
|
|
231
|
+ response.setCharacterEncoding("utf-8");
|
|
232
|
+ Map<String, Object> map = new HashMap();
|
|
233
|
+ map.put("code", ResponseBean.ERROR_UNAVAILABLE);
|
|
234
|
+ map.put("message", "下载文件失败" + e.getMessage());
|
|
235
|
+ response.getWriter().println(JSON.toJSONString(map));
|
237
|
236
|
}
|
238
|
237
|
}
|
239
|
238
|
|