From 06f892ba7e04089c3b462aec3c957e1a89ae2251 Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Fri, 15 Nov 2024 10:38:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/app/entity/PartApplyAppVo.java | 4 +- .../app/service/PartApplyAppServiceImp.java | 4 +- .../controller/StatisticsController.java | 66 +++++++++++++++---- .../gzgqj/business/bases/entity/PaTypeVo.java | 11 ++++ .../bases/entity/PartCheckDetailsVo.java | 13 ++-- .../bases/service/PartApplyServiceImpl.java | 2 +- .../service/UserPartInfoServiceImpl.java | 3 +- .../mappers/bases/PartApplyMapper.xml | 4 +- 8 files changed, 83 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/bonus/gzgqj/business/app/entity/PartApplyAppVo.java b/src/main/java/com/bonus/gzgqj/business/app/entity/PartApplyAppVo.java index 96f0580..fc7a08b 100644 --- a/src/main/java/com/bonus/gzgqj/business/app/entity/PartApplyAppVo.java +++ b/src/main/java/com/bonus/gzgqj/business/app/entity/PartApplyAppVo.java @@ -84,7 +84,9 @@ public class PartApplyAppVo extends PageInfo { /** * 创建人 */ - private String creater; + private String creator; + + @Excel(name = "联系电话", width = 10.0, orderNum = "4") private String phone; diff --git a/src/main/java/com/bonus/gzgqj/business/app/service/PartApplyAppServiceImp.java b/src/main/java/com/bonus/gzgqj/business/app/service/PartApplyAppServiceImp.java index 189edda..d6ec089 100644 --- a/src/main/java/com/bonus/gzgqj/business/app/service/PartApplyAppServiceImp.java +++ b/src/main/java/com/bonus/gzgqj/business/app/service/PartApplyAppServiceImp.java @@ -93,8 +93,8 @@ public class PartApplyAppServiceImp { try{ Long userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId(); String userName=UserUtil.getLoginUser().getUsername(); - if(StringHelper.isEmpty(dto.getCreater())){ - dto.setCreater(userId.toString()); + if(StringHelper.isEmpty(dto.getCreator())){ + dto.setCreator(userId.toString()); } if(StringHelper.isEmpty(dto.getUserName())){ dto.setUserName(userName); diff --git a/src/main/java/com/bonus/gzgqj/business/bases/controller/StatisticsController.java b/src/main/java/com/bonus/gzgqj/business/bases/controller/StatisticsController.java index 396a7fb..33e4d7d 100644 --- a/src/main/java/com/bonus/gzgqj/business/bases/controller/StatisticsController.java +++ b/src/main/java/com/bonus/gzgqj/business/bases/controller/StatisticsController.java @@ -1,25 +1,28 @@ package com.bonus.gzgqj.business.bases.controller; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import com.bonus.gzgqj.business.app.entity.PartApplyAppVo; import com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo; -import com.bonus.gzgqj.business.bases.entity.PaTypeVo; -import com.bonus.gzgqj.business.bases.entity.PartBackVo; -import com.bonus.gzgqj.business.bases.entity.PartCheckVo; -import com.bonus.gzgqj.business.bases.entity.ProjectInfoVo; +import com.bonus.gzgqj.business.bases.entity.*; import com.bonus.gzgqj.business.bases.service.StatisticsServiceImpl; import com.bonus.gzgqj.business.plan.entity.FileUploadVo; +import com.bonus.gzgqj.business.plan.entity.PlanApplyBeanPlanExport; import com.bonus.gzgqj.manager.annotation.DecryptAndVerify; import com.bonus.gzgqj.manager.core.entity.EncryptedReq; import com.bonus.gzgqj.manager.webResult.ServerResponse; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -38,7 +41,7 @@ public class StatisticsController { private StatisticsServiceImpl service; /** - * 领料出库 查询 + * 数据预览库存 * @return */ @GetMapping("getPaTypeStatistics") @@ -47,7 +50,7 @@ public class StatisticsController { return ServerResponse.createSuccess(map); } /** - * 分页查询配件入库 + * 库存统计分页查询 * @param dto * @return */ @@ -61,11 +64,37 @@ public class StatisticsController { } - + /** + * 导出需求计划 + * @param + * @param + * @param + */ + @PostMapping("exportPaTypeList") + public void export(HttpServletRequest request, HttpServletResponse response, @RequestBody PaTypeVo dto) { + try { + List list = service.findByPage(dto); + final int[] num = {1}; + list.forEach(vo->{ + vo.setXh(num[0]); + num[0]++; + }); + ExportParams exportParams = new ExportParams("库存统计", "库存统计", ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBeanPlanExport.class, list); + response.setContentType("application/vnd.ms-excel"); + response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("库存统计" + ".xlsx", "UTF-8")); + ServletOutputStream outputStream = response.getOutputStream(); + workbook.write(outputStream); + outputStream.close(); + workbook.close(); + } catch (Exception e) { + log.error(e.toString(), e); + } + } /** - * 分页查询配件入库 + * 工程统计分页查询 * @param dto * @return */ @@ -81,7 +110,7 @@ public class StatisticsController { /** - * 查询工程领用信息 + * 工程统计详情查询 * @return */ @PostMapping("getProDetails") @@ -118,4 +147,15 @@ public class StatisticsController { return pageInfo; } + + + + + + + + + + + } diff --git a/src/main/java/com/bonus/gzgqj/business/bases/entity/PaTypeVo.java b/src/main/java/com/bonus/gzgqj/business/bases/entity/PaTypeVo.java index 1024fa7..ef5c097 100644 --- a/src/main/java/com/bonus/gzgqj/business/bases/entity/PaTypeVo.java +++ b/src/main/java/com/bonus/gzgqj/business/bases/entity/PaTypeVo.java @@ -1,5 +1,6 @@ package com.bonus.gzgqj.business.bases.entity; +import cn.afterturn.easypoi.excel.annotation.Excel; import lombok.Data; /** @@ -9,6 +10,10 @@ import lombok.Data; @Data public class PaTypeVo { + + @Excel(name = "序号", width = 10.0, orderNum = "0") + private int xh; + private int id; /** * 父id @@ -17,6 +22,7 @@ public class PaTypeVo { /** * 名称 */ + @Excel(name = "配件名称", width = 10.0, orderNum = "3") private String name; /** * 等级 @@ -25,14 +31,17 @@ public class PaTypeVo { /** * 数量 */ + @Excel(name = "库存", width = 10.0, orderNum = "6") private int num; /** * 价格 */ + @Excel(name = "单价", width = 10.0, orderNum = "7") private String price; /** * 单位 */ + @Excel(name = "计量单位", width = 10.0, orderNum = "5") private String unit; /** * 重量 @@ -52,10 +61,12 @@ public class PaTypeVo { /** * 信号 */ + @Excel(name = "规格型号", width = 10.0, orderNum = "4") private String model; /** * 类型 */ + @Excel(name = "配件类型", width = 10.0, orderNum = "2") private String type; diff --git a/src/main/java/com/bonus/gzgqj/business/bases/entity/PartCheckDetailsVo.java b/src/main/java/com/bonus/gzgqj/business/bases/entity/PartCheckDetailsVo.java index bbebc22..75a7047 100644 --- a/src/main/java/com/bonus/gzgqj/business/bases/entity/PartCheckDetailsVo.java +++ b/src/main/java/com/bonus/gzgqj/business/bases/entity/PartCheckDetailsVo.java @@ -46,7 +46,7 @@ public class PartCheckDetailsVo { /** * 配件类型 */ - @Excel(name = "单位", width = 10.0, orderNum = "5") + @Excel(name = "单位", width = 10.0, orderNum = "4") private String partUnit; private String remark; @@ -58,20 +58,23 @@ public class PartCheckDetailsVo { /** * 盘点前-库存数量 */ - @Excel(name = "库存量", width = 10.0, orderNum = "5") + @Excel(name = "库存量", width = 10.0, orderNum = "6") private int num; /** * 盘盈 */ - @Excel(name = "盘盈量", width = 10.0, orderNum = "5") + @Excel(name = "盘盈量", width = 10.0, orderNum = "7") private int addNum; /** * 盘亏 */ - @Excel(name = "盘亏量", width = 10.0, orderNum = "5") + @Excel(name = "盘亏量", width = 10.0, orderNum = "8") private int subNum; - @Excel(name = "单价", width = 10.0, orderNum = "4") + @Excel(name = "单价", width = 10.0, orderNum = "9") private String price; + @Excel(name = "金额", width = 10.0, orderNum = "10") + private String money; + } diff --git a/src/main/java/com/bonus/gzgqj/business/bases/service/PartApplyServiceImpl.java b/src/main/java/com/bonus/gzgqj/business/bases/service/PartApplyServiceImpl.java index 9181e6b..ecbde17 100644 --- a/src/main/java/com/bonus/gzgqj/business/bases/service/PartApplyServiceImpl.java +++ b/src/main/java/com/bonus/gzgqj/business/bases/service/PartApplyServiceImpl.java @@ -191,7 +191,7 @@ public class PartApplyServiceImpl implements PartApplyService{ List details=mapper.getDetailsList(det); String userName=UserUtil.getLoginUser().getUsername(); //出库数据 维护 - userPartInfoService.insert(details,vo.getCreater(),vo.getUserName()); + userPartInfoService.insert(details,vo.getCreator(),vo.getUserName()); details.forEach(detail->{ String partId=detail.getPartId(); int applyNum=detail.getApplyNum(); diff --git a/src/main/java/com/bonus/gzgqj/business/bases/service/UserPartInfoServiceImpl.java b/src/main/java/com/bonus/gzgqj/business/bases/service/UserPartInfoServiceImpl.java index 32c9134..aa6bb38 100644 --- a/src/main/java/com/bonus/gzgqj/business/bases/service/UserPartInfoServiceImpl.java +++ b/src/main/java/com/bonus/gzgqj/business/bases/service/UserPartInfoServiceImpl.java @@ -41,12 +41,13 @@ public class UserPartInfoServiceImpl { user.setPartType(vo.getPartType()); user.setPartModel(vo.getPartModel()); user.setUserName(userName); + user.setPartUnit(vo.getPartUnit()); user.setLyNum(vo.getApplyNum()); user.setGhNum(0); mapper.insertData(user); }else{ info.setLyNum(info.getLyNum()+vo.getApplyNum()); - mapper.updateData(user); + mapper.updateData(info); } } } diff --git a/src/main/resources/mappers/bases/PartApplyMapper.xml b/src/main/resources/mappers/bases/PartApplyMapper.xml index cd53f14..4483112 100644 --- a/src/main/resources/mappers/bases/PartApplyMapper.xml +++ b/src/main/resources/mappers/bases/PartApplyMapper.xml @@ -60,8 +60,10 @@