|
@@ -49,6 +49,7 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
@@ -246,6 +247,16 @@ public class OrderController extends SuperController<OrderService, Long, Order,
|
|
|
return this.validFail("导入订单数据不完整");
|
|
|
}
|
|
|
|
|
|
+ if(!StringUtils.isBlank(orderInfo.get(3).toString())){
|
|
|
+ try{
|
|
|
+ DateUtil.stringToDate3(orderInfo.get(3).toString());
|
|
|
+ }catch (Exception e){
|
|
|
+ return this.validFail("导入订单数据第2行下单日期格式不正确");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return this.validFail("导入订单数据第2行下单日期格式不正确");
|
|
|
+ }
|
|
|
+
|
|
|
String zZoneInfo = String.valueOf(orderInfo.get(5));
|
|
|
String[] zZoneInfos = zZoneInfo.split("-");
|
|
|
if(zZoneInfos.length != 2){
|
|
@@ -260,31 +271,63 @@ public class OrderController extends SuperController<OrderService, Long, Order,
|
|
|
order.setOrderTime(DateUtil.stringToDate3(String.valueOf(orderInfo.get(3))));
|
|
|
|
|
|
List<Map> detailList = new ArrayList<>();
|
|
|
+ String maxdeliveryTime=null;
|
|
|
for(int i = 0; i < excelOrders.size(); i++){
|
|
|
// 遍历订单产品
|
|
|
+ int lineCount = i+1;
|
|
|
if(i > 1){
|
|
|
Map orderProduct = new HashedMap();
|
|
|
List<Object> line = excelOrders.get(i);
|
|
|
// 零件
|
|
|
String[] bbomInfos = String.valueOf(line.get(0)).split("-");
|
|
|
if(bbomInfos.length != 2){
|
|
|
- return this.validFail("导入订单数据第" + "行零件名称不正确");
|
|
|
+ return this.validFail("导入订单数据第" + lineCount + "行零件名称不正确");
|
|
|
}
|
|
|
orderProduct.put("bomId",bbomInfos[0]);
|
|
|
|
|
|
// 原材料原炉号
|
|
|
String[] furnaceBatchNoInfos = String.valueOf(line.get(1)).split("-");
|
|
|
if(furnaceBatchNoInfos.length != 4){
|
|
|
- return this.validFail("导入订单数据第" + "行零件原材料原炉批号不正确");
|
|
|
+ return this.validFail("导入订单数据第" + lineCount + "行零件原材料原炉批号不正确");
|
|
|
+ }
|
|
|
+ String excelDeliveryTime = line.get(3).toString();
|
|
|
+ if(StringUtils.isBlank(maxdeliveryTime)){
|
|
|
+ if(StringUtils.isNotBlank(excelDeliveryTime)){
|
|
|
+ try{
|
|
|
+ DateUtil.stringToDate3(maxdeliveryTime.toString());
|
|
|
+ }catch (Exception e){
|
|
|
+ return this.validFail("导入订单数据第" + lineCount + "行交付日期格式不正确");
|
|
|
+ }
|
|
|
+
|
|
|
+ maxdeliveryTime = excelDeliveryTime.toString();
|
|
|
+ }else{
|
|
|
+ return this.validFail("导入订单数据第" + lineCount + "行交付日期格式不正确");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(StringUtils.isNotBlank(excelDeliveryTime)){
|
|
|
+ try{
|
|
|
+ DateUtil.stringToDate3(maxdeliveryTime.toString());
|
|
|
+ }catch (Exception e){
|
|
|
+ return this.validFail("导入订单数据第" + lineCount + "行交互日期格式不正确");
|
|
|
+ }
|
|
|
+ if(maxdeliveryTime.compareTo(excelDeliveryTime.toString()) < 0){
|
|
|
+ maxdeliveryTime = excelDeliveryTime.toString();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return this.validFail("导入订单数据第" + lineCount + "行交付日期格式不正确");
|
|
|
+ }
|
|
|
}
|
|
|
orderProduct.put("furnaceBatchNo",furnaceBatchNoInfos[2]);
|
|
|
orderProduct.put("bomNum",line.get(2));
|
|
|
- orderProduct.put("deliveryTime",line.get(3));
|
|
|
+ orderProduct.put("deliveryTime",excelDeliveryTime);
|
|
|
orderProduct.put("remark",line.get(4));
|
|
|
|
|
|
detailList.add(orderProduct);
|
|
|
}
|
|
|
}
|
|
|
+ if(null != maxdeliveryTime){
|
|
|
+ order.setDeliveryTime(DateUtil.stringToDate3(maxdeliveryTime.toString()));
|
|
|
+ }
|
|
|
return baseService.saveExcelOrder(order,detailList);
|
|
|
|
|
|
}
|