|
|
@@ -23,9 +23,11 @@ import com.poteviohealth.cgp.common.integrated.partner.model.EmployeeStationJson
|
|
|
import com.poteviohealth.cgp.common.service.impl.BaseServiceImpl;
|
|
|
import com.poteviohealth.cgp.statistics.mapper.OrderMapper;
|
|
|
import com.poteviohealth.cgp.statistics.model.Order;
|
|
|
+import com.poteviohealth.cgp.statistics.model.indto.DishesOrderWebInDTO;
|
|
|
import com.poteviohealth.cgp.statistics.model.indto.OrderServiceWebInDTO;
|
|
|
import com.poteviohealth.cgp.statistics.model.outdto.*;
|
|
|
import com.poteviohealth.cgp.statistics.service.IOrderService;
|
|
|
+import com.poteviohealth.cgp.statistics.utils.DishesOrderExcelTask;
|
|
|
import com.poteviohealth.cgp.statistics.utils.OrderExcelTask;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
@@ -206,6 +208,60 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<DishesOrderWebOutDTO> orderDishes(DishesOrderWebInDTO dto) {
|
|
|
+ Integer operatorId = TokenContext.cureOperatorId();
|
|
|
+ QueryWrapper queryWrapper = webQuery(dto);
|
|
|
+ int count = baseMapper.dishesOrderPageListAllSize(queryWrapper,dbName,operatorId);
|
|
|
+ //每页1000条,计算总页数
|
|
|
+ int maxPage = (int) Math.ceil(count/10000.0);
|
|
|
+ List<DishesOrderWebOutDTO> list = Lists.newArrayList();
|
|
|
+ ForkJoinPool pool = new ForkJoinPool();
|
|
|
+ try {
|
|
|
+ DishesOrderExcelTask task = new DishesOrderExcelTask(1,maxPage, queryWrapper, operatorId, dbName,baseMapper);
|
|
|
+ Future<List<DishesOrderWebOutDTO>> 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 webQuery(DishesOrderWebInDTO orderWebInDTO) {
|
|
|
+ QueryWrapper<Order> orderQueryWrapper = new QueryWrapper<>();
|
|
|
+ if (StringUtils.isNotBlank(orderWebInDTO.getSn())) {
|
|
|
+ orderQueryWrapper.eq("sn", orderWebInDTO.getSn());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(orderWebInDTO.getCustomerName())) {
|
|
|
+ orderQueryWrapper.eq( "customer_name", orderWebInDTO.getCustomerName());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(orderWebInDTO.getCustomerPhone())) {
|
|
|
+ orderQueryWrapper.eq( "customer_phone", orderWebInDTO.getCustomerPhone());
|
|
|
+ }
|
|
|
+ if (orderWebInDTO.getPayStyle() != null) {
|
|
|
+ orderQueryWrapper.like("pay_account", orderWebInDTO.getPayStyle());
|
|
|
+ }
|
|
|
+ if (orderWebInDTO.getStartDate() != null) {
|
|
|
+ orderQueryWrapper.ge("order_time", orderWebInDTO.getStartDate());
|
|
|
+ }
|
|
|
+ if (orderWebInDTO.getEndDate() != null) {
|
|
|
+ orderQueryWrapper.le("order_time", orderWebInDTO.getEndDate());
|
|
|
+ }
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(orderWebInDTO.getSupplierIds())) {
|
|
|
+ orderQueryWrapper.in("supplier_id", orderWebInDTO.getSupplierIds());
|
|
|
+ }
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(orderWebInDTO.getStationIds())) {
|
|
|
+ orderQueryWrapper.in("service_station_id", orderWebInDTO.getStationIds());
|
|
|
+ }
|
|
|
+ orderQueryWrapper.eq("pay_status",3);
|
|
|
+ orderQueryWrapper.orderByDesc("order_id");
|
|
|
+ return orderQueryWrapper;
|
|
|
+ }
|
|
|
+
|
|
|
private QueryWrapper orderServiceQuery(OrderServiceWebInDTO orderServiceWebInDTO, String prefix) {
|
|
|
QueryWrapper<Order> orderQueryWrapper = new QueryWrapper<>();
|
|
|
if (StringUtils.isNotBlank(orderServiceWebInDTO.getSearchValueCustomerName())) {
|