|
@@ -1,11 +1,26 @@
|
|
package org.jeecg.modules.jixiaoPersonPrice.service.impl;
|
|
package org.jeecg.modules.jixiaoPersonPrice.service.impl;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
+import org.jeecg.modules.jixiaoPersonPrice.dto.JixiaoPersonPriceExportDTO;
|
|
import org.jeecg.modules.jixiaoPersonPrice.entity.JixiaoPersonPrice;
|
|
import org.jeecg.modules.jixiaoPersonPrice.entity.JixiaoPersonPrice;
|
|
import org.jeecg.modules.jixiaoPersonPrice.mapper.JixiaoPersonPriceMapper;
|
|
import org.jeecg.modules.jixiaoPersonPrice.mapper.JixiaoPersonPriceMapper;
|
|
import org.jeecg.modules.jixiaoPersonPrice.service.IJixiaoPersonPriceService;
|
|
import org.jeecg.modules.jixiaoPersonPrice.service.IJixiaoPersonPriceService;
|
|
|
|
+import org.jeecgframework.poi.excel.ExcelExportUtil;
|
|
|
|
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
|
+import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
|
+import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
|
|
|
|
+import org.jeecgframework.poi.excel.view.JeecgMapExcelView;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.net.URLEncoder;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 人员绩效提成
|
|
* @Description: 人员绩效提成
|
|
@@ -16,4 +31,63 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@Service
|
|
@Service
|
|
public class JixiaoPersonPriceServiceImpl extends ServiceImpl<JixiaoPersonPriceMapper, JixiaoPersonPrice> implements IJixiaoPersonPriceService {
|
|
public class JixiaoPersonPriceServiceImpl extends ServiceImpl<JixiaoPersonPriceMapper, JixiaoPersonPrice> implements IJixiaoPersonPriceService {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ @SuppressWarnings("all")
|
|
|
|
+ private JixiaoPersonPriceMapper jixiaoPersonPriceMapper;
|
|
|
|
+
|
|
|
|
+ @Value("${jeecg.path.upload}")
|
|
|
|
+ private String upLoadPath;
|
|
|
|
+
|
|
|
|
+ /**查询导出的人员绩效*/
|
|
|
|
+ public List<Map> exportPersonJX(JixiaoPersonPriceExportDTO dto){
|
|
|
|
+ List<List<Map>> list = jixiaoPersonPriceMapper.exportPersonJX(dto);
|
|
|
|
+ List<Map> mapList = list.get(1);
|
|
|
|
+ return mapList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void downloadExcel1(HttpServletResponse response, String outputName, HSSFWorkbook hssfWorkbook) throws IOException {
|
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
|
+ //attachment为以附件方式下载
|
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=" +
|
|
|
|
+ URLEncoder.encode(outputName, "utf-8"));
|
|
|
|
+ response.setHeader("Cache-Control", "No-cache");
|
|
|
|
+ response.flushBuffer();
|
|
|
|
+
|
|
|
|
+ hssfWorkbook.write(response.getOutputStream());
|
|
|
|
+ hssfWorkbook.close();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 人员绩效——按时间导出excel
|
|
|
|
+ */
|
|
|
|
+ public ModelAndView exportXlsByTime(HttpServletResponse response,List<Map> exportList, String title) {
|
|
|
|
+// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
+
|
|
|
|
+ List<ExcelExportEntity> mapList = new ArrayList<>();//这部分可修改为按选择字段导出
|
|
|
|
+ if(exportList != null && !exportList.isEmpty()){
|
|
|
|
+ Map map = exportList.get(0);
|
|
|
|
+ // 打印键集合
|
|
|
|
+ for (Object key : map.keySet()) {
|
|
|
|
+ System.out.println((String) key);
|
|
|
|
+ mapList.add(new ExcelExportEntity((String) key, key));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Step.3 AutoPoi 导出Excel
|
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgMapExcelView());
|
|
|
|
+ //此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, title);
|
|
|
|
+// mv.addObject(NormalExcelConstants.MAP_LIST, mapList);
|
|
|
|
+// mv.addObject(NormalExcelConstants.CLASS, clazz);
|
|
|
|
+ //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
|
|
|
+// ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
|
|
|
|
+ ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + "LLL", title);
|
|
|
|
+ exportParams.setImageBasePath(upLoadPath);
|
|
|
|
+ //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS,exportParams);
|
|
|
|
+ mv.addObject(NormalExcelConstants.MAP_LIST, exportList);
|
|
|
|
+ return mv;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|