|
@@ -1,10 +1,14 @@
|
|
package com.fdkankan.manage.service.impl;
|
|
package com.fdkankan.manage.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.extra.servlet.ServletUtil;
|
|
import cn.hutool.extra.servlet.ServletUtil;
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
|
+import com.alibaba.excel.ExcelWriter;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.fdkankan.manage.common.CacheUtil;
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
import com.fdkankan.manage.common.RedisKeyUtil;
|
|
import com.fdkankan.manage.common.RedisKeyUtil;
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
@@ -12,11 +16,15 @@ import com.fdkankan.manage.entity.Feedback;
|
|
import com.fdkankan.manage.entity.FeedbackOption;
|
|
import com.fdkankan.manage.entity.FeedbackOption;
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
import com.fdkankan.manage.mapper.IFeedbackMapper;
|
|
import com.fdkankan.manage.mapper.IFeedbackMapper;
|
|
|
|
+import com.fdkankan.manage.service.IExcelService;
|
|
import com.fdkankan.manage.service.IFeedbackOptionService;
|
|
import com.fdkankan.manage.service.IFeedbackOptionService;
|
|
import com.fdkankan.manage.service.IFeedbackService;
|
|
import com.fdkankan.manage.service.IFeedbackService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.fdkankan.manage.util.ProvinceUtils;
|
|
import com.fdkankan.manage.util.ProvinceUtils;
|
|
import com.fdkankan.manage.vo.request.FeedbackParam;
|
|
import com.fdkankan.manage.vo.request.FeedbackParam;
|
|
|
|
+import com.fdkankan.manage.vo.request.OrderParam;
|
|
|
|
+import com.fdkankan.manage.vo.response.DownOrderVo;
|
|
|
|
+import com.fdkankan.manage.vo.response.FeedbackVo;
|
|
import com.fdkankan.manage.vo.response.GroupByAvg;
|
|
import com.fdkankan.manage.vo.response.GroupByAvg;
|
|
import com.fdkankan.manage.vo.response.IpAddressVo;
|
|
import com.fdkankan.manage.vo.response.IpAddressVo;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
@@ -25,12 +33,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.HashSet;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Set;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -50,6 +56,11 @@ public class FeedbackServiceImpl extends ServiceImpl<IFeedbackMapper, Feedback>
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Object pageList(FeedbackParam param) {
|
|
public Object pageList(FeedbackParam param) {
|
|
|
|
+ CacheUtil.feedbackParam = param;
|
|
|
|
+ return PageInfo.PageInfo(this.pageListByParam(param));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Page<FeedbackVo> pageListByParam(FeedbackParam param){
|
|
LambdaQueryWrapper<Feedback> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<Feedback> wrapper = new LambdaQueryWrapper<>();
|
|
if(param.getHardwareOptionId() != null){
|
|
if(param.getHardwareOptionId() != null){
|
|
wrapper.eq(Feedback::getHardwareOptionId,param.getHardwareOptionId());
|
|
wrapper.eq(Feedback::getHardwareOptionId,param.getHardwareOptionId());
|
|
@@ -63,6 +74,7 @@ public class FeedbackServiceImpl extends ServiceImpl<IFeedbackMapper, Feedback>
|
|
if(param.getStatus() != null){
|
|
if(param.getStatus() != null){
|
|
wrapper.eq(Feedback::getStatus,param.getStatus());
|
|
wrapper.eq(Feedback::getStatus,param.getStatus());
|
|
}
|
|
}
|
|
|
|
+ List<FeedbackVo> listVo = new ArrayList<>();
|
|
Page<Feedback> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
|
|
Page<Feedback> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
|
|
HashSet<Integer> optionIds = new HashSet<>();
|
|
HashSet<Integer> optionIds = new HashSet<>();
|
|
Set<Integer> collect = page.getRecords().stream().map(Feedback::getHardwareOptionId).collect(Collectors.toSet());
|
|
Set<Integer> collect = page.getRecords().stream().map(Feedback::getHardwareOptionId).collect(Collectors.toSet());
|
|
@@ -82,8 +94,15 @@ public class FeedbackServiceImpl extends ServiceImpl<IFeedbackMapper, Feedback>
|
|
if(record.getIndustryOptionId()!=null && map.get(record.getIndustryOptionId())!= null){
|
|
if(record.getIndustryOptionId()!=null && map.get(record.getIndustryOptionId())!= null){
|
|
record.setIndustryOption(map.get(record.getIndustryOptionId()));
|
|
record.setIndustryOption(map.get(record.getIndustryOptionId()));
|
|
}
|
|
}
|
|
|
|
+ FeedbackVo feedbackVo = new FeedbackVo();
|
|
|
|
+ BeanUtil.copyProperties(record,feedbackVo);
|
|
|
|
+ listVo.add(feedbackVo);
|
|
}
|
|
}
|
|
- return PageInfo.PageInfo(page);
|
|
|
|
|
|
+
|
|
|
|
+ Page<FeedbackVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
|
|
+ voPage.setRecords(listVo);
|
|
|
|
+ voPage.setTotal(page.getTotal());
|
|
|
|
+ return voPage;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -152,4 +171,34 @@ public class FeedbackServiceImpl extends ServiceImpl<IFeedbackMapper, Feedback>
|
|
redisUtil.set(redisKey,JSONObject.toJSONString(addressByIp));
|
|
redisUtil.set(redisKey,JSONObject.toJSONString(addressByIp));
|
|
return addressByIp;
|
|
return addressByIp;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ IExcelService excelService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void export(HttpServletRequest req, HttpServletResponse resp) {
|
|
|
|
+ FeedbackParam feedbackParam = CacheUtil.feedbackParam;
|
|
|
|
+ feedbackParam.setPageNum(1);
|
|
|
|
+ feedbackParam.setPageSize(5000);
|
|
|
|
+ Page<FeedbackVo> page = this.pageListByParam(feedbackParam);
|
|
|
|
+
|
|
|
|
+ ExcelWriter excelWriter = null;
|
|
|
|
+ try {
|
|
|
|
+ excelWriter = EasyExcel.write(resp.getOutputStream(),FeedbackVo.class).build();
|
|
|
|
+ excelService.commonExport(req,resp,"用户反馈列表",page.getRecords(),excelWriter);
|
|
|
|
+ while (page.hasNext()){
|
|
|
|
+ feedbackParam.setPageNum(feedbackParam.getPageNum()+1);
|
|
|
|
+ page = this.pageListByParam(feedbackParam);
|
|
|
|
+ if(page.getRecords().size() >0){
|
|
|
|
+ excelService.commonExport(req,resp,"用户反馈列表",page.getRecords(),excelWriter);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }finally {
|
|
|
|
+ if(excelWriter !=null){
|
|
|
|
+ excelWriter.finish();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|