DeliverLogController.java
2.22 KB
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
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.lang.Assert;
import org.springframework.web.bind.annotation.*;
import vion.dto.DeliverLogDTO;
import vion.service.IDeliverLogService;
import vion.vo.DeliverLogVO;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/deliverLog")
public class DeliverLogController {
private final IDeliverLogService deliverLogService;
@GetMapping
@SaCheckPermission(value = "deliverLog:list", orRole = "admin")
public Map<String, TreeMap<String, List<DeliverLogVO>>> list(DeliverLogDTO dto) {
Assert.isTrue(ArrayUtil.isAllNotNull(dto.getLogDateStart(), dto.getLogDateEnd()), "查询时间范围不能为空");
return deliverLogService.list(dto);
}
@GetMapping("/{id}")
@SaCheckPermission(value = "deliverLog:query", orRole = "admin")
public DeliverLogVO getById(@PathVariable Long id) {
return deliverLogService.getById(id);
}
@PostMapping
@SaCheckPermission(value = "deliverLog:save", orRole = "admin")
public String save(@RequestBody List<DeliverLogDTO> deliverLogDTOList) {
return deliverLogService.save(deliverLogDTOList);
}
@PostMapping("/{id}")
@SaCheckPermission(value = "deliverLog:edit", orRole = "admin")
public String update(@PathVariable Long id, @RequestBody DeliverLogDTO dto) {
dto.setId(id);
return deliverLogService.update(dto);
}
@DeleteMapping("/{id}")
@SaCheckPermission(value = "deliverLog:remove", orRole = "admin")
public String remove(@PathVariable Long id) {
return deliverLogService.removeById(id) ? "删除成功" : "删除失败";
}
@GetMapping("/notify")
@SaCheckPermission(value = "deliverLog:notify", orRole = "admin")
public String logNotify(String[] userIdStr, String dateStr) {
Assert.notEmpty(userIdStr, "未选择提醒人");
Assert.notBlank(dateStr, "未选择提醒日期");
return deliverLogService.logNotify(userIdStr, dateStr) ? "钉钉提醒成功" : "钉钉提醒失败";
}
}