Pārlūkot izejas kodu

王子文 生产日报导入

wangggziwen 2 gadi atpakaļ
vecāks
revīzija
11773e29ca

+ 25 - 30
master/src/main/java/com/ruoyi/project/production/service/impl/TDailyProductionReportServiceImpl.java

@@ -19,8 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
  * @date 2022-08-23
  */
 @Service
-public class TDailyProductionReportServiceImpl implements ITDailyProductionReportService
-{
+public class TDailyProductionReportServiceImpl implements ITDailyProductionReportService {
     @Autowired
     private TDailyProductionReportMapper tDailyProductionReportMapper;
 
@@ -41,8 +40,7 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
      * @return 每日生产报告
      */
     @Override
-    public TDailyProductionReport selectTDailyProductionReportById(Long id)
-    {
+    public TDailyProductionReport selectTDailyProductionReportById(Long id) {
         return tDailyProductionReportMapper.selectTDailyProductionReportById(id);
     }
 
@@ -53,8 +51,7 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
      * @return 每日生产报告
      */
     @Override
-    public List<TDailyProductionReport> selectTDailyProductionReportList(TDailyProductionReport tDailyProductionReport)
-    {
+    public List<TDailyProductionReport> selectTDailyProductionReportList(TDailyProductionReport tDailyProductionReport) {
         return tDailyProductionReportMapper.selectTDailyProductionReportList(tDailyProductionReport);
     }
 
@@ -65,8 +62,7 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
      * @return 结果
      */
     @Override
-    public int insertTDailyProductionReport(TDailyProductionReport tDailyProductionReport)
-    {
+    public int insertTDailyProductionReport(TDailyProductionReport tDailyProductionReport) {
         return tDailyProductionReportMapper.insertTDailyProductionReport(tDailyProductionReport);
     }
 
@@ -77,8 +73,7 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
      * @return 结果
      */
     @Override
-    public int updateTDailyProductionReport(TDailyProductionReport tDailyProductionReport)
-    {
+    public int updateTDailyProductionReport(TDailyProductionReport tDailyProductionReport) {
         return tDailyProductionReportMapper.updateTDailyProductionReport(tDailyProductionReport);
     }
 
@@ -89,8 +84,7 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
      * @return 结果
      */
     @Override
-    public int deleteTDailyProductionReportByIds(Long[] ids)
-    {
+    public int deleteTDailyProductionReportByIds(Long[] ids) {
         return tDailyProductionReportMapper.deleteTDailyProductionReportByIds(ids);
     }
 
@@ -101,15 +95,14 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
      * @return 结果
      */
     @Override
-    public int deleteTDailyProductionReportById(Long id)
-    {
+    public int deleteTDailyProductionReportById(Long id) {
         return tDailyProductionReportMapper.deleteTDailyProductionReportById(id);
     }
 
     /**
      * 导入每日生产报告数据
      *
-     * @param file 用户上传的文件
+     * @param file            用户上传的文件
      * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
      * @return 结果
      */
@@ -269,7 +262,7 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
         tDailyProductionReport.setPoFluxOilToBd(this.getCellDataString(sheet, 19, 12));
 
         // rowIndex = 20
-        tDailyProductionReport.setRaff3FrBd(this.getCellDataString(sheet, 20, 0));
+        tDailyProductionReport.setRaffinate2pFr2ph(this.getCellDataString(sheet, 20, 0));
         tDailyProductionReport.setAeuBenzeneToYbs(this.getCellDataString(sheet, 20, 20));
 
         // rowIndex = 21
@@ -363,7 +356,7 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
 
         // rowIndex = 34
         tDailyProductionReport.setToluene(this.getCellDataString(sheet, 34, 0));
-        tDailyProductionReport.setRpgToPgu(this.getCellDataString(sheet, 34, 6));
+        tDailyProductionReport.setRpgToPgu2(this.getCellDataString(sheet, 34, 6));
         tDailyProductionReport.setPguBtxProduced(this.getCellDataString(sheet, 34, 10));
         tDailyProductionReport.setPguBtxChange(this.getCellDataString(sheet, 34, 11));
         tDailyProductionReport.setPguBtxToAeu(this.getCellDataString(sheet, 34, 12));
@@ -600,7 +593,7 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
         tDailyProductionReport.setLpSub(this.getCellDataString(sheet, 58, 14));
         tDailyProductionReport.setLpBcc(this.getCellDataString(sheet, 58, 15));
         tDailyProductionReport.setSctfStorageTk1510B(this.getCellDataString(sheet, 50, 17));
-        tDailyProductionReport.setSctfStorageTk1320OffBtx(this.getCellDataString(sheet, 50, 18));
+        tDailyProductionReport.setSctfStorageClt1370B(this.getCellDataString(sheet, 50, 18));
         tDailyProductionReport.setSctfStorageTk1360T(this.getCellDataString(sheet, 50, 19));
         tDailyProductionReport.setSctfStorageTk1410X(this.getCellDataString(sheet, 50, 20));
         tDailyProductionReport.setSctfStorageClt1380X(this.getCellDataString(sheet, 50, 21));
@@ -790,6 +783,8 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
         tDailyProductionReport.setProducedPguAeuKgce(this.getCellDataString(sheet, 69, 12));
         tDailyProductionReport.setHsProducet(this.getCellDataString(sheet, 69, 14));
 
+        System.out.println(tDailyProductionReport);
+
         // 新增一条生产日报记录
 //        tDailyProductionReportMapper.insertTDailyProductionReport(tDailyProductionReport);
 
@@ -797,26 +792,26 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
     }
 
     private String getCellDataString(Sheet sheet, int rowIndex, int cellIndex) {
-        String cellValue = null;
+        String cellValue = "";
         // 根据行下标,获取行对象
         Row row = sheet.getRow(rowIndex);
         // 根据列下表,获取单元格对象,如果单元格的值为空,则返回null
         Cell cell = row.getCell(cellIndex, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL);
-        // 设置单元格格式
-        cell.setCellType(CellType.STRING);
-        // 获取单元格数据
-        if (cellValue != null) {
-            cellValue =  cell.getStringCellValue();
+        if (cell != null) {
+            // 设置单元格格式
+            cell.setCellType(CellType.STRING);
+            // 获取单元格数据
+            cellValue = cell.getStringCellValue();
         }
         return cellValue;
     }
 
     private Date getCellDataDate(Sheet sheet, int rowIndex, int cellIndex) {
-        // 根据行下标,获取行对象
-        Row row = sheet.getRow(rowIndex);
-        // 根据列下表,获取单元格对象,如果单元格的值为空,则返回null
-        Cell cell = row.getCell(cellIndex, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL);
-        // 获取单元格数据
-        return cell.getDateCellValue();
+            // 根据行下标,获取行对象
+            Row row = sheet.getRow(rowIndex);
+            // 根据列下表,获取单元格对象,如果单元格的值为空,则返回null
+            Cell cell = row.getCell(cellIndex, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL);
+            // 获取单元格数据
+            return cell.getDateCellValue();
     }
 }