From 7de835dea145fe8229f5f0100e2a90094e6d5b22 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 07 二月 2025 18:49:38 +0800
Subject: [PATCH] 改bug
---
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java | 54 +++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 45 insertions(+), 9 deletions(-)
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java
index 5600123..9ac8faf 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java
@@ -1,5 +1,6 @@
package com.doumee.cloud.admin;
+import cn.emay.sdk.util.StringUtil;
import com.doumee.api.BaseController;
import com.doumee.config.annotation.CloudRequiredPermission;
import com.doumee.core.annotation.excel.ExcelExporter;
@@ -9,10 +10,13 @@
import com.doumee.core.model.PageData;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.model.YwOutinbound;
+import com.doumee.dao.business.model.YwOutinboundRecord;
+import com.doumee.dao.business.vo.YwOutinboundExcelInVO;
+import com.doumee.dao.business.vo.YwOutinboundExcelOutVO;
import com.doumee.service.business.YwOutinboundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@@ -36,14 +40,15 @@
@ApiOperation("鏂板缓")
@PostMapping("/create")
@CloudRequiredPermission("business:ywoutinbound:create")
- public ApiResponse create(@RequestBody YwOutinbound ywOutinbound) {
+ public ApiResponse create(@RequestBody YwOutinbound ywOutinbound,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ ywOutinbound.setLoginUserInfo(this.getLoginUser(token));
return ApiResponse.success(ywOutinboundService.create(ywOutinbound));
}
@ApiOperation("鏍规嵁ID鍒犻櫎")
@GetMapping("/delete/{id}")
@CloudRequiredPermission("business:ywoutinbound:delete")
- public ApiResponse deleteById(@PathVariable Integer id) {
+ public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
ywOutinboundService.deleteById(id);
return ApiResponse.success(null);
}
@@ -51,7 +56,7 @@
@ApiOperation("鎵归噺鍒犻櫎")
@GetMapping("/delete/batch")
@CloudRequiredPermission("business:ywoutinbound:delete")
- public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
+ public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
String [] idArray = ids.split(",");
List<Integer> idList = new ArrayList<>();
for (String id : idArray) {
@@ -64,7 +69,8 @@
@ApiOperation("鏍规嵁ID淇敼")
@PostMapping("/updateById")
@CloudRequiredPermission("business:ywoutinbound:update")
- public ApiResponse updateById(@RequestBody YwOutinbound ywOutinbound) {
+ public ApiResponse updateById(@RequestBody YwOutinbound ywOutinbound,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ ywOutinbound.setLoginUserInfo(this.getLoginUser(token));
ywOutinboundService.updateById(ywOutinbound);
return ApiResponse.success(null);
}
@@ -72,21 +78,51 @@
@ApiOperation("鍒嗛〉鏌ヨ")
@PostMapping("/page")
@CloudRequiredPermission("business:ywoutinbound:query")
- public ApiResponse<PageData<YwOutinbound>> findPage (@RequestBody PageWrap<YwOutinbound> pageWrap) {
+ public ApiResponse<PageData<YwOutinbound>> findPage (@RequestBody PageWrap<YwOutinbound> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
return ApiResponse.success(ywOutinboundService.findPage(pageWrap));
}
@ApiOperation("瀵煎嚭Excel")
@PostMapping("/exportExcel")
@CloudRequiredPermission("business:ywoutinbound:exportExcel")
- public void exportExcel (@RequestBody PageWrap<YwOutinbound> pageWrap, HttpServletResponse response) {
- ExcelExporter.build(YwOutinbound.class).export(ywOutinboundService.findPage(pageWrap).getRecords(), "杩愮淮鍑哄叆搴撲俊鎭〃", response);
+ public void exportExcel (@RequestBody PageWrap<YwOutinbound> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ List<YwOutinbound> ywOutinboundList = ywOutinboundService.findPage(pageWrap).getRecords();
+ Integer inOut = pageWrap.getModel().getInOut();
+ if(Constants.equalsInteger(inOut,Constants.ZERO)){
+ List<YwOutinboundExcelInVO> inList = new ArrayList<>();
+ for (YwOutinbound ywOutinbound:ywOutinboundList) {
+ YwOutinboundExcelInVO inVO = new YwOutinboundExcelInVO();
+ BeanUtils.copyProperties(ywOutinbound,inVO);
+ List<YwOutinboundRecord> ywOutinboundRecordList = ywOutinbound.getRecordList();
+ StringBuffer stringBuffer = new StringBuffer();
+ for (YwOutinboundRecord ywOutinboundRecord:ywOutinboundRecordList) {
+ stringBuffer.append(ywOutinboundRecord.getMaterialName()+"["+ywOutinboundRecord.getMaterialCode()+"]*"+ywOutinboundRecord.getStock()+ywOutinboundRecord.getMaterialUnitName()+";");
+ }
+ inVO.setOutMaterialNum(stringBuffer.toString());
+ inList.add(inVO);
+ }
+ ExcelExporter.build(YwOutinboundExcelInVO.class).export(inList, "鍏ュ簱淇℃伅琛�", response);
+ }else{
+ List<YwOutinboundExcelOutVO> outList = new ArrayList<>();
+ for (YwOutinbound ywOutinbound:ywOutinboundList) {
+ YwOutinboundExcelOutVO ywOutinboundExcelOutVO = new YwOutinboundExcelOutVO();
+ BeanUtils.copyProperties(ywOutinbound,ywOutinboundExcelOutVO);
+ List<YwOutinboundRecord> ywOutinboundRecordList = ywOutinbound.getRecordList();
+ StringBuffer stringBuffer = new StringBuffer();
+ for (YwOutinboundRecord ywOutinboundRecord:ywOutinboundRecordList) {
+ stringBuffer.append(ywOutinboundRecord.getMaterialName()+"["+ywOutinboundRecord.getMaterialCode()+"]*"+ywOutinboundRecord.getStock()+ywOutinboundRecord.getMaterialUnitName()+";");
+ }
+ ywOutinboundExcelOutVO.setOutMaterialNum(stringBuffer.toString());
+ outList.add(ywOutinboundExcelOutVO);
+ }
+ ExcelExporter.build(YwOutinboundExcelOutVO.class).export(outList, "鍑哄簱淇℃伅琛�", response);
+ }
}
@ApiOperation("鏍规嵁ID鏌ヨ")
@GetMapping("/{id}")
@CloudRequiredPermission("business:ywoutinbound:query")
- public ApiResponse findById(@PathVariable Integer id) {
+ public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
return ApiResponse.success(ywOutinboundService.getDetail(id));
}
}
--
Gitblit v1.9.3