diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/controller/IwsCostPushController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/controller/IwsCostPushController.java index 27b7e87c..0ec6a8bd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/controller/IwsCostPushController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/push/controller/IwsCostPushController.java @@ -8,6 +8,8 @@ import com.bonus.common.core.web.page.TableDataInfo; import com.bonus.material.push.domain.IwsCostPushBean; import com.bonus.material.push.domain.vo.IwsCostPushExportVo; import com.bonus.material.push.service.IwsCostPushService; +import com.bonus.material.settlement.domain.SltAgreementInfo; +import com.bonus.material.settlement.service.impl.SltAgreementInfoServiceImpl; import io.swagger.annotations.ApiOperation; import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.BeanUtils; @@ -36,6 +38,9 @@ public class IwsCostPushController extends BaseController { @Resource private IwsCostPushService iwsCostPushService; + @Resource + private SltAgreementInfoServiceImpl sltAgreementInfoService; + /** * 查询协议推送匹配列表 @@ -79,39 +84,116 @@ public class IwsCostPushController extends BaseController { @ApiOperation("导出费用推送审核列表--后端处理") public void exportCostPushList(HttpServletResponse response, IwsCostPushBean obj) { try { + // 获取费用推送审核列表 List list = iwsCostPushService.getCostPushCheckList(obj); + + // 将数据转换为导出对象列表 + String month = Optional.ofNullable(obj).map(IwsCostPushBean::getMonth).orElse(""); List exportVoList = list.stream() .map(bean -> { IwsCostPushExportVo vo = new IwsCostPushExportVo(); BeanUtils.copyProperties(bean, vo); - vo.setMonth(Optional.ofNullable(obj).map(IwsCostPushBean::getMonth).orElse("")); + vo.setMonth(month); // 直接使用提取的月份 return vo; }) .collect(Collectors.toList()); - ExcelUtil util = new ExcelUtil<>(IwsCostPushExportVo.class); - util.exportExcel(response, exportVoList, "协议推送匹配"); + // 导出Excel + new ExcelUtil<>(IwsCostPushExportVo.class).exportExcel(response, exportVoList, "费用推送审核表"); } catch (Exception e) { + // 记录异常并抛出自定义异常 System.err.println("导出异常 = " + e.getMessage()); throw new ServiceException("导出异常,请联系运维人员查询日志"); } } + /** * 根据协议ID及月份查询当月租赁费用明细 * @param obj 查询条件 * @return 分页数据 */ @GetMapping("/getLeaseCostsByAgreementIdAndMonth") - @ApiOperation("根据协议ID及月份查询当月租赁费用明细--分页") + @ApiOperation("根据协议ID及月份查询当月租赁费用明细--不分页") public TableDataInfo getLeaseCostsByAgreementIdAndMonth(IwsCostPushBean obj) { if (Objects.isNull(obj) || Objects.isNull(obj.getAgreementId()) || Objects.isNull(obj.getMonth())) { System.err.println("查询信息为空 = " + obj); return getDataTable(Collections.emptyList()); } //startPage(); 取消分页 - List list = iwsCostPushService.getLeaseCostsByAgreementIdAndMonth(obj); - return getDataTable(list); + try { + List list = iwsCostPushService.getLeaseCostsByAgreementIdAndMonth(obj); + return getDataTable(list); + } catch (Exception e) { + System.err.println("数据查询异常 = " + e.getMessage()); + throw new ServiceException("数据查询异常,请联系运维人员查询日志处理"); + } + } + + /** + * 根据协议ID查询结算的维修费用明细 + * @param obj 查询条件 + */ + @GetMapping("/getRepairCostsByAgreementId") + @ApiOperation("根据协议ID查询维修费用结算明细--不分页") + public TableDataInfo getRepairCostsByAgreementId(IwsCostPushBean obj) { + if (Objects.isNull(obj) || Objects.isNull(obj.getAgreementId())) { + System.err.println("查询信息为空 = " + obj); + return getDataTable(Collections.emptyList()); + } + try { + SltAgreementInfo sltAgreementInfo = new SltAgreementInfo(); + sltAgreementInfo.setAgreementId(Long.valueOf(obj.getAgreementId())); + List repairList = sltAgreementInfoService.getRepairList(sltAgreementInfo); + return getDataTable(repairList); + } catch (NumberFormatException e) { + System.err.println("数据错误 = " + e.getMessage()); + throw new ServiceException("数据查询异常,请联系运维人员查询日志处理"); + } + } + + /** + * 根据协议ID查询结算的丢失费用明细 + * @param obj 查询条件 + */ + @GetMapping("/getLoseCostsByAgreementId") + @ApiOperation("根据协议ID查询丢失费用结算明细--不分页") + public TableDataInfo getLoseCostsByAgreementId(IwsCostPushBean obj) { + if (Objects.isNull(obj) || Objects.isNull(obj.getAgreementId())) { + System.err.println("查询信息为空 = " + obj); + return getDataTable(Collections.emptyList()); + } + SltAgreementInfo sltAgreementInfo = new SltAgreementInfo(); + try { + sltAgreementInfo.setAgreementId(Long.valueOf(obj.getAgreementId())); + List loseList = sltAgreementInfoService.getLoseList(sltAgreementInfo); + return getDataTable(loseList); + } catch (NumberFormatException e) { + System.err.println("数据错误 = " + e.getMessage()); + throw new RuntimeException("数据查询异常,请联系运维人员查询日志处理"); + } + } + + /** + * 根据协议ID查询结算的报废费用明细 + * @param obj 查询条件 + */ + @GetMapping("/getScrapCostsByAgreementId") + @ApiOperation("根据协议ID查询报废费用结算明细--不分页") + public TableDataInfo getScrapCostsByAgreementId(IwsCostPushBean obj) { + if (Objects.isNull(obj) || Objects.isNull(obj.getAgreementId())) { + System.err.println("查询信息为空 = " + obj); + return getDataTable(Collections.emptyList()); + } + SltAgreementInfo sltAgreementInfo = new SltAgreementInfo(); + try { + sltAgreementInfo.setAgreementId(Long.valueOf(obj.getAgreementId())); + List scrapList = sltAgreementInfoService.getScrapList(sltAgreementInfo); + return getDataTable(scrapList); + } catch (NumberFormatException e) { + System.err.println("数据错误 = " + e.getMessage()); + throw new ServiceException("数据查询异常,请联系运维人员查询日志处理"); + } } @PostMapping("/computeTheMonthCost")