refactor(bpm): 优化开支日报申请导出功能

- 修改导出文件名称为"开支日报申请.xls"
- 优化 BpmOAExpensesExportVO 结构,移除未使用的字段
-重构 BpmOAExpensesServiceImpl 中的导出逻辑,提高代码可读性和性能
This commit is contained in:
aikai 2025-07-11 15:45:59 +08:00
parent f9efa7aea0
commit 1ebd9cea07
3 changed files with 13 additions and 26 deletions

View File

@ -115,7 +115,7 @@ public class BpmOAExpensesController {
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产开支申请 Excel")
@Operation(summary = "导出开支日报申请 Excel")
@DataPermission(enable = false)
@OperateLog(type = EXPORT)
public void exportExpensesExcel(@Valid BpmOAExpensesPageReqVO pageReqVO,
@ -125,7 +125,7 @@ public class BpmOAExpensesController {
//转换
List<BpmOAExpensesExportVO> list = expensesService.convertExpensesList(pageResult.getList());
// 导出 Excel
ExcelUtils.write(response, "生产开支申请.xls", "数据", BpmOAExpensesExportVO.class, list);
ExcelUtils.write(response, "开支日报申请.xls", "数据", BpmOAExpensesExportVO.class, list);
}
}

View File

@ -24,16 +24,10 @@ public class BpmOAExpensesExportVO {
@ExcelProperty("申请用户")
private String userName;
// @ExcelProperty("费用类型")
private Integer type;
// @ExcelProperty("费用板块")
private Integer costSection;
@ExcelProperty("费用类型 bpm_oa_expenses_type")
@ExcelProperty("费用类型")
private String typeName;
@ExcelProperty("费用板块 费用板块 | 1叉车 2打包 3搬运 4运输")
@ExcelProperty("费用板块")
private String costSectionName;
@ExcelProperty("费用产生部门")
@ -57,13 +51,7 @@ public class BpmOAExpensesExportVO {
@ExcelProperty("银行卡号")
private String bankNo;
// @ExcelProperty("审批时间")
private String endTime;
// @ExcelProperty("支付状态")
private Integer status;
@ExcelProperty("支付状态 | 0未支付 1已支付")
@ExcelProperty("支付状态")
private String statusName;

View File

@ -43,10 +43,7 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -340,12 +337,14 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
costSectionMap.put(4, "运输");
List<DictDataRespDTO> bpmOaExpensesType = dictDataApi.getDictDataList("bpm_oa_expenses_type").getCheckedData();
Map<String, String> typeMap = bpmOaExpensesType.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
List<BpmOAExpensesExportVO> vos = BeanUtil.copyToList(list, BpmOAExpensesExportVO.class);
for (BpmOAExpensesExportVO vo : vos) {
vo.setTypeName(typeMap.get(String.valueOf(vo.getType())));
vo.setStatusName(vo.getStatus() == 0 ? "未支付" : "已支付");
List<BpmOAExpensesExportVO> vos = new ArrayList<>();
for (BpmOAExpensesPageRespVO bpmOAExpensesPageRespVO : list) {
BpmOAExpensesExportVO vo = BeanUtil.copyProperties(bpmOAExpensesPageRespVO, BpmOAExpensesExportVO.class);
vo.setTypeName(typeMap.get(String.valueOf(bpmOAExpensesPageRespVO.getType())));
vo.setStatusName(bpmOAExpensesPageRespVO.getStatus() == 0 ? "未支付" : "已支付");
// 费用板块 费用板块 | 1叉车 2打包 3搬运 4运输
vo.setCostSectionName(costSectionMap.get(vo.getCostSection()));
vo.setCostSectionName(costSectionMap.get(bpmOAExpensesPageRespVO.getCostSection()));
vos.add(vo);
}
return vos;
}