package com.ruoyi.web.controller.project;
|
|
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.project.domain.SpStatExpense;
|
import com.ruoyi.project.domain.SpStatExpenseReq;
|
import com.ruoyi.project.service.SpstatExpenseService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.math.BigDecimal;
|
import java.util.List;
|
|
/**
|
* 报销统计
|
*
|
* @author ruoyi
|
* @date 2022-01-24
|
*/
|
@Slf4j
|
@Api("报销统计")
|
@RestController
|
@RequestMapping("/project/spstatexpense")
|
public class SpStatExpenseController extends BaseController {
|
|
@Autowired
|
SpstatExpenseService spstatExpenseService;
|
|
/**
|
* 查询费用统计
|
*/
|
@ApiOperation("查询报销统计")
|
@PostMapping("/spStatExpenselist")
|
public TableDataInfo spStatExpenselist(@RequestBody SpStatExpenseReq spStatExpenseReq) {
|
startPage();
|
return getDataTable(spstatExpenseService.getListBySpstatExpense(spStatExpenseReq));
|
}
|
|
/**
|
* 导出费用统计
|
*/
|
@ApiOperation("导出费用统计")
|
@Log(title = "费用统计", businessType = BusinessType.EXPORT)
|
@GetMapping("/export")
|
public AjaxResult export(SpStatExpenseReq spStatExpenseReq) {
|
List<SpStatExpense> list = spstatExpenseService.getListBySpstatExpense(spStatExpenseReq);
|
// 金额保留 2 位小数;0.00 不显示(置空)
|
for (SpStatExpense row : list) {
|
row.setAmount(blankZero(row.getAmount()));
|
row.setExpertfee(blankZero(row.getExpertfee()));
|
row.setEthicalistfee(blankZero(row.getEthicalistfee()));
|
row.setMedicalcost(blankZero(row.getMedicalcost()));
|
row.setOfficecost(blankZero(row.getOfficecost()));
|
row.setReimcost(blankZero(row.getReimcost()));
|
}
|
ExcelUtil<SpStatExpense> util = new ExcelUtil<SpStatExpense>(SpStatExpense.class);
|
return util.exportExcel(list, "费用统计数据");
|
}
|
|
private BigDecimal blankZero(BigDecimal value) {
|
return (value == null || value.compareTo(BigDecimal.ZERO) == 0) ? null : value;
|
}
|
|
}
|