mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
#update
This commit is contained in:
@@ -11,6 +11,7 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.no1.wms.vendor.VendorDto;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
@@ -115,8 +116,76 @@ public class ExcelDownlodeUtils {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void downloadVendorExcelFile(String excelFileName, HttpServletResponse response,
|
||||
String sheetName, String[] columnName, List<VendorDto> dto) {
|
||||
String fileName = "";
|
||||
try {
|
||||
fileName = new String((excelFileName + ".xlsx").getBytes("utf-8"), "iso-8859-1");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
response.setContentType("ms-vnd/excel");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\";");
|
||||
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
Sheet sheet = workbook.createSheet(sheetName);
|
||||
|
||||
Row row = null;
|
||||
Cell cell = null;
|
||||
int rowNum = 0;
|
||||
|
||||
row = sheet.createRow(rowNum);
|
||||
for( int i = 0; i <= columnName.length -1; i++ ) {
|
||||
cell = row.createCell(i);
|
||||
cell.setCellValue(columnName[i]);
|
||||
}
|
||||
rowNum += 1;
|
||||
|
||||
//수정부분
|
||||
makeVendorBody(dto,row,sheet,cell,rowNum);
|
||||
|
||||
try {
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void makeVendorBody(List<VendorDto> listdto, Row row, Sheet sheet,
|
||||
Cell cell, int rowNum) {
|
||||
//
|
||||
for (int i = 0; i < listdto.size(); i++) {
|
||||
row = sheet.createRow(rowNum++);
|
||||
VendorDto dto = listdto.get(i);
|
||||
cell = row.createCell(0);
|
||||
cell.setCellValue(dto.getName());
|
||||
cell = row.createCell(1);
|
||||
cell.setCellValue(dto.getPresident_name());
|
||||
cell = row.createCell(2);
|
||||
cell.setCellValue(dto.getAddress());
|
||||
cell = row.createCell(3);
|
||||
cell.setCellValue(dto.getRegistration_number());
|
||||
cell = row.createCell(4);
|
||||
cell.setCellValue(dto.getEmail());
|
||||
cell = row.createCell(5);
|
||||
cell.setCellValue(dto.getPresident_telephone());
|
||||
cell = row.createCell(6);
|
||||
cell.setCellValue(dto.getVendor_manager());
|
||||
cell = row.createCell(7);
|
||||
cell.setCellValue(dto.getVendor_manager_telephone());
|
||||
cell = row.createCell(8);
|
||||
cell.setCellValue(dto.getMain_product());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/resetpassword")
|
||||
@@ -20,21 +21,16 @@ public class ResetPasswordController {
|
||||
@GetMapping("/list")
|
||||
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, String resetpassword, String cancelrequest, Model m) {
|
||||
@RequestParam(name = "p", defaultValue = "1") int page,
|
||||
Model m) {
|
||||
int count = resetPasswordService.count(searchn, search);
|
||||
|
||||
int perPage = 10; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
if(resetpassword != null){
|
||||
|
||||
}
|
||||
if(cancelrequest != null){
|
||||
|
||||
}
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
List<Map<String, Object>> dto = resetPasswordService.list(searchn, search, startRow ,perPage);
|
||||
|
||||
m.addAttribute("rlist", dto);
|
||||
|
||||
m.addAttribute("start", startRow + 1);
|
||||
@@ -55,8 +51,6 @@ public class ResetPasswordController {
|
||||
m.addAttribute("totalPages", totalPages);
|
||||
m.addAttribute("p" , page);
|
||||
|
||||
System.out.println("테스트 : : " + m);
|
||||
|
||||
|
||||
return "resetpassword/list";
|
||||
}
|
||||
@@ -70,13 +64,22 @@ public class ResetPasswordController {
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@DeleteMapping("/delete")
|
||||
@ResponseBody
|
||||
public String delete(ResetPasswordDto dto, Gson gson){
|
||||
resetPasswordService.delete(dto);
|
||||
|
||||
return gson.toJson("s");
|
||||
public int delete(ResetPasswordDto dto){
|
||||
int i = resetPasswordService.delete(dto);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ResponseBody
|
||||
public boolean update(ResetPasswordDto dto) {
|
||||
int i = resetPasswordService.passwordUpdate(dto);
|
||||
if (i != 0) {
|
||||
resetPasswordService.delete(dto);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ public interface ResetPasswordMapper {
|
||||
|
||||
void insert(ResetPasswordDto dto);
|
||||
|
||||
void delete(ResetPasswordDto dto);
|
||||
int delete(ResetPasswordDto dto);
|
||||
|
||||
int passwordUpdate(ResetPasswordDto dto);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,10 @@ public class ResetPasswordService {
|
||||
mapper.insert(dto);
|
||||
}
|
||||
|
||||
void delete(ResetPasswordDto dto){
|
||||
mapper.delete(dto);
|
||||
int delete(ResetPasswordDto dto){
|
||||
return mapper.delete(dto);
|
||||
}
|
||||
|
||||
int passwordUpdate(ResetPasswordDto dto){
|
||||
return mapper.passwordUpdate(dto);}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.no1.wms.vendor;
|
||||
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
import com.no1.wms.excel.ExcelDownlodeUtils;
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -7,6 +9,8 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -16,6 +20,9 @@ public class VendorController {
|
||||
|
||||
@Autowired
|
||||
VendorService service;
|
||||
|
||||
@Autowired
|
||||
ExcelDownlodeUtils excelDownlodeUtils;
|
||||
|
||||
// 재고 리스트 출력
|
||||
@GetMapping("vendor/list")
|
||||
@@ -121,4 +128,22 @@ public class VendorController {
|
||||
int i = service.deleteVendor(id);
|
||||
return i;
|
||||
}
|
||||
|
||||
// 엑셀다운로드테스트
|
||||
@GetMapping("/vendor/downloadTest")
|
||||
public void downloadExcelTest(HttpServletResponse response) {
|
||||
List<VendorDto> dto = service.selectAll();
|
||||
String excelFileName = "거래처 파일";
|
||||
String sheetName = "거래처";
|
||||
String[] columnName = {"업체명","대표자명","주소","사엄자등록번호","이메일","대표번호","거래처 담당자 이름","거래처 담당자 연락 번호","주요품목"};
|
||||
excelDownlodeUtils.downloadVendorExcelFile(excelFileName, response, sheetName, columnName, dto);
|
||||
|
||||
};
|
||||
|
||||
//서식 다운로드
|
||||
@GetMapping("/vendor/downlodeVendorForm")
|
||||
public void downlodeVendorForm (HttpServletResponse response) throws IOException {
|
||||
String vendorFormName = "거래처 데이터 입력 서식.xlsx";
|
||||
excelDownlodeUtils.downlodeExcelForm(response, vendorFormName);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface VendorMapper {
|
||||
|
||||
List<VendorDto> selectAll();
|
||||
List<VendorDto> list(Map<String, Object> m);
|
||||
|
||||
int count(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
@@ -54,4 +54,8 @@ public class VendorService {
|
||||
public int deleteVendor(String id) {
|
||||
return mapper.deleteVendor(id);
|
||||
}
|
||||
|
||||
public List<VendorDto> selectAll() {
|
||||
return mapper.selectAll();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user