|
@@ -1,10 +1,11 @@
|
|
|
package com.ruixuan.isc.controller;
|
|
package com.ruixuan.isc.controller;
|
|
|
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.io.OutputStream;
|
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
|
|
+import java.util.*;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -23,6 +24,8 @@ import com.ruixuan.common.core.domain.entity.SysUser;
|
|
|
import com.ruixuan.common.core.page.TableDataInfo;
|
|
import com.ruixuan.common.core.page.TableDataInfo;
|
|
|
import com.ruixuan.common.enums.BusinessType;
|
|
import com.ruixuan.common.enums.BusinessType;
|
|
|
import com.ruixuan.common.utils.Check;
|
|
import com.ruixuan.common.utils.Check;
|
|
|
|
|
+import com.ruixuan.common.utils.DateUtils;
|
|
|
|
|
+import com.ruixuan.data.utils.ExportExcelUtils;
|
|
|
import com.ruixuan.isc.entity.KuaishouItemCollectSampleExpress;
|
|
import com.ruixuan.isc.entity.KuaishouItemCollectSampleExpress;
|
|
|
import com.ruixuan.isc.entity.KuaishouItemCollectSamples;
|
|
import com.ruixuan.isc.entity.KuaishouItemCollectSamples;
|
|
|
import com.ruixuan.isc.entity.KuaishouItemCollectSampleLog;
|
|
import com.ruixuan.isc.entity.KuaishouItemCollectSampleLog;
|
|
@@ -31,17 +34,12 @@ import com.ruixuan.isc.service.IKuaishouItemCollectSamplesService;
|
|
|
import com.ruixuan.system.service.ISysDeptService;
|
|
import com.ruixuan.system.service.ISysDeptService;
|
|
|
import com.ruixuan.system.service.ISysRoleService;
|
|
import com.ruixuan.system.service.ISysRoleService;
|
|
|
import com.ruixuan.system.service.ISysUserService;
|
|
import com.ruixuan.system.service.ISysUserService;
|
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -374,5 +372,63 @@ public class KuaishouItemCollectSamplesController extends BaseController {
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
return toAjax(kuaishouItemCollectSamplesService.deleteKuaishouItemCollectSamplesByIds(ids));
|
|
return toAjax(kuaishouItemCollectSamplesService.deleteKuaishouItemCollectSamplesByIds(ids));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 认领商品列表导出
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/exportCollectSamples")
|
|
|
|
|
+ @ApiOperation(value = "认领商品列表")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public void exportCollectSamples(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject requestJson) throws IOException {
|
|
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("ids"))) {
|
|
|
|
|
+ requestMap.put("ids", requestJson.getJSONArray("ids"));
|
|
|
|
|
+ }
|
|
|
|
|
+ List<JSONObject> list = kuaishouItemCollectSamplesService.exportCollectSamples(requestMap);
|
|
|
|
|
+ List<List<Object>> exportList = new ArrayList<>();
|
|
|
|
|
+ if (!Check.isNull(list)) {
|
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
+ JSONObject date = list.get(i);
|
|
|
|
|
+ List<Object> export = new ArrayList();
|
|
|
|
|
+ export.add(date.getString("itemId"));
|
|
|
|
|
+ export.add(date.getLong("itemTitle"));
|
|
|
|
|
+ export.add(date.getString("promoterId"));
|
|
|
|
|
+ export.add(date.getString("promoterNickName"));
|
|
|
|
|
+ export.add(date.getString("sampleCount"));
|
|
|
|
|
+ export.add(date.getString("sampleRequirement"));
|
|
|
|
|
+ export.add(date.getString("promoterPhone"));
|
|
|
|
|
+ export.add(date.getString("promoterAddress"));
|
|
|
|
|
+ exportList.add(export);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ String[] headers = {"商品ID", "商品名称", "达人ID", "达人昵称", "领样数量", "领样规则", "收件人手机号码", "收件人地址"};
|
|
|
|
|
+ OutputStream os = response.getOutputStream();
|
|
|
|
|
+ ExportExcelUtils eeu = new ExportExcelUtils();
|
|
|
|
|
+ XSSFWorkbook workbook = new XSSFWorkbook();
|
|
|
|
|
+ eeu.exportExcel(workbook, 0, "领样列表", headers, exportList);
|
|
|
|
|
+ this.setResponseHeader(response, "领样列表.xls");
|
|
|
|
|
+ workbook.write(os);
|
|
|
|
|
+ os.flush();
|
|
|
|
|
+ os.close();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //发送响应流方法
|
|
|
|
|
+ public void setResponseHeader(HttpServletResponse response, String fileName) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ try {
|
|
|
|
|
+ fileName = new String(fileName.getBytes(), "ISO8859-1");
|
|
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ response.setContentType("application/octet-stream;charset=ISO8859-1");
|
|
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
|
|
|
|
+ response.addHeader("Pargam", "no-cache");
|
|
|
|
|
+ response.addHeader("Cache-Control", "no-cache");
|
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
|
+ ex.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|