lige
2024-05-21 f9501db5a27184c54ec25832f4dffc356e961bfe
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
package com.ltkj.web.controller.system;
 
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
 
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ltkj.common.utils.poi.ExcelUtil;
import com.ltkj.framework.config.MatchUtils;
import com.ltkj.hosp.domain.TjSendRecord;
import com.ltkj.hosp.service.ITjSendRecordService;
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.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.common.core.page.TableDataInfo;
import sun.util.resources.cldr.nyn.CalendarData_nyn_UG;
 
import java.util.*;
 
/**
 * 邮件短信发送记录Controller
 *
 * @author ltkj
 * @date 2023-03-15
 */
@RestController
@RequestMapping("/system/record")
@Api(tags = "邮件短信发送记录")
public class TjSendRecordController extends BaseController {
    @Resource
    private ITjSendRecordService tjSendRecordService;
 
    /**
     * 查询邮件短信发送记录列表
     */
    //@PreAuthorize("@ss.hasPermi('system:record:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询邮件短信发送记录列表")
    public AjaxResult list(@RequestParam(required = false) @ApiParam("体检号") String tjNum,
                           @RequestParam(required = false) @ApiParam("手机号") String number,
                           @RequestParam(required = false) @ApiParam("体检标题") String subject,
                           @RequestParam(required = false) @ApiParam("发送时间") Date sendTime,
                           @ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer pageNum,
                           @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize) {
        Page<TjSendRecord> page = new Page<>(pageNum, pageSize);
        LambdaQueryWrapper<TjSendRecord> wq = new LambdaQueryWrapper<>();
        if (null != tjNum) wq.likeLeft(TjSendRecord::getTjNumber,tjNum);
        if (null != number) wq.eq(TjSendRecord::getNumber,number);
        if (null != subject) wq.like(TjSendRecord::getSubject,subject);
        if (null != sendTime) wq.between(TjSendRecord::getSendTime, DateUtil.beginOfDay(sendTime), DateUtil.endOfDay(sendTime));
        wq.orderByDesc(TjSendRecord::getSendTime);
        Page<TjSendRecord> recordPage = tjSendRecordService.page(page,wq);
        if(null !=recordPage.getRecords() && recordPage.getRecords().size()>0){
            for (TjSendRecord record : recordPage.getRecords()) {
                if(null !=record){
                    if(null !=record.getNumber())
                    record.setNumber(MatchUtils.hidePhoneNum(record.getNumber()));
                }
            }
        }
        Map<String, Object> map = new HashMap<>();
        map.put("data", recordPage.getRecords());
        map.put("total", recordPage.getTotal());
        return AjaxResult.success(map);
    }
 
    /**
     * 导出邮件短信发送记录列表
     */
    //@PreAuthorize("@ss.hasPermi('system:record:export')")
    @Log(title = "邮件短信发送记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value = "导出邮件短信发送记录列表")
    public void export(HttpServletResponse response) {
        List<TjSendRecord> list = tjSendRecordService.list();
        ExcelUtil<TjSendRecord> util = new ExcelUtil<TjSendRecord>(TjSendRecord.class);
        util.exportExcel(response, list, "邮件短信发送记录数据");
    }
 
    /**
     * 获取邮件短信发送记录详细信息
     */
    //@PreAuthorize("@ss.hasPermi('system:record:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取邮件短信发送记录详细信息")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(tjSendRecordService.getById(id));
    }
 
    /**
     * 新增邮件短信发送记录
     */
    @ApiOperation(value = "新增邮件短信发送记录")
    //@PreAuthorize("@ss.hasPermi('system:record:add')")
    @Log(title = "邮件短信发送记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TjSendRecord tjSendRecord) {
        return toAjax(tjSendRecordService.save(tjSendRecord));
    }
 
    /**
     * 修改邮件短信发送记录
     */
    @ApiOperation(value = "修改邮件短信发送记录")
    //@PreAuthorize("@ss.hasPermi('system:record:edit')")
    @Log(title = "邮件短信发送记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TjSendRecord tjSendRecord) {
        return toAjax(tjSendRecordService.updateById(tjSendRecord));
    }
 
    /**
     * 删除邮件短信发送记录
     */
    @ApiOperation(value = "删除邮件短信发送记录")
    //@PreAuthorize("@ss.hasPermi('system:record:remove')")
    @Log(title = "邮件短信发送记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(tjSendRecordService.removeByIds(Arrays.asList(ids)));
    }
}