From 92a729959f0fc8e540ce312a9e25047a2244c1af Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 11 Jun 2021 22:02:16 +0800
Subject: [PATCH] fix
---
zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java | 80 +++++++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+), 1 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java b/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java
index 95ac4ed..ba436dc 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/statistics/AchieveAction.java
@@ -1,5 +1,7 @@
package com.matrix.system.hive.statistics;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.PaginationVO;
@@ -13,14 +15,17 @@
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.AchieveNew;
import com.matrix.system.hive.dao.AchieveNewDao;
+import com.matrix.system.hive.dto.AchieveNewStatisticsDto;
import com.matrix.system.hive.plugin.util.CollectionUtils;
import com.matrix.system.hive.service.AchieveNewService;
import com.matrix.system.hive.service.SysOrderItemService;
import com.matrix.system.hive.service.SysOrderService;
+import com.matrix.system.hive.vo.AchieveNewStatisticsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -53,6 +58,25 @@
@Autowired
private AchieveNewDao achieveNewDao;
+
+
+ /**
+ * 员工业绩统计
+ */
+ @PostMapping(value = "/achieveNewStatistics")
+ public @ResponseBody
+ AjaxResult achieveNewStatistics(@RequestBody AchieveNewStatisticsDto queryDto){
+ SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
+
+ queryDto.setCompanyId(sysUsers.getCompanyId());
+
+ Page<AchieveNewStatisticsVo> page = new Page(queryDto.getPageNum(), queryDto.getPageSize());
+ IPage<AchieveNewStatisticsVo> rows = achieveNewDao.achieveNewStatistics(page,queryDto);
+ AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal());
+ return result;
+ }
+
+
/**
* 门店每日单据明细表
*/
@@ -74,11 +98,16 @@
*/
@RequestMapping(value = "/findDailyInfoNew")
public @ResponseBody
- AjaxResult findDailyInfoNew(AchieveNew achieveNew, PaginationVO pageVo) {
+ AjaxResult findDailyInfoNew(@RequestBody AchieveNew achieveNew) {
SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
+ achieveNew.setCompanyId(sysUsers.getCompanyId());
if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){
achieveNew.setShopId(sysUsers.getShopId());
}
+ PaginationVO pageVo = new PaginationVO();
+
+ pageVo.setOffset(achieveNew.getOffset());
+ pageVo.setLimit(achieveNew.getLimit());
pageVo.setSort("datatime");
pageVo.setOrder("desc");
AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, achieveNewService.findDayFlow(achieveNew, pageVo),
@@ -86,6 +115,55 @@
return result;
}
+ @RequestMapping(value = "/exportAchieveNewStatisticsExcel")
+ public void exportAchieveNewStatisticsExcel(ModelMap model, HttpServletRequest request, HttpServletResponse response, AchieveNewStatisticsDto queryDto) throws IOException {
+ //这里是从数据库里查数据并组装成我们想要的数据结构的过程
+ List<ExcelSheetPO> res = new ArrayList<>();
+ ExcelSheetPO orderSheet = new ExcelSheetPO();
+ String title = "员工业绩统计";
+ orderSheet.setSheetName(title);
+ orderSheet.setTitle(title);
+ String[] header = {"规则名称", "门店名称", "业绩归属人", "业绩创建人", "订单金额", "现金", "划扣", "本金消耗", "赠送消耗"
+ , "服务提成", "人头", "项目个数", "服务时间", "订单类型"};
+ orderSheet.setHeaders(header);
+ SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
+ if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){
+ queryDto.setShopId(sysUsers.getShopId());
+ }
+ queryDto.setCompanyId(sysUsers.getCompanyId());
+ Page<AchieveNewStatisticsVo> page = new Page(1, Long.MAX_VALUE);
+ IPage<AchieveNewStatisticsVo> rows = achieveNewDao.achieveNewStatistics(page,queryDto);
+ List<AchieveNewStatisticsVo> dataList = rows.getRecords();
+ List<List<Object>> list = new ArrayList<>();
+ if (dataList.size() > 0) {
+ for (AchieveNewStatisticsVo item : dataList) {
+ List<Object> temp = new ArrayList<>();
+ temp.add(item.getRuleName());
+ temp.add(item.getShopName());
+ temp.add(item.getGuwen());
+ temp.add(item.getCreateBy());
+ temp.add(item.getZkTotal());
+ temp.add(item.getGoodsCash());
+ temp.add(item.getCardCash());
+ temp.add(item.getHisConsume());
+ temp.add(item.getFreeConsume());
+ temp.add(item.getProjPercentage());
+ temp.add(item.getNumberOfPeople());
+ temp.add(item.getProjNum());
+ temp.add(item.getProjTime());
+ temp.add(item.getOrderType());
+ list.add(temp);
+ }
+ }
+ orderSheet.setDataList(list);
+ res.add(orderSheet);
+ response = ResponseHeadUtil.setExcelHead(response);
+ response.setHeader("Content-Disposition",
+ "attachment;filename=" + java.net.URLEncoder.encode(title + DateUtil.getTimeMark() + ".xlsx".trim(), "UTF-8"));
+ OutputStream os = response.getOutputStream();
+ com.matrix.core.tools.excl.ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, res, os, true);
+ }
+
@RequestMapping(value = "/exportDailyInfoNew")
public void exportDailyInfoNew(ModelMap model, HttpServletRequest request, HttpServletResponse response, AchieveNew achieveNew) throws IOException {
//这里是从数据库里查数据并组装成我们想要的数据结构的过程
--
Gitblit v1.9.1