|
|
@@ -31,6 +31,7 @@ import lombok.extern.log4j.Log4j2;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
+import org.apache.ibatis.builder.BuilderException;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -39,7 +40,6 @@ import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.ExecutionException;
|
|
|
import java.util.concurrent.ForkJoinPool;
|
|
|
import java.util.concurrent.Future;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
@@ -179,7 +179,6 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
public List<OrderExcelDTO> orderExcel(OrderServiceWebInDTO dto) {
|
|
|
Integer operatorId = TokenContext.cureOperatorId();
|
|
|
QueryWrapper queryWrapper = orderServiceQuery(dto, "o.");
|
|
|
- queryWrapper.eq("od.operator_id",operatorId);
|
|
|
int count;
|
|
|
if (null != dto.getProductIds()) {
|
|
|
queryWrapper.eq("od.product_id", dto.getProductIds());
|
|
|
@@ -192,29 +191,23 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
int maxPage = (int) Math.ceil(count/10000.0);
|
|
|
List<OrderExcelDTO> list = Lists.newArrayList();
|
|
|
ForkJoinPool pool = new ForkJoinPool();
|
|
|
- OrderExcelTask task = new OrderExcelTask(1,maxPage, queryWrapper, operatorId, dbName,baseMapper);
|
|
|
- Future<List<OrderExcelDTO>> future = pool.submit(task);
|
|
|
try {
|
|
|
- do {
|
|
|
- try {
|
|
|
- pool.awaitTermination(1, TimeUnit.SECONDS);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- } while (!future.isDone());
|
|
|
- pool.shutdown();
|
|
|
- list = future.get();
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
- } catch (ExecutionException e) {
|
|
|
- e.printStackTrace();
|
|
|
+ OrderExcelTask task = new OrderExcelTask(1,maxPage, queryWrapper, operatorId, dbName,baseMapper);
|
|
|
+ Future<List<OrderExcelDTO>> future = pool.submit(task);
|
|
|
+ do {
|
|
|
+ pool.awaitTermination(1, TimeUnit.SECONDS);
|
|
|
+ } while (!future.isDone());
|
|
|
+ pool.shutdown();
|
|
|
+ list = future.get();
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new BuilderException("工单导出失败,请重新操作");
|
|
|
}
|
|
|
+
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
private QueryWrapper orderServiceQuery(OrderServiceWebInDTO orderServiceWebInDTO, String prefix) {
|
|
|
QueryWrapper<Order> orderQueryWrapper = new QueryWrapper<>();
|
|
|
- orderQueryWrapper.eq(prefix+"operator_id",TokenContext.cureOperatorId());
|
|
|
if (StringUtils.isNotBlank(orderServiceWebInDTO.getSearchValueCustomerName())) {
|
|
|
orderQueryWrapper.eq(prefix + "customer_name", orderServiceWebInDTO.getSearchValueCustomerName());
|
|
|
}
|