|
@@ -1,11 +1,12 @@
|
|
package com.ruixuan.isc.controller;
|
|
package com.ruixuan.isc.controller;
|
|
|
|
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.io.OutputStream;
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.HashSet;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -17,18 +18,14 @@ 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.common.utils.DateUtils;
|
|
import com.ruixuan.common.utils.poi.ExcelUtil;
|
|
import com.ruixuan.common.utils.poi.ExcelUtil;
|
|
|
|
+import com.ruixuan.data.utils.ExportExcelUtils;
|
|
import com.ruixuan.isc.entity.KuaishouRewardBaseInfo;
|
|
import com.ruixuan.isc.entity.KuaishouRewardBaseInfo;
|
|
import com.ruixuan.isc.service.IKuaishouRewardBaseInfoService;
|
|
import com.ruixuan.isc.service.IKuaishouRewardBaseInfoService;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+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.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -47,7 +44,7 @@ public class KuaishouRewardBaseInfoController extends BaseController {
|
|
* 查询【请填写功能名称】列表
|
|
* 查询【请填写功能名称】列表
|
|
*/
|
|
*/
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(Long itemId, String promoterId, String startDate, String endDate, String itemTitle, String promoterName) {
|
|
|
|
|
|
+ public TableDataInfo list(Long itemId, String promoterId, String startDate, String endDate, String itemTitle, String promoterName,Integer status) {
|
|
|
|
|
|
Map<String, Object> requestMap = new HashMap<>();
|
|
Map<String, Object> requestMap = new HashMap<>();
|
|
if (!Check.isNull(itemId)) {
|
|
if (!Check.isNull(itemId)) {
|
|
@@ -68,12 +65,91 @@ public class KuaishouRewardBaseInfoController extends BaseController {
|
|
if (!Check.isNull(promoterName)) {
|
|
if (!Check.isNull(promoterName)) {
|
|
requestMap.put("promoterName", promoterName);
|
|
requestMap.put("promoterName", promoterName);
|
|
}
|
|
}
|
|
|
|
+ if (!Check.isNull(status)) {
|
|
|
|
+ requestMap.put("status", status);
|
|
|
|
+ }
|
|
startPage();
|
|
startPage();
|
|
List<KuaishouRewardBaseInfo> list = kuaishouRewardBaseInfoService.selectKuaishouRewardBaseInfoList(requestMap);
|
|
List<KuaishouRewardBaseInfo> list = kuaishouRewardBaseInfoService.selectKuaishouRewardBaseInfoList(requestMap);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/exportDetail")
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public void exportDetail(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject requestJson) throws IOException {
|
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ Long itemId = requestJson.getLong("itemId");
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(itemId)) {
|
|
|
|
+ requestMap.put("itemId", itemId);
|
|
|
|
+ }
|
|
|
|
+ Long promoterId = requestJson.getLong("promoterId");
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(promoterId)) {
|
|
|
|
+ requestMap.put("promoterId", promoterId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String itemTitle = requestJson.getString("itemTitle");
|
|
|
|
+ if (!Check.isNull(itemTitle)) {
|
|
|
|
+ requestMap.put("itemTitle", itemTitle);
|
|
|
|
+ }
|
|
|
|
+ String promoterName = requestJson.getString("promoterName");
|
|
|
|
+ if (!Check.isNull(promoterName)) {
|
|
|
|
+ requestMap.put("promoterName", promoterName);
|
|
|
|
+ }
|
|
|
|
+ String startDate = requestJson.getString("startDate");
|
|
|
|
+ if (!Check.isNull(startDate)) {
|
|
|
|
+ requestMap.put("startDate", startDate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String endDate = requestJson.getString("endDate");
|
|
|
|
+ if (!Check.isNull(endDate)) {
|
|
|
|
+ requestMap.put("endDate", endDate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<KuaishouRewardBaseInfo> list = kuaishouRewardBaseInfoService.selectKuaishouRewardBaseInfoList(requestMap);
|
|
|
|
+ List<List<Object>> exportList = new ArrayList<>();
|
|
|
|
+ if (!Check.isNull(list)) {
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
+ KuaishouRewardBaseInfo data = list.get(i);
|
|
|
|
+ List<Object> export = new ArrayList();
|
|
|
|
+ export.add(data.getItemId());
|
|
|
|
+ export.add(data.getItemTitle());
|
|
|
|
+ export.add(data.getItemCreateName());
|
|
|
|
+ export.add(data.getPromoterId());
|
|
|
|
+ export.add(data.getPromoterName());
|
|
|
|
+ export.add(data.getPromoterCreateName());
|
|
|
|
+ export.add(data.getStatDate());
|
|
|
|
+ export.add(data.getCurrentSettlementNum());
|
|
|
|
+ export.add(data.getTotalSettlementNum());
|
|
|
|
+ export.add(data.getSettlementPrice());
|
|
|
|
+ export.add(data.getAnchorAmount());
|
|
|
|
+ export.add(data.getReferenceAmount());
|
|
|
|
+ export.add(data.getTotalAmount());
|
|
|
|
+ Integer status = data.getStatus();
|
|
|
|
+ if (status == 1) {
|
|
|
|
+ export.add("未结算");
|
|
|
|
+ } else if (status == 2) {
|
|
|
|
+ export.add("已结算");
|
|
|
|
+ } else {
|
|
|
|
+ export.add("-");
|
|
|
|
+ }
|
|
|
|
+ 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();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@GetMapping("/totalListInfo")
|
|
@GetMapping("/totalListInfo")
|
|
public TableDataInfo totalListInfo(Long itemId, String promoterId, String itemTitle, String promoterName) {
|
|
public TableDataInfo totalListInfo(Long itemId, String promoterId, String itemTitle, String promoterName) {
|
|
|
|
|
|
@@ -96,14 +172,92 @@ public class KuaishouRewardBaseInfoController extends BaseController {
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @PostMapping("/exportTotal")
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public void exportTotal(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject requestJson) throws IOException {
|
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
|
|
|
- @GetMapping("/getTotal")
|
|
|
|
- public JSONObject getTotal(KuaishouRewardBaseInfo kuaishouRewardBaseInfo) {
|
|
|
|
|
|
+ Long itemId = requestJson.getLong("itemId");
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(itemId)) {
|
|
|
|
+ requestMap.put("itemId", itemId);
|
|
|
|
+ }
|
|
|
|
+ Long promoterId = requestJson.getLong("promoterId");
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(promoterId)) {
|
|
|
|
+ requestMap.put("promoterId", promoterId);
|
|
|
|
+ }
|
|
|
|
|
|
- JSONObject json = kuaishouRewardBaseInfoService.getTotal(kuaishouRewardBaseInfo);
|
|
|
|
|
|
+ String itemTitle = requestJson.getString("itemTitle");
|
|
|
|
+ if (!Check.isNull(itemTitle)) {
|
|
|
|
+ requestMap.put("itemTitle", itemTitle);
|
|
|
|
+ }
|
|
|
|
+ String promoterName = requestJson.getString("promoterName");
|
|
|
|
+ if (!Check.isNull(promoterName)) {
|
|
|
|
+ requestMap.put("promoterName", promoterName);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<JSONObject> list = kuaishouRewardBaseInfoService.totalListInfo(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.getString("itemTitle"));
|
|
|
|
+ export.add(date.getString("itemCreateName"));
|
|
|
|
+ export.add(date.getString("promoterId"));
|
|
|
|
+ export.add(date.getString("promoterName"));
|
|
|
|
+ export.add(date.getString("promoterCreateName"));
|
|
|
|
+ export.add(date.getString("totalSettlementNum"));
|
|
|
|
+ export.add(date.getString("maxDate"));
|
|
|
|
+ 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();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @GetMapping("/getTotal")
|
|
|
|
+ public JSONObject getTotal(Long itemId, String promoterId, String startDate, String endDate, String itemTitle, String promoterName) {
|
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
|
+ if (!Check.isNull(itemId)) {
|
|
|
|
+ requestMap.put("itemId", itemId);
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(promoterId)) {
|
|
|
|
+ requestMap.put("promoterId", promoterId);
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(startDate)) {
|
|
|
|
+ requestMap.put("startDate", startDate);
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(endDate)) {
|
|
|
|
+ requestMap.put("endDate", endDate);
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(itemTitle)) {
|
|
|
|
+ requestMap.put("itemTitle", itemTitle);
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(promoterName)) {
|
|
|
|
+ requestMap.put("promoterName", promoterName);
|
|
|
|
+ }
|
|
|
|
+ JSONObject json = kuaishouRewardBaseInfoService.getTotal(requestMap);
|
|
return json;
|
|
return json;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @PostMapping("/updateStatus")
|
|
|
|
+ public AjaxResult updateStatus(@RequestBody JSONObject jsonObject) {
|
|
|
|
+ return toAjax(kuaishouRewardBaseInfoService.updateStatus(jsonObject.getLong("id")));
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 导出【请填写功能名称】列表
|
|
* 导出【请填写功能名称】列表
|
|
*/
|
|
*/
|
|
@@ -243,5 +397,21 @@ public class KuaishouRewardBaseInfoController extends BaseController {
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
return toAjax(kuaishouRewardBaseInfoService.deleteKuaishouRewardBaseInfoByIds(ids));
|
|
return toAjax(kuaishouRewardBaseInfoService.deleteKuaishouRewardBaseInfoByIds(ids));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ 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();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|