dev
This commit is contained in:
parent
bb48e4d673
commit
78d9cea941
8
pom.xml
8
pom.xml
|
|
@ -85,8 +85,6 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 其他依赖 -->
|
<!-- 其他依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|
@ -129,7 +127,11 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>5.2.3</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
||||||
|
|
@ -18,17 +18,20 @@ import com.syjiaer.clinic.server.mapper.inventory.*;
|
||||||
import com.syjiaer.clinic.server.mapper.manager.ManagerUserMapper;
|
import com.syjiaer.clinic.server.mapper.manager.ManagerUserMapper;
|
||||||
import com.syjiaer.clinic.server.service.BaseService;
|
import com.syjiaer.clinic.server.service.BaseService;
|
||||||
import com.syjiaer.clinic.server.service.goods.GoodsService;
|
import com.syjiaer.clinic.server.service.goods.GoodsService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.ResourceUtils;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class InventoryPurchaseService extends BaseService {
|
public class InventoryPurchaseService extends BaseService {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -52,6 +55,7 @@ public class InventoryPurchaseService extends BaseService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private InventoryPurchaseLogMapper inventoryPurchaseLogMapper;
|
private InventoryPurchaseLogMapper inventoryPurchaseLogMapper;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 创建采购订单
|
* 创建采购订单
|
||||||
* @param inventoryPurchase 采购订单
|
* @param inventoryPurchase 采购订单
|
||||||
|
|
@ -417,4 +421,43 @@ public class InventoryPurchaseService extends BaseService {
|
||||||
inventoryPurchaseMapper.update(null, updateOrder);
|
inventoryPurchaseMapper.update(null, updateOrder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public String toExcel(List<Integer> cateIdList){
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
|
// 资源文件的路径
|
||||||
|
InputStream inputStream = classLoader.getResourceAsStream("excelTemplate/PurchasingTemplate.xlsx");
|
||||||
|
Workbook workbook = WorkbookFactory.create(inputStream);
|
||||||
|
|
||||||
|
// 2. 获取第一个Sheet
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
|
||||||
|
// 3. 修改内容(例如在A1单元格写入新内容)
|
||||||
|
Row row = sheet.getRow(10);
|
||||||
|
if (row == null) {
|
||||||
|
row = sheet.createRow(10);
|
||||||
|
}
|
||||||
|
Cell cell = row.getCell(0);
|
||||||
|
if (cell == null) {
|
||||||
|
cell = row.createCell(0);
|
||||||
|
}
|
||||||
|
cell.setCellValue("你好");
|
||||||
|
|
||||||
|
// 4. 保存为新文件
|
||||||
|
FileOutputStream outFile = new FileOutputStream("D:\\new_excel.xlsx");
|
||||||
|
workbook.write(outFile);
|
||||||
|
|
||||||
|
// 5. 关闭流
|
||||||
|
outFile.close();
|
||||||
|
inputStream.close();
|
||||||
|
|
||||||
|
System.out.println("Excel文件生成成功!");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue