yxh
5 天以前 b1f41c066b0b7c38faffddbfe73b9be8d0bd508e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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.CasePanorama;
import com.ruoyi.project.domain.CasePanoramaReq;
import com.ruoyi.project.service.ICasePanoramaService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.math.BigDecimal;
import java.util.List;
 
/**
 * 案例全景
 *
 * @author ruoyi
 * @date 2026-10-28
 */
@Slf4j
@Api("案例全景")
@RestController
@RequestMapping("/project/casePanorama")
public class CasePanoramaController extends BaseController {
 
    @Autowired
    private ICasePanoramaService casePanoramaService;
 
    /**
     * 查询案例全景
     */
    @ApiOperation("查询案例全景")
    @GetMapping("/list")
    public TableDataInfo list(CasePanoramaReq req) {
        startPage();
        return getDataTable(casePanoramaService.selectCasePanoramaList(req));
    }
 
    /**
     * 导出案例全景
     */
    @ApiOperation("导出案例全景")
    @Log(title = "案例全景", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(CasePanoramaReq req) {
        List<CasePanorama> list = casePanoramaService.selectCasePanoramaList(req);
        for (CasePanorama row : list) {
            blankZero(row);
        }
        ExcelUtil<CasePanorama> util = new ExcelUtil<CasePanorama>(CasePanorama.class);
        return util.exportExcel(list, "案例全景数据");
    }
 
    /**
     * 业务组下拉选项
     */
    @ApiOperation("业务组下拉选项")
    @GetMapping("/deptOptions")
    public AjaxResult deptOptions() {
        return AjaxResult.success(casePanoramaService.selectDeptNames());
    }
 
    /**
     * 金额 0 导出为空
     */
    private void blankZero(CasePanorama row) {
        row.setTotalCost(blankZero(row.getTotalCost()));
        row.setDonorFamilyCost(blankZero(row.getDonorFamilyCost()));
        row.setMedCost(blankZero(row.getMedCost()));
        row.setExpertCost(blankZero(row.getExpertCost()));
        row.setItemCode34(blankZero(row.getItemCode34()));
        row.setItemCode42(blankZero(row.getItemCode42()));
        row.setItemCode46(blankZero(row.getItemCode46()));
        row.setItemCode50(blankZero(row.getItemCode50()));
        row.setItemCode44(blankZero(row.getItemCode44()));
        row.setItemCode47(blankZero(row.getItemCode47()));
        row.setItemCode48(blankZero(row.getItemCode48()));
        row.setItemCode21(blankZero(row.getItemCode21()));
        row.setItemCode12(blankZero(row.getItemCode12()));
        row.setItemCode17(blankZero(row.getItemCode17()));
        row.setItemCode23(blankZero(row.getItemCode23()));
        row.setItemCode25(blankZero(row.getItemCode25()));
    }
 
    private BigDecimal blankZero(BigDecimal value) {
        return (value == null || value.compareTo(BigDecimal.ZERO) == 0) ? null : value;
    }
}