|
@@ -5,6 +5,7 @@ import com.ruixuan.common.core.controller.BaseController;
|
|
|
import com.ruixuan.common.core.page.TableDataInfo;
|
|
|
import com.ruixuan.common.utils.Check;
|
|
|
import com.ruixuan.common.utils.DateUtils;
|
|
|
+import com.ruixuan.data.utils.ExportExcelUtils;
|
|
|
import com.ruixuan.jiaoyang.service.IJiaoYangReportService;
|
|
|
import com.ruixuan.system.service.ISysDeptService;
|
|
|
import com.ruixuan.system.service.ISysRoleService;
|
|
@@ -12,12 +13,18 @@ import com.ruixuan.system.service.ISysUserService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import lombok.SneakyThrows;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.OutputStream;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -268,7 +275,7 @@ public class JiaoYangReportController extends BaseController {
|
|
|
public JSONObject promoterStatistics(
|
|
|
@ApiParam("达人Id") @RequestParam(value = "promoterId", required = false) String promoterId,
|
|
|
@ApiParam("订单开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
|
|
|
- @ApiParam("订单结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,Long userId) {
|
|
|
+ @ApiParam("订单结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate, Long userId) {
|
|
|
Map<String, Object> requestMap = new HashMap<>();
|
|
|
String roleId = sysRoleService.getRoleBYUserId(userId);
|
|
|
if ("jy_bd".equals(roleId) || "jy_bd_manage".equals(roleId) || "jy_scissors_manage".equals(roleId) || "jy_scissors".equals(roleId)) {
|
|
@@ -312,6 +319,45 @@ public class JiaoYangReportController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @GetMapping("/exportClipCooperation")
|
|
|
+ public void exportClipCooperation(HttpServletRequest request, HttpServletResponse response, String statDate, Long promoterId, String promoterName) throws IOException {
|
|
|
+ Long date = Long.valueOf(statDate.replace("-", ""));
|
|
|
+ List<JSONObject> list = jiaoYangReportService.getClipCooperation(date, promoterId, promoterName);
|
|
|
+ List<List<Object>> exportList = new ArrayList<>();
|
|
|
+ if (!Check.isNull(list)) {
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ JSONObject data = list.get(i);
|
|
|
+ List<Object> export = new ArrayList();
|
|
|
+ export.add(data.getString("clipId"));
|
|
|
+ export.add(data.getString("clipName"));
|
|
|
+ export.add(data.getString("commissionRateView"));
|
|
|
+ export.add(data.getString("fansNum"));
|
|
|
+ export.add(data.getString("status"));
|
|
|
+ export.add(data.getString("shopScore"));
|
|
|
+ export.add(data.getString("clipGmv30d"));
|
|
|
+ export.add(data.getString("authItemGmv30d"));
|
|
|
+ export.add(data.getString("videoCount"));
|
|
|
+ export.add(data.getString("videoShow"));
|
|
|
+ export.add(data.getString("terminationReason"));
|
|
|
+ exportList.add(export);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String[] headers = {"达人ID", "达人名称", "佣金率", "粉丝数", "状态", "口碑评分", "二创GMV", "授权商品GMV", "二创作者挂车短视频发布量", "二创作者挂车短视频曝光量", "状态备注"};
|
|
|
+ OutputStream os = response.getOutputStream();
|
|
|
+ ExportExcelUtils eeu = new ExportExcelUtils();
|
|
|
+ XSSFWorkbook workbook = new XSSFWorkbook();
|
|
|
+ eeu.exportExcel(workbook, 0, "二创信息", headers, exportList);
|
|
|
+ this.setResponseHeader(response, "二创信息.xls");
|
|
|
+ try {
|
|
|
+ workbook.write(os);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ os.flush();
|
|
|
+ os.close();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("/getClipCooperation")
|
|
|
public TableDataInfo list(String statDate, Long promoterId, String promoterName) {
|
|
|
Long date = Long.valueOf(statDate.replace("-", ""));
|
|
@@ -751,5 +797,21 @@ public class JiaoYangReportController extends BaseController {
|
|
|
return timeIntervalRatioJson;
|
|
|
}
|
|
|
|
|
|
+ //发送响应流方法
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|