| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | |
| | | |
| | | |
| | | @Override |
| | | public void importExpress(MultipartFile file) { |
| | | public R<JSONObject> importExpress(MultipartFile file) { |
| | | /* System.out.println("导入订单url:"+url); |
| | | URL url1 = null; |
| | | try { |
| | |
| | | throw new RuntimeException(e); |
| | | }*/ |
| | | List<String> orderNumberList=new ArrayList<>(); |
| | | |
| | | JSONObject result = new JSONObject(); |
| | | try (InputStream inputStream = file.getInputStream(); |
| | | Workbook workbook = new XSSFWorkbook(inputStream)) { |
| | | // Workbook workbook = new XSSFWorkbook(fileInputStream); |
| | |
| | | |
| | | //检查订单号是否重复 |
| | | if (orderNumberList.contains(orderNum)) { |
| | | throw new ServiceException("订单号重复:" + orderNum, 500); |
| | | // throw new ServiceException("订单号重复:" + orderNum, 500); |
| | | result.append("订单号:[", orderNum+"]重复"); |
| | | continue; |
| | | } |
| | | //数据库中是否存在 |
| | | ChargeOrder order = chargeOrderService.getOne(new LambdaQueryWrapper<ChargeOrder>() |
| | | .eq(ChargeOrder::getOrderNumber, orderNum) |
| | | ); |
| | | if (order != null) { |
| | | throw new ServiceException("数据库中订单已存在:" + orderNum, 500); |
| | | // throw new ServiceException("数据库中订单已存在:" + orderNum, 500); |
| | | result.append("订单号:[", orderNum+"]数据库中订单已存在"); |
| | | continue; |
| | | } |
| | | orderNumberList.add(orderNum);//添加到订单集合中 |
| | | |
| | |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | if(!result.isEmpty()){ |
| | | return R.ok(result); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |