提交 af4f8ebb authored 作者: 杨启发's avatar 杨启发

导出履约进度

上级 5b71e935
...@@ -16,9 +16,13 @@ import io.swagger.annotations.Api; ...@@ -16,9 +16,13 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
...@@ -79,5 +83,12 @@ public class CarrierPerformanceProgressController { ...@@ -79,5 +83,12 @@ public class CarrierPerformanceProgressController {
return Result.ok(list); return Result.ok(list);
} }
@ApiOperation(value = "导出履约进度",notes = "<br>By:杨启发")
@PostMapping("/exportPerformanceProgress")
public void exportPerformanceProgress(@RequestBody PagePerformanceProgress param, HttpServletResponse response) throws Exception {
try (SXSSFWorkbook workbook = performanceProgressService.exportPerformanceProgress(param)) {
response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE);
workbook.write(response.getOutputStream());
}
}
} }
...@@ -5,11 +5,13 @@ import com.clx.open.sdk.callback.message.OrderInfoMessage; ...@@ -5,11 +5,13 @@ import com.clx.open.sdk.callback.message.OrderInfoMessage;
import com.clx.performance.model.OrderChild; import com.clx.performance.model.OrderChild;
import com.clx.performance.model.OrderGoods; import com.clx.performance.model.OrderGoods;
import com.clx.performance.model.PerformanceProgress; import com.clx.performance.model.PerformanceProgress;
import com.clx.performance.param.pc.PageCarrierOrderChildParam;
import com.clx.performance.param.pc.carrier.PagePerformanceProgress; import com.clx.performance.param.pc.carrier.PagePerformanceProgress;
import com.clx.performance.param.pc.carrier.UpdatePerformanceProgressParam; import com.clx.performance.param.pc.carrier.UpdatePerformanceProgressParam;
import com.clx.performance.vo.pc.PerformanceProgressDetailVO; import com.clx.performance.vo.pc.PerformanceProgressDetailVO;
import com.clx.performance.vo.pc.PerformanceProgressOperationLogVO; import com.clx.performance.vo.pc.PerformanceProgressOperationLogVO;
import com.clx.performance.vo.pc.PerformanceProgressVO; import com.clx.performance.vo.pc.PerformanceProgressVO;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import java.util.List; import java.util.List;
...@@ -39,4 +41,6 @@ public interface PerformanceProgressService { ...@@ -39,4 +41,6 @@ public interface PerformanceProgressService {
void dealPerformanceProgress4OrderGoods(OrderGoods data); void dealPerformanceProgress4OrderGoods(OrderGoods data);
void dealPerformanceProgress4OrderChild(OrderChild data); void dealPerformanceProgress4OrderChild(OrderChild data);
SXSSFWorkbook exportPerformanceProgress(PagePerformanceProgress param);
} }
...@@ -29,13 +29,19 @@ import com.clx.performance.model.OrderChild; ...@@ -29,13 +29,19 @@ import com.clx.performance.model.OrderChild;
import com.clx.performance.model.OrderGoods; import com.clx.performance.model.OrderGoods;
import com.clx.performance.model.PerformanceProgress; import com.clx.performance.model.PerformanceProgress;
import com.clx.performance.model.PerformanceProgressLog; import com.clx.performance.model.PerformanceProgressLog;
import com.clx.performance.param.pc.PageCarrierOrderChildParam;
import com.clx.performance.param.pc.carrier.PagePerformanceProgress; import com.clx.performance.param.pc.carrier.PagePerformanceProgress;
import com.clx.performance.param.pc.carrier.UpdatePerformanceProgressParam; import com.clx.performance.param.pc.carrier.UpdatePerformanceProgressParam;
import com.clx.performance.service.PerformanceProgressLogService; import com.clx.performance.service.PerformanceProgressLogService;
import com.clx.performance.service.PerformanceProgressService; import com.clx.performance.service.PerformanceProgressService;
import com.clx.performance.struct.PerformanceProgressLogStruct; import com.clx.performance.struct.PerformanceProgressLogStruct;
import com.clx.performance.struct.PerformanceProgressStruct; import com.clx.performance.struct.PerformanceProgressStruct;
import com.clx.performance.utils.excel.ExcelData;
import com.clx.performance.utils.excel.ExcelField;
import com.clx.performance.utils.excel.ExcelSheet;
import com.clx.performance.utils.excel.ExcelUtil;
import com.clx.performance.utils.gd.GdService; import com.clx.performance.utils.gd.GdService;
import com.clx.performance.vo.pc.PageCarrierOrderChildVO;
import com.clx.performance.vo.pc.PerformanceProgressDetailVO; import com.clx.performance.vo.pc.PerformanceProgressDetailVO;
import com.clx.performance.vo.pc.PerformanceProgressOperationLogVO; import com.clx.performance.vo.pc.PerformanceProgressOperationLogVO;
import com.clx.performance.vo.pc.PerformanceProgressVO; import com.clx.performance.vo.pc.PerformanceProgressVO;
...@@ -49,6 +55,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -49,6 +55,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -531,6 +538,84 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi ...@@ -531,6 +538,84 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi
return performanceProgressStruct.convertList(performanceProgressDao.listInField(PerformanceProgress::getOrderNo, orderNoList)); return performanceProgressStruct.convertList(performanceProgressDao.listInField(PerformanceProgress::getOrderNo, orderNoList));
} }
@Override
public SXSSFWorkbook exportPerformanceProgress(PagePerformanceProgress param) {
param.setPage(1);
param.setPageSize(1000000);
IPage<PerformanceProgressVO> page = pagePerformanceProgress(param);
List<PerformanceProgressVO> list = page.getRecords();
// 组装表头
List<ExcelField> fieldList = new ArrayList<>();
fieldList.add(new ExcelField(0, "序号", "index", 2000));
fieldList.add(new ExcelField(1, "货源地", "sendAddressShorter", 5000));
fieldList.add(new ExcelField(2, "标准地址", "sendSystemAddressShorter", 5000));
fieldList.add(new ExcelField(3, "物流经理", "seniorLogisticsManagerName", 5000));
fieldList.add(new ExcelField(4, "货物类型", "goodsTypeName", 5000));
fieldList.add(new ExcelField(5, "货物名称", "goodsName", 5000));
fieldList.add(new ExcelField(6, "煤源位置", "sendAddress", 5000));
fieldList.add(new ExcelField(7, "是否C类煤源", "sendOverStandardMsg", 5000));
fieldList.add(new ExcelField(8, "司机运费(元/吨)", "driverFreightPrice", 5000));
fieldList.add(new ExcelField(9, "任务吨数(吨)", "taskWeight", 5000));
fieldList.add(new ExcelField(10, "挂单吨数(吨)", "pendingWeight", 5000));
fieldList.add(new ExcelField(11, "接单车数", "orderedTruckNum", 5000));
fieldList.add(new ExcelField(12, "到达货源地车数", "arriveSendTruckNum", 5000));
fieldList.add(new ExcelField(13, "装车车数", "loadTruckNum", 5000));
fieldList.add(new ExcelField(14, "卸车车数", "unloadTruckNum", 5000));
fieldList.add(new ExcelField(15, "在途车数", "onTheWayTruckNum", 5000));
fieldList.add(new ExcelField(16, "接单率(%)", "orderedRate", 5000));
fieldList.add(new ExcelField(17, "任务完成率(%)", "taskCompleteRatio", 5000));
fieldList.add(new ExcelField(18, "矿发量(吨)", "sumLoadWeight", 10000));
fieldList.add(new ExcelField(19, "到站量(吨)", "sumUnloadWeight", 10000));
fieldList.add(new ExcelField(20, "在途量(吨)", "sumOnTheWayWeight", 10000));
fieldList.add(new ExcelField(21, "今日预计完成(吨)", "todayExpectComplete", 10000));
// 组装数据
List<List<ExcelData>> dataList = new ArrayList<>();
for (int i=0; i<list.size(); i++){
PerformanceProgressVO vo = list.get(i);
List<ExcelData> rowData = new ArrayList<>();
rowData.add(new ExcelData(i+1));
rowData.add(new ExcelData(vo.getSendAddressShorter()));
rowData.add(new ExcelData(vo.getSendSystemAddressShorter()));
rowData.add(new ExcelData(vo.getSeniorLogisticsManagerName()));
rowData.add(new ExcelData(vo.getGoodsTypeName()));
rowData.add(new ExcelData(vo.getGoodsName()));
rowData.add(new ExcelData(vo.getSendAddress()));
rowData.add(new ExcelData(vo.getSendOverStandardMsg()));
rowData.add(new ExcelData(vo.getDriverFreightPrice()==null?null:vo.getDriverFreightPrice().movePointLeft(2)));
rowData.add(new ExcelData(vo.getTaskWeight()));
rowData.add(new ExcelData(vo.getPendingWeight()));
rowData.add(new ExcelData(vo.getOrderedTruckNum()));
rowData.add(new ExcelData(vo.getArriveSendTruckNum()));
rowData.add(new ExcelData(vo.getLoadTruckNum()));
rowData.add(new ExcelData(vo.getUnloadTruckNum()));
rowData.add(new ExcelData(vo.getOnTheWayTruckNum()));
rowData.add(new ExcelData(vo.getOrderedRate()));
rowData.add(new ExcelData(vo.getTaskCompleteRatio()));
rowData.add(new ExcelData(vo.getSumLoadWeight()));
rowData.add(new ExcelData(vo.getSumUnloadWeight()));
rowData.add(new ExcelData(vo.getSumOnTheWayWeight()));
rowData.add(new ExcelData(vo.getTodayExpectComplete()));
dataList.add(rowData);
}
ExcelSheet excelSheet = new ExcelSheet("履约进度", "履约进度", fieldList, dataList);
//创建excel
return ExcelUtil.create(excelSheet);
}
// 计算接单率 // 计算接单率
public BigDecimal calcOrderedRate(BigDecimal orderedWeight,BigDecimal pendingWeight){ public BigDecimal calcOrderedRate(BigDecimal orderedWeight,BigDecimal pendingWeight){
//接单率 = 接单吨数 / 挂单吨数 //接单率 = 接单吨数 / 挂单吨数
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论