From 6d93d570f56569bc3567e9f78342ad15f11b6f1e Mon Sep 17 00:00:00 2001
From: 76164 <761646706@qq.com>
Date: Thu, 25 Jul 2024 15:56:07 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E4=BB=B6=E6=A8=A1=E5=9D=97=E5=89=8D?=
=?UTF-8?q?=E5=90=8E=E7=AB=AF=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sgzb-modules/sgzb-base/pom.xml | 5 +-
.../base/controller/MaPartTypeController.java | 127 ++++++++++++------
.../bonus/sgzb/base/domain/MaPartType.java | 2 +
.../sgzb/base/service/IPartTypeService.java | 5 +
.../service/impl/MaPartTypeServiceImpl.java | 57 +++++++-
.../src/main/resources/template/template.xlsx | Bin 0 -> 10512 bytes
.../material/SecondaryWarehouseMapper.xml | 2 +-
sgzb-ui/src/api/system/upload.js | 19 +++
.../secondStore/secondStore.vue | 13 +-
sgzb-ui/src/views/system/user/index.vue | 22 +--
.../warehouseManage/machinery/parts/index.vue | 56 ++++++--
11 files changed, 231 insertions(+), 77 deletions(-)
create mode 100644 sgzb-modules/sgzb-base/src/main/resources/template/template.xlsx
diff --git a/sgzb-modules/sgzb-base/pom.xml b/sgzb-modules/sgzb-base/pom.xml
index 67ee6982..39f009a8 100644
--- a/sgzb-modules/sgzb-base/pom.xml
+++ b/sgzb-modules/sgzb-base/pom.xml
@@ -23,6 +23,9 @@
spring-cloud-starter-alibaba-nacos-discovery
+
+
+
com.alibaba.cloud
@@ -117,4 +120,4 @@
-
\ No newline at end of file
+
diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaPartTypeController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaPartTypeController.java
index 6bf802a2..9a175038 100644
--- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaPartTypeController.java
+++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaPartTypeController.java
@@ -1,19 +1,30 @@
package com.bonus.sgzb.base.controller;
import com.bonus.sgzb.base.domain.MaPartType;
+import com.bonus.sgzb.base.service.ExcelService;
import com.bonus.sgzb.base.service.IPartTypeService;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
-import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
-import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.List;
+import java.util.Map;
;
@@ -32,25 +43,32 @@ public class MaPartTypeController extends BaseController {
@Autowired
private IPartTypeService maPartTypeService;
+ @Autowired
+ private ExcelService excelService;
+
+ private static final String UPLOAD_DIR = "D:/work/wcy";
+
+
/**
* 查询配件类型列表
+ *
* @param maPartType
* @return
*/
@GetMapping("/list")
- public AjaxResult list(MaPartType maPartType)
- {
+ public AjaxResult list(MaPartType maPartType) {
List list = maPartTypeService.selectMaPartList(maPartType);
return AjaxResult.success(list);
}
/**
* 新增配件管理
+ *
* @param maPartType
* @return
*/
@PostMapping
- public AjaxResult add(@Validated @RequestBody MaPartType maPartType){
+ public AjaxResult add(@Validated @RequestBody MaPartType maPartType) {
if (!maPartTypeService.checkPaNameUnique(maPartType)) {
return error("新增配件名称'" + maPartType.getPaName() + "'失败,配件名称已存在");
}
@@ -60,53 +78,84 @@ public class MaPartTypeController extends BaseController {
/**
* 导出配件类型管理
+ *
* @param response
* @param maPartType
*/
@PostMapping("/export")
- public void export(HttpServletResponse response, MaPartType maPartType)
- {
+ public void export(HttpServletResponse response, MaPartType maPartType) {
List list = maPartTypeService.selectMyPartTypeList(maPartType);
ExcelUtil util = new ExcelUtil(MaPartType.class);
util.exportExcel(response, list, "配件类型管理数据");
}
- /**
- * 删除配件管理类型
- * @param paId
- * @return
- */
- @DeleteMapping("/{paId}")
- public AjaxResult delete(@PathVariable("paId") Long paId){
- if (maPartTypeService.hasChildBypaId(paId))
- {
- return warn("存在下级仓库列表,不允许删除");
+ @PostMapping("/readExcel")
+ public AjaxResult readExcelFile(@RequestParam("file") MultipartFile file) throws IOException {
+ // 创建上传目录,如果不存在的话
+ File dir = new File(UPLOAD_DIR);
+ if (!dir.exists()) {
+ dir.mkdirs();
}
- return toAjax(maPartTypeService.deletePaById(paId));
+
+ // 获取文件名
+ String fileName = file.getOriginalFilename();
+
+ // 定义文件路径
+ Path filePath = Paths.get(UPLOAD_DIR, fileName);
+
+ // 保存文件
+ file.transferTo(filePath.toFile());
+
+ Map>> stringMapMap = excelService.readExcelFile(filePath.toString());
+ return AjaxResult.success();
}
- /**
- * 根据id获取数据
- * @param paId
- * @return
- */
- @GetMapping("/{paId}")
- public AjaxResult getById(@PathVariable("paId") Long paId){
- MaPartType bean = maPartTypeService.getById(paId);
- return AjaxResult.success(bean);
- }
-
- /**
- * 根据id修改数据
- * @param maPartType
- * @return
- */
- @PostMapping("/updateById")
- public AjaxResult updateById(@RequestBody MaPartType maPartType){
- maPartType.setUpdateBy(SecurityUtils.getUsername());
- return toAjax(maPartTypeService.updateById(maPartType));
+ @PostMapping("/downLoad")
+ public void downLoadExcelFile() throws IOException {
+ HttpServletResponse resp = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
+ maPartTypeService.downLoadTemplate(resp);
}
-}
+ /**
+ * poi
+ * 删除配件管理类型
+ *
+ * @param paId
+ * @return
+ */
+ @DeleteMapping("/{paId}")
+ public AjaxResult delete (@PathVariable("paId") Long paId){
+ if (maPartTypeService.hasChildBypaId(paId)) {
+ return warn("存在下级仓库列表,不允许删除");
+ }
+ return toAjax(maPartTypeService.deletePaById(paId));
+ }
+
+ /**
+ * 根据id获取数据
+ *
+ * @param paId
+ * @return
+ */
+ @GetMapping("/{paId}")
+ public AjaxResult getById (@PathVariable("paId") Long paId){
+ MaPartType bean = maPartTypeService.getById(paId);
+ return AjaxResult.success(bean);
+ }
+
+ /**
+ * 根据id修改数据
+ *
+ * @param maPartType
+ * @return
+ */
+ @PostMapping("/updateById")
+ public AjaxResult updateById (@RequestBody MaPartType maPartType){
+ maPartType.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(maPartTypeService.updateById(maPartType));
+ }
+
+
+ }
diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaPartType.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaPartType.java
index 16515b46..495c4646 100644
--- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaPartType.java
+++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaPartType.java
@@ -88,5 +88,7 @@ public class MaPartType extends BaseEntity {
private String firstLevel;
+
+
}
diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/IPartTypeService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/IPartTypeService.java
index 34e844aa..42762b63 100644
--- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/IPartTypeService.java
+++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/IPartTypeService.java
@@ -3,6 +3,8 @@ package com.bonus.sgzb.base.service;
import com.bonus.sgzb.base.domain.MaPartType;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
import java.util.List;
/**
@@ -58,6 +60,9 @@ public interface IPartTypeService {
MaPartType getById(Long paId);
int updateById(MaPartType maPartType);
+
+
+ void downLoadTemplate(HttpServletResponse resp) throws IOException;
}
diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaPartTypeServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaPartTypeServiceImpl.java
index 64d4c25b..fbf5648d 100644
--- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaPartTypeServiceImpl.java
+++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaPartTypeServiceImpl.java
@@ -5,10 +5,20 @@ import com.bonus.sgzb.base.mapper.MaPartTypeMapper;
import com.bonus.sgzb.base.service.IPartTypeService;
import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.common.core.utils.StringUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.system.ApplicationHome;
import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
-import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.util.*;
/**
* 配件类型管理ma_part_type(MaPartType)表服务实现类
@@ -21,8 +31,10 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
@Autowired
private MaPartTypeMapper maPartTypeMapper;
+
/**
* 校验配件名称唯一性
+ *
* @param maPartType
* @return
*/
@@ -30,8 +42,7 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
public boolean checkPaNameUnique(MaPartType maPartType) {
Long paId = StringUtils.isNull(maPartType.getPaId()) ? -1L : maPartType.getPaId();
MaPartType info = maPartTypeMapper.checkPartNameUnique(maPartType.getPaId());
- if (StringUtils.isNotNull(info) && info.getPaId().longValue() != paId.longValue())
- {
+ if (StringUtils.isNotNull(info) && info.getPaId().longValue() != paId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@@ -39,6 +50,7 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
/**
* 新增配件管理
+ *
* @param maPartType
* @return
*/
@@ -50,6 +62,7 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
/**
* 查询配件类型列表
+ *
* @param maPartType
* @return
*/
@@ -60,6 +73,7 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
/**
* 导出配件管理类型
+ *
* @param maPartType
* @return
*/
@@ -70,6 +84,7 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
/**
* 查询是否含有子集
+ *
* @param paId
* @return
*/
@@ -81,6 +96,7 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
/**
* 删除配件类型
+ *
* @param paId
* @return
*/
@@ -98,5 +114,38 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
public int updateById(MaPartType maPartType) {
return maPartTypeMapper.updateById(maPartType);
}
-}
+ @Override
+ public void downLoadTemplate(HttpServletResponse response) throws IOException {
+ //模板名称
+ String templateName = "template.xlsx";
+ OutputStream out = null;
+ InputStream input =null;
+ try {
+ ApplicationHome h = new ApplicationHome(getClass());
+ String dirPath = h.getSource().toString();
+ String fileName = dirPath+"/template/"+templateName;
+ File outFile = new File(fileName);
+ input = new BufferedInputStream(new FileInputStream(outFile));
+ response.setCharacterEncoding("UTF-8");
+ response.setHeader("content-Type", "application/vnd.ms-excel");
+ response.setHeader("Content-Disposition",
+ "attachment;filename=" + new String((templateName).getBytes(), "iso-8859-1"));
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+ out = response.getOutputStream();
+ byte[] buffer = new byte[1024]; // 缓冲区
+ int bytesToRead = -1;
+ // 通过循环将读入内容输出到浏览器中
+ while ((bytesToRead = input.read(buffer)) != -1) {
+ out.write(buffer, 0, bytesToRead);
+ }
+ } catch (IOException e) {
+ throw new IOException("模板下载失败");
+ } finally {
+ IOUtils.closeQuietly(input);
+ IOUtils.closeQuietly(out);
+ }
+ }
+
+
+}
diff --git a/sgzb-modules/sgzb-base/src/main/resources/template/template.xlsx b/sgzb-modules/sgzb-base/src/main/resources/template/template.xlsx
new file mode 100644
index 0000000000000000000000000000000000000000..157483b22b7f5a01122a2ed8770d2922c7e2a07d
GIT binary patch
literal 10512
zcmeHtWmufcvnTHE!QBGECAho0TX1)GcZcBa!GgOx1P$&G+$Bf|utRe1IVaq+|7Z8>
zKHDGqoq4CE`&Zr7HC-hq2?_=S^wL6Pw)kG2|J|Sg9}I0i$l2T2I?%}h$j|^Upnj3v
z!@50l0s{frfB*p@{gX`J*7lvNm1So97YR@Xw4hu6Go+fTgP737R5bqnD7EUAm{d+H
zJ#y&g`P}d7D@{nApsF2F{xSN-AWqaRb}sP_?4A^)=@m!eEJ%~==~q+Tu}sxV=mYN@
zyldGBa2ABGN*$y&BGdR3-1IQTg5n{l~p)G;?yKG?H%rjW8*Qa|9k`Zk%aR~g3oVUD;>hhWtbg=Po
zTjCcMH3XBwI#RWL%?BrvpebvEi{MS|{c_zxuLd(#sRA2V_o84#)Wg49(cp1tyA=@f
z>SV94lb1xf8;PpBsE2|K*1VmTcv)cWXAyEGf-AG4Y9u<9TizN1q=
z1*tag*dk;mAP1)5STnVZ!ae)x4n}y~f!1x=jB*MXS3~6^W)QuUBL=>uN!JeuEi|zu
z27QUTt2O$_%mu%#chCrUebOfAx0_~-3$_;njlNVwu;pD2!`y?SdY0tG*l`L{VprD7
zz=Ytz7-*(vwrK@-%SYYRw|iYV8Sj<15y@AW2e?fnFUVw0+bzgHtlx_B;ur+}r1Dl@
z=S3(Uh~jZ315zIJ);Rsiq10@~w}xBh8TW1%{D~G#0d6X#x{G^=lIDZ%l+4K0@lB;p
zZa4}@%rH%nnRKOkGLwJ~tfzg{)hw9O_Ki=Nn^bMuH=0qbLX$q!9BljNpXZ0De}c@d
zw_-#M02vtoGU^{7J2^PoSi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YA}z1K~(3pnH_ClOT#m
zU6WGQ?HGQ+-Xoc@Obp;_XU=C$b>zO#nQ|7@n;X#f3{?V`Z3XKV6!_GJ!`trqUq(`F
zE2#^iz9rH{F6BG21}0K(W79~4uo(ti1O&S8x^xwtM&(@;`Ww=Cx}v99+8XUFXoh6K
z6%HyREY!K_NDxLf7eOhMXsYCJM3Z)hpm=i;7)c)GzV}R**IrFwAJlVl*wyJ}9La#z
zRl$YbEFyY+W_QTEdQQ6%-JzSm_^FT}s~QT&tbzlx?_L-e}#=Wp&3>%O
zy=H%1)$%v{cYtsHoBgjEm;W^Bm)ecr?Pbz(fPettiT)GApD39T{lj&=9_VWy_oC-F
zO0oZB`yU?fwVc<{+uw4YaQ{7)doAJh_2u6Zcu{^!`0FzB|9tKmfMf8lEZ%F4uhV^h
zYxMgk+uzB**8*P0XnzZU$N#1GpRoO>LBAB={BAE6w)<`27v{f8asFJ}uZwYBcz;_h
z^MCOEU7GWH_^&G={+414`PcCOYXrX@zv?3X&!y-A)*%4=f6U{TlwUb^IZ5zejsq2N
OOe6rtY(n~?{eJ=XYaycm
literal 0
HcmV?d00001
diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SecondaryWarehouseMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SecondaryWarehouseMapper.xml
index a06434ca..35ec6a13 100644
--- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SecondaryWarehouseMapper.xml
+++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SecondaryWarehouseMapper.xml
@@ -204,7 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_type mt on rd.type_id = mt.type_id
left join ma_type mt2 on mt.parent_id = mt2.type_id
left join sys_user su on rd.out_name = su.user_id
- where 1=1
+ where rd.type = 1
and mt2.type_id = #{typeId}
diff --git a/sgzb-ui/src/api/system/upload.js b/sgzb-ui/src/api/system/upload.js
index 4560e702..7b26e643 100644
--- a/sgzb-ui/src/api/system/upload.js
+++ b/sgzb-ui/src/api/system/upload.js
@@ -23,6 +23,25 @@ export function fileUpLoad(param){
})
}
+// excel文件上传
+export function excelUpLoad(param){
+ const formData = new FormData()
+ formData.append('file', param.file)
+ return request({
+ url: '/base/maPartType/readExcel',
+ method: 'post',
+ data: formData,
+ })
+}
+
+// excel文件下载
+export function downloadExcel(param){
+ return request({
+ url: '/base/maPartType/downLoad',
+ method: 'post',
+ param
+ })
+}
diff --git a/sgzb-ui/src/views/claimAndRefund/secondStore/secondStore.vue b/sgzb-ui/src/views/claimAndRefund/secondStore/secondStore.vue
index 9471c366..72c9b3af 100644
--- a/sgzb-ui/src/views/claimAndRefund/secondStore/secondStore.vue
+++ b/sgzb-ui/src/views/claimAndRefund/secondStore/secondStore.vue
@@ -310,7 +310,7 @@
@@ -427,14 +427,14 @@
width="1200px"
append-to-body
>
-
-
+ –>
@@ -465,8 +465,7 @@
>重置
-
-
+ -->
删除
-
-
-
-
-
-
-
-
-
-
-
+
+ 导入
+
下载导入模板
@@ -265,6 +266,8 @@
accept=".xlsx, .xls"
:limit="1"
:file-list="fileList"
+ :on-remove="handleRemoveExcel"
+ :on-exceed="excelExceed"
>
点击上传
@@ -308,7 +311,7 @@ import {
updatePartTypeById,
delPartType,
} from '@/api/store/tools'
-import { fileUpLoad } from '@/api/system/upload'
+import { excelUpLoad, downloadExcel } from '@/api/system/upload'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
@@ -384,7 +387,7 @@ export default {
isEdit: false,
// excel文件列表
fileList: [],
- excelList: {}
+ excelList: undefined
}
},
created() {
@@ -393,25 +396,50 @@ export default {
methods: {
/** 确认上传excel */
confirmUpload() {
- console.log(this.fileList)
- fileUpLoad(this.excelList).then(res => {
- console.log(res)
- if (res.code == 200) {
- this.$modal.msgSuccess(res.msg)
- this.openUpload = false
- this.reset()
- this.getList()
+ if (this.excelList != undefined) {
+ let ifSize = this.excelList.file.size / 1024 / 1024 < 20;
+ if (!ifSize) {
+ this.$modal.msgError('上传文件大于20M,请重新选择文件上传!')
} else {
- this.$modal.msgError(res.msg)
+ console.log(this.excelList)
+ excelUpLoad(this.excelList).then(res => {
+ console.log(res)
+ if (res.code == 200) {
+ this.$modal.msgSuccess(res.msg)
+ this.openUpload = false
+ this.reset()
+ this.getList()
+ } else {
+ this.$modal.msgError(res.msg)
+ }
+ }).catch(err => {
+ console.log(err)
+ })
}
- }).catch(err => {
- console.log(err)
- })
+ } else {
+ this.$modal.msgError('请选择上传文件!')
+ }
+ },
+ /** 点击下载excel导入模板 */
+ downloadExcelTemplate() {
+ this.download(
+ 'base/maPartType/downLoad',
+ {},
+ `配件模板.xlsx`,
+ )
},
/** 上传excel文件 */
uploadExcel(obj) {
this.excelList = obj
},
+ /** 移除excel文件 */
+ handleRemoveExcel() {
+ this.excelList = undefined
+ },
+ /** 上传的excel数超出限制 */
+ excelExceed(files, fileList) {
+ this.$modal.msgError('上传的excel文件数量超出限制!')
+ },
/** 上传excel文件前 */
beforeExcelUpload(file) {
console.log(file)