浏览代码

Excel修改

wangxiaoming 6 年之前
父节点
当前提交
5f7660ffda
共有 1 个文件被更改,包括 48 次插入46 次删除
  1. 48 46
      watero-rst-web/src/main/java/com/iamberry/rst/utils/ExcelUtil.java

+ 48 - 46
watero-rst-web/src/main/java/com/iamberry/rst/utils/ExcelUtil.java

@@ -502,18 +502,19 @@ public class ExcelUtil {
 
                 order.setOrderAddressName(nameValue);
                 if(!StringUtils.isEmpty(platformOrderIdValue)){
-                    if (!ValidateUtil.checkString(platformOrderIdValue.trim())) {
-                        order.setReturnStatus("error");
-                        order.setReturnMsg("交易号出错-交易号:"+platformOrderIdValue);
-                        order.setPlatformOrderId("1");
-                    }else{
+
+//                    if (!ValidateUtil.checkString(platformOrderIdValue.trim())) {
+//                        order.setReturnStatus("error");
+//                        order.setReturnMsg("交易号出错-交易号:"+platformOrderIdValue);
+//                        order.setPlatformOrderId("1");
+//                    }else{
                         Integer flag = salesOrderService.getOrderBySalesDealCodeNum(platformOrderIdValue.trim());
                         if(flag > 0){
                             order.setReturnStatus("error");
                             order.setReturnMsg("交易号重复");
                         }
                         order.setPlatformOrderId(platformOrderIdValue.trim());
-                    }
+//                    }
                 }else{
                     order.setReturnStatus("error");
                     order.setReturnMsg("订单交易号不正确");
@@ -544,50 +545,51 @@ public class ExcelUtil {
                     order.setOrderNum(Integer.valueOf(orderNum));
                 }
                 order.setOrderRemark(orderRemark);
-                if (infoColumnIndex.length == 1){
-                    // 如果infoColumnIndex = 1, 则表示需要截取(可能是-、“ ”)
-                    Cell cell = temp.getCell(infoColumnIndex[0]);
-                    String addrInfo = getValue(cell);
-                    if (addrInfo == null || "".equals(addrInfo)) {
-                        // 地址为空
-                        cell.setCellStyle(cellStyle);
-                        continue;
-                    }
 
-                    // 处理地址信息
-                    String[] addrs = splitAddress(addrInfo);
-                    if (addrs == null && addrs.length < 4) {
-                        // 地址不合法
-                        cell.setCellStyle(cellStyle);
+                try{
+                    if (infoColumnIndex.length == 1){
+                        // 如果infoColumnIndex = 1, 则表示需要截取(可能是-、“ ”)
+                        Cell cell = temp.getCell(infoColumnIndex[0]);
+                        String addrInfo = getValue(cell);
+                        if (addrInfo == null || "".equals(addrInfo)) {
+                            // 地址为空
+                            cell.setCellStyle(cellStyle);
+                            continue;
+                        }
+                            // 处理地址信息
+                            String[] addrs = splitAddress(addrInfo);
+                            if (addrs == null && addrs.length < 4) {
+                                // 地址不合法
+                                cell.setCellStyle(cellStyle);
+                                continue;
+                            }
+                            order.setOrderProvince(addrs[0].trim());
+                            order.setOrderCity(addrs[1].trim());
+                            order.setOrderArea(addrs[2].trim());
+                            order.setOrderAddress(addrInfo.trim());
+
+                    } else if (infoColumnIndex.length == 4) {
+                        order.setOrderProvince(getValue(temp.getCell(infoColumnIndex[0])).trim());
+                        order.setOrderCity(getValue(temp.getCell(infoColumnIndex[1])).trim());
+                        order.setOrderArea(getValue(temp.getCell(infoColumnIndex[2])).trim());
+                        order.setOrderAddress(getValue(temp.getCell(infoColumnIndex[3])).trim());
+                    } else if (infoColumnIndex.length == 3) {
+                        order.setOrderProvince(getValue(temp.getCell(infoColumnIndex[0])).trim());
+                        order.setOrderCity(getValue(temp.getCell(infoColumnIndex[1])).trim());
+                        order.setOrderArea(getValue(temp.getCell(infoColumnIndex[1])).trim());
+                        order.setOrderAddress(getValue(temp.getCell(infoColumnIndex[2])).trim());
+                    } else {
+                        for (int i : infoColumnIndex) {
+                            temp.getCell(infoColumnIndex[i]).setCellStyle(cellStyle);
+                        }
                         continue;
                     }
-
-                    try{
-                        order.setOrderProvince(addrs[0].trim());
-                        order.setOrderCity(addrs[1].trim());
-                        order.setOrderArea(addrs[2].trim());
-                        order.setOrderAddress(addrInfo.trim());
-                    }catch (Exception e){
-                        order.setReturnStatus("error");
-                        order.setReturnMsg("地址错误:"+ addrInfo);
-                        order.setPlatformOrderId("1");
-                    }
-                } else if (infoColumnIndex.length == 4) {
-                    order.setOrderProvince(getValue(temp.getCell(infoColumnIndex[0])).trim());
-                    order.setOrderCity(getValue(temp.getCell(infoColumnIndex[1])).trim());
-                    order.setOrderArea(getValue(temp.getCell(infoColumnIndex[2])).trim());
-                    order.setOrderAddress(getValue(temp.getCell(infoColumnIndex[3])).trim());
-                } else if (infoColumnIndex.length == 3) {
-                    order.setOrderProvince(getValue(temp.getCell(infoColumnIndex[0])).trim());
-                    order.setOrderCity(getValue(temp.getCell(infoColumnIndex[1])).trim());
-                    order.setOrderArea(getValue(temp.getCell(infoColumnIndex[1])).trim());
-                    order.setOrderAddress(getValue(temp.getCell(infoColumnIndex[2])).trim());
-                } else {
-                    for (int i : infoColumnIndex) {
-                        temp.getCell(infoColumnIndex[i]).setCellStyle(cellStyle);
-                    }
-                    continue;
+                }catch (Exception e){
+                    order.setReturnStatus("error");
+                    order.setReturnMsg("地址错误");
+                    order.setPlatformOrderId("1");
                 }
+
                 // 支付方式
                 order.setOrderPayType(1);
                 order.setOrderPayMoney(price.get(order.getOrderProductBarCode()).getColorDiscount() * order.getOrderNum());