导出客户库存盘点明细

This commit is contained in:
mzr 2024-10-31 18:08:12 +08:00
parent 85ef56c5a4
commit 5a9679fe75
2 changed files with 48 additions and 1 deletions

View File

@ -5,8 +5,11 @@ import com.yb.lb.common.exception.CustomException;
import com.yb.lb.common.utils.ErrorUtils; import com.yb.lb.common.utils.ErrorUtils;
import com.yb.lb.webapp.excel.utils.EasyPoiUtils; import com.yb.lb.webapp.excel.utils.EasyPoiUtils;
import com.yb.lb.webapp.redis.service.RedisService; import com.yb.lb.webapp.redis.service.RedisService;
import com.yb.lb.webapp.stock.entity.ClientStockReport;
import com.yb.lb.webapp.stock.entity.CrmInventoryDetail; import com.yb.lb.webapp.stock.entity.CrmInventoryDetail;
import com.yb.lb.webapp.stock.service.ClientStockReportService;
import com.yb.lb.webapp.stock.service.InventoryInfoService; import com.yb.lb.webapp.stock.service.InventoryInfoService;
import com.yb.lb.webapp.utils.RoleDateUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -19,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -35,6 +39,10 @@ public class StockExcel {
InventoryInfoService inventoryInfoService; InventoryInfoService inventoryInfoService;
@Autowired @Autowired
RedisService redisService; RedisService redisService;
@Autowired
RoleDateUtils roleDateUtils;
@Autowired
ClientStockReportService clientStockReportService;
/** /**
* @description 库存查询导出 * @description 库存查询导出
@ -75,8 +83,38 @@ public class StockExcel {
/** /**
* 导出客户库存盘点明细 * 导出客户库存盘点明细
*
* @author mzr * @author mzr
* @date 2024/10/31 * @date 2024/10/31
*/ */
@ApiOperation(value = "导出客户库存盘点明细")
@GetMapping(value = "/exportClientStockReport")
public void exportClientStockReport(
@ApiParam(required = true, value = "开始日期") @RequestParam(required = true) String startDate,
@ApiParam(required = true, value = "结束日期") @RequestParam(required = true) String endDate,
@ApiParam(required = false, value = "客户id") @RequestParam(required = false) String clientId,
@ApiParam(required = false, value = "客户编码U8") @RequestParam(required = false) String uecode,
@ApiParam(required = false, value = "客户名称") @RequestParam(required = false) String clientName,
@ApiParam(required = false, value = "业务员名称") @RequestParam(required = false) String staffName,
@ApiParam(required = false, value = "部门id") @RequestParam(required = false) String areaId,
HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> params = new HashMap<>();
String token = request.getHeader("token");
if (!redisService.isKey(token)) {
throw new CustomException("用户未登录", ErrorUtils.IS_NOT_LOGIN_ERROR);
}
params = roleDateUtils.roleUtiles(token, areaId, "", "");
if ("0".equals(params.get("code"))) {
throw new CustomException("无权查看", ErrorUtils.USERNAME_POWER_ERROR);
}
params.put("startDate", startDate);
params.put("endDate", endDate);
params.put("clientId", clientId);
params.put("uecode", uecode);
params.put("clientName", clientName);
params.put("staffName", staffName);
List list = clientStockReportService.findList(params, ".getClientStockReportSql");
EasyPoiUtils.exportExcel(list, ClientStockReport.class, "客户库存盘点明细导出", response);
}
} }

View File

@ -1,5 +1,6 @@
package com.yb.lb.webapp.stock.entity; package com.yb.lb.webapp.stock.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -20,33 +21,41 @@ public class ClientStockReport implements java.io.Serializable {
/** 客户编码-u8 */ /** 客户编码-u8 */
@ApiModelProperty(value = "客户编码-u8") @ApiModelProperty(value = "客户编码-u8")
@Excel(name = "客户编码", width = 15, orderNum = "2")
private String uecode; private String uecode;
/** 客户名称 */ /** 客户名称 */
@ApiModelProperty(value = "客户名称") @ApiModelProperty(value = "客户名称")
@Excel(name = "客户名称", width = 30, orderNum = "3")
private String clientName; private String clientName;
/** 业务员名称 */ /** 业务员名称 */
@ApiModelProperty(value = "业务员名称") @ApiModelProperty(value = "业务员名称")
@Excel(name = "业务员", width = 15, orderNum = "1")
private String staffName; private String staffName;
/** 部门名称 */ /** 部门名称 */
@ApiModelProperty(value = "部门名称") @ApiModelProperty(value = "部门名称")
@Excel(name = "区域", width = 15, orderNum = "0")
private String areaName; private String areaName;
/** 最新盘点日期 */ /** 最新盘点日期 */
@ApiModelProperty(value = "最新盘点日期") @ApiModelProperty(value = "最新盘点日期")
@Excel(name = "最新盘点日期", width = 15, orderNum = "6")
private String billDate; private String billDate;
/** 最新盘点数量 */ /** 最新盘点数量 */
@ApiModelProperty(value = "最新盘点数量") @ApiModelProperty(value = "最新盘点数量")
@Excel(name = "最新盘点数量", width = 15, orderNum = "5")
private String countNum; private String countNum;
/** 最新盘点种类数 */ /** 最新盘点种类数 */
@ApiModelProperty(value = "最新盘点种类数") @ApiModelProperty(value = "最新盘点种类数")
@Excel(name = "最新盘点种类数", width = 15, orderNum = "4")
private String goodsNum; private String goodsNum;
/** 主键id */ /** 盘点次数 */
@ApiModelProperty(value = "盘点次数") @ApiModelProperty(value = "盘点次数")
@Excel(name = "盘点次数", width = 15, orderNum = "7")
private String billNum; private String billNum;
} }