Bläddra i källkod

bom上传模版修改

dongbw 7 år sedan
förälder
incheckning
f5247ef030

+ 37 - 37
src/main/java/com/uas/platform/b2c/trade/seek/service/impl/SeekPurchaseBomServiceImpl.java

@@ -13,7 +13,6 @@ import com.uas.platform.b2c.prod.product.component.modal.Component;
 import com.uas.platform.b2c.trade.seek.dao.*;
 import com.uas.platform.b2c.trade.seek.model.*;
 import com.uas.platform.b2c.trade.seek.service.SeekPurchaseBomService;
-import com.uas.platform.b2c.trade.seek.utils.DateUtils;
 import com.uas.platform.b2c.trade.support.CodeType;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.exception.IllegalOperatorException;
@@ -117,10 +116,10 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
     public final int CODENUM = 2;
     // 品牌
     public final int BRANDNUM = 0;
-    // 截止日期
-    public final int DEADLINENUM = 4;
+//    // 截止日期
+//    public final int DEADLINENUM = 4;
     // 采购数量
-    public final int AMOUNTNUM = 5;
+    public final int AMOUNTNUM = 4;
 //    public static final int CURRENCYNUM = 6;
 //    public static final int UNITPRICENUM = 7;
 //    public static final int ENCAPSULATIONNUM = 8;
@@ -171,6 +170,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
             if (sheet.getRow(startRow) != null && vaidSample(sheet.getRow(startRow))) {
                 startRow = 3;
             }
+            Date releaseDate = new Date(System.currentTimeMillis());
             for (int r = startRow; r <= rowNum; r++) {
                 Row row = sheet.getRow(r);
                 if (row != null) {
@@ -180,7 +180,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
                         continue;
                     }
                     seekPurchaseByBatch.setBomId(seekPurchaseBom.getId());
-                    seekPurchaseByBatch.setReleaseDate(new Date(System.currentTimeMillis()));
+                    seekPurchaseByBatch.setReleaseDate(releaseDate);
                     seekPurchaseByBatchList.add(seekPurchaseByBatch);
                 }
             }
@@ -230,9 +230,9 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         if (!"品牌名称".equals(StringUtilB2C.getStr(brandCellObj))) {
             return false;
         }
-        Object deadlineCellObj = readWorkBookCell(headerRow.getCell(DEADLINENUM), Cell.CELL_TYPE_STRING,
-                0, DEADLINENUM);
-        if (!"截止时间".equals(StringUtilB2C.getStr(deadlineCellObj))) {
+        Object prodTitleCellObj = readWorkBookCell(headerRow.getCell(KINDNUM), Cell.CELL_TYPE_STRING,
+                0, KINDNUM);
+        if (!"物料名称".equals(StringUtilB2C.getStr(prodTitleCellObj))) {
             return false;
         }
         return true;
@@ -279,34 +279,34 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
             seekPurchaseByBatch.setBrand(convert(brandValue, 50));
         }
 
-        // 截止日期
-        Object deadlineValue = readWorkBookCell(row.getCell(DEADLINENUM), Cell.CELL_TYPE_STRING,
-                rowNum, DEADLINENUM);
-        if (StringUtils.isEmpty(deadlineValue)) {
-            result += 1;
-        } else {
-            String deadline = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(deadlineValue));
-            if (deadline.contains(".")) {
-                deadline = deadline.replace(".", "-");
-            }
-            if (deadline.contains("/")) {
-                deadline = deadline.replace("/", "-");
-            }
-            try {
-                deadline = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(deadline, 10);
-                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-                Date deadlineDate = sdf.parse(deadline);
-                Date now = sdf.parse(sdf.format(new Date()));
-                if (deadlineDate.getTime() < now.getTime()) {
-                    seekPurchaseByBatch.setDeadline(null);
-                } else {
-                    seekPurchaseByBatch.setDeadline(DateUtils.addTime(deadlineDate, 0, 23, 59, 59));
-                }
-            } catch (Exception e) {
-                e.printStackTrace();
-                seekPurchaseByBatch.setDeadline(null);
-            }
-        }
+//        // 截止日期
+//        Object deadlineValue = readWorkBookCell(row.getCell(DEADLINENUM), Cell.CELL_TYPE_STRING,
+//                rowNum, DEADLINENUM);
+//        if (StringUtils.isEmpty(deadlineValue)) {
+//            result += 1;
+//        } else {
+//            String deadline = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(deadlineValue));
+//            if (deadline.contains(".")) {
+//                deadline = deadline.replace(".", "-");
+//            }
+//            if (deadline.contains("/")) {
+//                deadline = deadline.replace("/", "-");
+//            }
+//            try {
+//                deadline = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(deadline, 10);
+//                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+//                Date deadlineDate = sdf.parse(deadline);
+//                Date now = sdf.parse(sdf.format(new Date()));
+//                if (deadlineDate.getTime() < now.getTime()) {
+//                    seekPurchaseByBatch.setDeadline(null);
+//                } else {
+//                    seekPurchaseByBatch.setDeadline(DateUtils.addTime(deadlineDate, 0, 23, 59, 59));
+//                }
+//            } catch (Exception e) {
+//                e.printStackTrace();
+//                seekPurchaseByBatch.setDeadline(null);
+//            }
+//        }
 
         // 类目
         Object kindValue = readWorkBookCell(row.getCell(KINDNUM), Cell.CELL_TYPE_STRING,
@@ -324,7 +324,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
             try {
                 Double amount = Double.valueOf(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(amountValue)));
                 int amountInt = amount.intValue();
-                if (amount <= 0 || amount >= 1000000000 || amountInt != amount) {
+                if (amount <= 0 || amount >= 10000 || amountInt != amount) {
                     amount = null;
                 }
                 seekPurchaseByBatch.setAmount(amount);

BIN
src/main/resources/jxls-tpl/trade/seekPurchaseByBatch.xls