|
@@ -24,9 +24,11 @@ import com.poteviohealth.cgp.common.service.impl.BaseServiceImpl;
|
|
|
import com.poteviohealth.cgp.statistics.mapper.OrderMapper;
|
|
import com.poteviohealth.cgp.statistics.mapper.OrderMapper;
|
|
|
import com.poteviohealth.cgp.statistics.model.Order;
|
|
import com.poteviohealth.cgp.statistics.model.Order;
|
|
|
import com.poteviohealth.cgp.statistics.model.indto.DishesOrderWebInDTO;
|
|
import com.poteviohealth.cgp.statistics.model.indto.DishesOrderWebInDTO;
|
|
|
|
|
+import com.poteviohealth.cgp.statistics.model.indto.OrderCostWebInDTO;
|
|
|
import com.poteviohealth.cgp.statistics.model.indto.OrderServiceWebInDTO;
|
|
import com.poteviohealth.cgp.statistics.model.indto.OrderServiceWebInDTO;
|
|
|
import com.poteviohealth.cgp.statistics.model.outdto.*;
|
|
import com.poteviohealth.cgp.statistics.model.outdto.*;
|
|
|
import com.poteviohealth.cgp.statistics.service.IOrderService;
|
|
import com.poteviohealth.cgp.statistics.service.IOrderService;
|
|
|
|
|
+import com.poteviohealth.cgp.statistics.utils.CostOrderExcelTask;
|
|
|
import com.poteviohealth.cgp.statistics.utils.DishesOrderExcelTask;
|
|
import com.poteviohealth.cgp.statistics.utils.DishesOrderExcelTask;
|
|
|
import com.poteviohealth.cgp.statistics.utils.OrderExcelTask;
|
|
import com.poteviohealth.cgp.statistics.utils.OrderExcelTask;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
import lombok.extern.log4j.Log4j2;
|
|
@@ -232,6 +234,71 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
return list;
|
|
return list;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<OrderCostWebOutDTO> OrderCostList(OrderCostWebInDTO orderCostWebInDTO) {
|
|
|
|
|
+ Integer operatorId = TokenContext.cureOperatorId();
|
|
|
|
|
+ QueryWrapper queryWrapper = webCostQuery(orderCostWebInDTO);
|
|
|
|
|
+ int count = baseMapper.costOrderPageListAllSize(queryWrapper,dbName,operatorId);
|
|
|
|
|
+ //每页1000条,计算总页数
|
|
|
|
|
+ int maxPage = (int) Math.ceil(count/10000.0);
|
|
|
|
|
+ List<OrderCostWebOutDTO> list = Lists.newArrayList();
|
|
|
|
|
+ ForkJoinPool pool = new ForkJoinPool();
|
|
|
|
|
+ try {
|
|
|
|
|
+ CostOrderExcelTask task = new CostOrderExcelTask(1,maxPage, queryWrapper, operatorId, dbName,baseMapper);
|
|
|
|
|
+ Future<List<OrderCostWebOutDTO>> future = pool.submit(task);
|
|
|
|
|
+ do {
|
|
|
|
|
+ pool.awaitTermination(1, TimeUnit.SECONDS);
|
|
|
|
|
+ } while (!future.isDone());
|
|
|
|
|
+ pool.shutdown();
|
|
|
|
|
+ list = future.get();
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ throw new BuilderException("成本核算导出失败,请重新操作");
|
|
|
|
|
+ }
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private QueryWrapper webCostQuery(OrderCostWebInDTO orderWebInDTO) {
|
|
|
|
|
+ QueryWrapper<Order> orderQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ String searchTime = "o.order_time";
|
|
|
|
|
+ if(StringUtils.isNotBlank(orderWebInDTO.getSearchDateStr())){
|
|
|
|
|
+ searchTime = orderWebInDTO.getSearchDateStr();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (orderWebInDTO.getStartDate() != null) {
|
|
|
|
|
+ orderQueryWrapper.ge("o."+searchTime, orderWebInDTO.getStartDate());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (orderWebInDTO.getEndDate() != null) {
|
|
|
|
|
+ orderQueryWrapper.le( "o."+searchTime, orderWebInDTO.getEndDate());
|
|
|
|
|
+ }
|
|
|
|
|
+ orderQueryWrapper.in( !orderWebInDTO.getSupplierIds().isEmpty(),"o.supplier_id", orderWebInDTO.getSupplierIds());
|
|
|
|
|
+ if(orderWebInDTO.getStationIds() != null && !orderWebInDTO.getStationIds().isEmpty()){
|
|
|
|
|
+ orderQueryWrapper.in( "o.station_id", orderWebInDTO.getStationIds());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(orderWebInDTO.getServiceStationIds() != null && !orderWebInDTO.getServiceStationIds().isEmpty()){
|
|
|
|
|
+ orderQueryWrapper.in( "o.service_station_id", orderWebInDTO.getServiceStationIds());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(orderWebInDTO.getEmployeeId() != null){
|
|
|
|
|
+ orderQueryWrapper.eq( "o.employee_id", orderWebInDTO.getEmployeeId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.isNotBlank(orderWebInDTO.getCode())){
|
|
|
|
|
+ orderQueryWrapper.eq( "so.n", orderWebInDTO.getCode());
|
|
|
|
|
+ }
|
|
|
|
|
+ orderQueryWrapper.eq( "o.status", 1);
|
|
|
|
|
+ if(orderWebInDTO.getRevenueStatus() != null){
|
|
|
|
|
+ orderQueryWrapper.eq( "o.revenue_status",orderWebInDTO.getRevenueStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(orderWebInDTO.getCostStatus() != null){
|
|
|
|
|
+ orderQueryWrapper.eq( "o.cost_status",orderWebInDTO.getCostStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ orderQueryWrapper.orderByDesc("o.order_cost_id");
|
|
|
|
|
+
|
|
|
|
|
+ return orderQueryWrapper;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
private QueryWrapper webQuery(DishesOrderWebInDTO orderWebInDTO) {
|
|
private QueryWrapper webQuery(DishesOrderWebInDTO orderWebInDTO) {
|
|
|
QueryWrapper<Order> orderQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<Order> orderQueryWrapper = new QueryWrapper<>();
|
|
|
if (StringUtils.isNotBlank(orderWebInDTO.getSn())) {
|
|
if (StringUtils.isNotBlank(orderWebInDTO.getSn())) {
|