重庆 二级库 配件管理 bug修改

This commit is contained in:
76164 2024-08-06 11:22:56 +08:00
parent 484714a665
commit 65040c2767
2 changed files with 13 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import com.bonus.sgzb.base.mapper.MaPartTypeMapper;
import com.bonus.sgzb.base.service.IPartTypeService; import com.bonus.sgzb.base.service.IPartTypeService;
import com.bonus.sgzb.common.core.constant.UserConstants; import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
@ -26,6 +27,7 @@ import java.util.*;
* @author makejava * @author makejava
* @since 2023-11-27 16:44:20 * @since 2023-11-27 16:44:20
*/ */
@Slf4j
@Service("maPartTypeService") @Service("maPartTypeService")
public class MaPartTypeServiceImpl implements IPartTypeService { public class MaPartTypeServiceImpl implements IPartTypeService {
@ -118,15 +120,17 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
@Override @Override
public void downLoadTemplate(HttpServletResponse response) throws IOException { public void downLoadTemplate(HttpServletResponse response) throws IOException {
//模板名称 //模板名称
String templateName = "template.xlsx"; String templateName = "template.xlsx";
OutputStream out = null; OutputStream out = null;
InputStream input =null; InputStream input =null;
try { try {
ApplicationHome h = new ApplicationHome(getClass()); // ApplicationHome h = new ApplicationHome(getClass());
String dirPath = h.getSource().toString(); // String dirPath = h.getSource().toString();
String fileName = dirPath+"/template/"+templateName; // String fileName = dirPath+"/template/"+templateName;
File outFile = new File(fileName); // File outFile = new File(fileName);
input = new BufferedInputStream(new FileInputStream(outFile)); // input = new BufferedInputStream(new FileInputStream(outFile));
input = this.getClass().getClassLoader().getResourceAsStream("template/template.xlsx");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel"); response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", response.setHeader("Content-Disposition",
@ -140,7 +144,8 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
out.write(buffer, 0, bytesToRead); out.write(buffer, 0, bytesToRead);
} }
} catch (IOException e) { } catch (IOException e) {
throw new IOException("模板下载失败"); log.error(e.getMessage());
// throw new IOException("模板下载失败");
} finally { } finally {
IOUtils.closeQuietly(input); IOUtils.closeQuietly(input);
IOUtils.closeQuietly(out); IOUtils.closeQuietly(out);

View File

@ -827,7 +827,7 @@ export default {
operate(param).then((response) => { operate(param).then((response) => {
this.$modal.msgSuccess('操作成功') this.$modal.msgSuccess('操作成功')
this.openOut = false this.openOut = false
this.getList() this.getList(this.leaseType)
}) })
} }
}) })
@ -848,7 +848,7 @@ export default {
operate(param).then((response) => { operate(param).then((response) => {
this.$modal.msgSuccess('操作成功') this.$modal.msgSuccess('操作成功')
this.openIn = false this.openIn = false
this.getList() this.getList(this.leaseType)
}) })
} }
}) })