zhaowenxuan
2025-03-04 fc20d2dbefb52ad199c927e36f22a7c8bfa1a729
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package com.ltkj.web.controller.system;
 
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
 
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson2.schema.ValidateResult;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.hosp.domain.TjCustomer;
import com.ltkj.hosp.domain.TjOrder;
import com.ltkj.hosp.service.ITjCustomerService;
import com.ltkj.hosp.service.ITjOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import com.ltkj.common.annotation.Log;
import com.ltkj.common.core.controller.BaseController;
import com.ltkj.common.core.domain.AjaxResult;
import com.ltkj.common.enums.BusinessType;
import com.ltkj.hosp.domain.TjReportPrint;
import com.ltkj.hosp.service.ITjReportPrintService;
import com.ltkj.common.utils.poi.ExcelUtil;
import com.ltkj.common.core.page.TableDataInfo;
 
/**
 * 打印记录Controller
 *
 * @author ltkj_赵佳豪&李格
 * @date 2023-04-06
 */
@RestController
@RequestMapping("/hosp/print")
@Api(tags = "打印记录")
public class TjReportPrintController extends BaseController {
    @Autowired
    private ITjReportPrintService tjReportPrintService;
    @Resource
    private ITjCustomerService customerService;
    @Autowired
    private ITjOrderService orderService;
 
    /**
     * 查询打印记录列表
     */
//@PreAuthorize("@ss.hasPermi('hosp:print:list')")
    @GetMapping("/list")
    public TableDataInfo list(TjReportPrint tjReportPrint) {
        startPage();
        List<TjReportPrint> list = tjReportPrintService.selectTjReportPrintList(tjReportPrint);
        for (TjReportPrint print : list) {
            TjOrder tjOrder = orderService.getOrderByTjNum(print.getTjNumber());
            if(null !=tjOrder){
                TjCustomer customer = customerService.getById(tjOrder.getUserId());
                if(null !=customer){
                    print.setCusName(customer.getCusName());
                }
            }
        }
 
        return getDataTable(list);
    }
 
    /**
     * 导出打印记录列表
     */
    //@PreAuthorize("@ss.hasPermi('hosp:print:export')")
    @Log(title = "打印记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TjReportPrint tjReportPrint) {
        List<TjReportPrint> list = tjReportPrintService.selectTjReportPrintList(tjReportPrint);
        ExcelUtil<TjReportPrint> util = new ExcelUtil<TjReportPrint>(TjReportPrint.class);
        util.exportExcel(response, list, "打印记录数据");
    }
 
    /**
     * 获取打印记录详细信息
     */
    //@PreAuthorize("@ss.hasPermi('hosp:print:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(tjReportPrintService.selectTjReportPrintById(id));
    }
 
    /**
     * 新增打印记录
     */
    //@PreAuthorize("@ss.hasPermi('hosp:print:add')")
//    @Log(title = "打印记录", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody TjReportPrint tjReportPrint) {
//        return toAjax(tjReportPrintService.insertTjReportPrint(tjReportPrint));
//    }
 
    /**
     * 批量新增打印记录
     */
    @PostMapping
    @ApiOperation(value = "批量新增打印记录")
    @Transactional
    public AjaxResult addTjNums(@RequestBody TjReportPrint[] tjReportPrints) {
        for (TjReportPrint tjReportPrint : tjReportPrints) {
 
            if (tjReportPrintService.insertTjReportPrint(tjReportPrint) == 1) {
                return AjaxResult.success();
            }
        }
        return AjaxResult.success();
    }
 
//    /**
//     * 修改打印记录
//     */
//    //@PreAuthorize("@ss.hasPermi('hosp:print:edit')")
//    @Log(title = "打印记录", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody TjReportPrint tjReportPrint) {
//        return toAjax(tjReportPrintService.updateTjReportPrint(tjReportPrint));
//    }
//
//    /**
//     * 删除打印记录
//     */
//
//    //@PreAuthorize("@ss.hasPermi('hosp:print:remove')")
//    @Log(title = "打印记录", businessType = BusinessType.DELETE)
//    @DeleteMapping("/{ids}")
//    public AjaxResult remove(@PathVariable Long[] ids) {
//        return toAjax(tjReportPrintService.deleteTjReportPrintByIds(ids));
//    }
}