浏览代码

直播数据报表 报表添加排序

zhaoxian 3 年之前
父节点
当前提交
d0b23d9c6c

+ 3 - 3
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/controller/LiveDataAdController.java

@@ -80,16 +80,16 @@ public class LiveDataAdController {
      */
     @PostMapping(value = "/importExcel")
     @ResponseBody
-    public Result<Object> importExcel(HttpServletResponse response, String userId, String statMonth, Long accountId, @RequestParam("file") MultipartFile file) {
+    public Result<Object> importExcel(HttpServletResponse response, String userId, Long accountId, @RequestParam("file") MultipartFile file) {
         response.setHeader("Access-Control-Allow-Origin", "*");
         try {
             if (Check.isNull(file)) {
                 return Result.error("执行失败,请上传应用Excel文件");
             }
-            if (Check.isNull(accountId) || Check.isNull(userId) || Check.isNull(statMonth)) {
+            if (Check.isNull(accountId) || Check.isNull(userId)) {
                 return Result.error("缺少参数");
             }
-            Result<Object> result = liveDataAdService.importExcel(accountId, statMonth, file);
+            Result<Object> result = liveDataAdService.importExcel(accountId, file);
             recordService.addImportRecord(accountId, 7, userId);
             return result;
 

+ 1 - 20
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/controller/LiveDataAgeController.java

@@ -5,7 +5,6 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.live.entity.LiveDataAge;
 import cn.com.ctop.kuaishou.modules.live.service.ILiveDataAgeService;
 import cn.com.ctop.kuaishou.modules.live.service.ILiveDataImportRecordService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -14,35 +13,17 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
 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.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 直播数据——各年龄段人群报表
@@ -83,7 +64,7 @@ public class LiveDataAgeController {
             queryWrapper.eq("age", liveDataAge.getAge());
         }
         queryWrapper.eq("state", 1);
-        queryWrapper.orderByDesc("create_time");
+        queryWrapper.orderByDesc("create_time").orderByAsc("age");
         IPage<LiveDataAge> pageList = liveDataAgeService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/controller/LiveDataGenderController.java

@@ -64,7 +64,7 @@ public class LiveDataGenderController {
             queryWrapper.eq("gender", liveDataGender.getGender());
         }
         queryWrapper.eq("state", 1);
-        queryWrapper.orderByDesc("create_time");
+        queryWrapper.orderByDesc("create_time").orderByAsc("gender");
         IPage<LiveDataGender> pageList = liveDataGenderService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/controller/LiveDataPriceController.java

@@ -64,7 +64,7 @@ public class LiveDataPriceController {
             queryWrapper.eq("price", liveDataPrice.getPrice());
         }
         queryWrapper.eq("state", 1);
-        queryWrapper.orderByDesc("create_time");
+        queryWrapper.orderByDesc("create_time").orderByAsc("price");
         IPage<LiveDataPrice> pageList = liveDataPriceService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/controller/LiveDataProvinceController.java

@@ -63,7 +63,7 @@ public class LiveDataProvinceController {
             queryWrapper.eq("province", liveDataProvince.getProvince());
         }
         queryWrapper.eq("state", 1);
-        queryWrapper.orderByDesc("create_time");
+        queryWrapper.orderByDesc("create_time").orderByAsc("province");
         Page<LiveDataProvince> page = new Page<LiveDataProvince>(pageNo, pageSize);
         IPage<LiveDataProvince> pageList = liveDataProvinceService.page(page, queryWrapper);
         result.setSuccess(true);

+ 2 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/service/ILiveDataAdService.java

@@ -7,11 +7,12 @@ import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 直播数据——广告人群报表
+ *
  * @author jeecg-boot
  * 2022-04-06
  * @version V1.0
  */
 public interface ILiveDataAdService extends IService<LiveDataAd> {
 
-    Result<Object> importExcel(Long accountId, String statMonth, MultipartFile file) throws Exception;
+    Result<Object> importExcel(Long accountId, MultipartFile file) throws Exception;
 }

+ 3 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/service/impl/LiveDataAdServiceImpl.java

@@ -4,12 +4,10 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.kuaishou.modules.live.entity.LiveDataAd;
 import cn.com.ctop.kuaishou.modules.live.enums.AdEnum;
-import cn.com.ctop.kuaishou.modules.live.enums.ProvinceEnum;
 import cn.com.ctop.kuaishou.modules.live.enums.liveDataUtil;
 import cn.com.ctop.kuaishou.modules.live.mapper.LiveDataAdMapper;
 import cn.com.ctop.kuaishou.modules.live.service.ILiveDataAdService;
 import cn.hutool.core.util.CharsetUtil;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
@@ -40,7 +38,7 @@ import java.util.UUID;
 public class LiveDataAdServiceImpl extends ServiceImpl<LiveDataAdMapper, LiveDataAd> implements ILiveDataAdService {
 
     @Override
-    public Result<Object> importExcel(Long accountId, String statMonth, MultipartFile file) throws Exception {
+    public Result<Object> importExcel(Long accountId, MultipartFile file) throws Exception {
 
         JSONObject returnJson = new JSONObject();
         Workbook workbook = null;
@@ -71,7 +69,7 @@ public class LiveDataAdServiceImpl extends ServiceImpl<LiveDataAdMapper, LiveDat
         //获取映射关系
         JSONObject titleObj = liveDataUtil.getAdTitle(eeu, titleRow, lastCellNum);
 
-       List<JSONObject> array = new ArrayList<>();
+        List<JSONObject> array = new ArrayList<>();
         for (int i = 1; i <= rows + 1; i++) {
             Row row = sheet.getRow(i);
             if (row != null) {
@@ -128,7 +126,7 @@ public class LiveDataAdServiceImpl extends ServiceImpl<LiveDataAdMapper, LiveDat
         List<List<String>> list = liveDataUtil.getCsvList(records);
         //获取映射关系
         JSONObject titleObj = liveDataUtil.getCsvAdTitle(list.get(0));
-       List<JSONObject> array = new ArrayList<>();
+        List<JSONObject> array = new ArrayList<>();
         for (int i = 1; i < list.size(); i++) {
             List<String> values = list.get(i);
             JSONObject entityObj = new JSONObject();