yangys
2024-04-04 ed4a5236bab800094be4a8378f5098eebe3de6ac
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
package com.qianwen.smartman.modules.notify.controller;
 
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
import javax.validation.Valid;
import com.qianwen.core.boot.ctrl.BladeController;
import com.qianwen.core.scanner.modular.stereotype.ApiResource;
import com.qianwen.core.tenant.annotation.NonDS;
import com.qianwen.core.tool.api.R;
import com.qianwen.smartman.modules.notify.dto.BusinessNotifyDTO;
import com.qianwen.smartman.modules.notify.entity.NotifyTemplateEntity;
import com.qianwen.smartman.modules.notify.service.IBusinessNotifyService;
import com.qianwen.smartman.modules.notify.service.IBusinessNotifyStateService;
import com.qianwen.smartman.modules.notify.service.INotifyDefaultPersonService;
import com.qianwen.smartman.modules.notify.vo.BusinessNotifyStateVO;
import com.qianwen.smartman.modules.notify.vo.BusinessNotifyVO;
import com.qianwen.smartman.modules.notify.vo.NotifyBusinessChangeStatusVO;
import com.qianwen.smartman.modules.notify.vo.NotifyBusinessSaveVO;
import com.qianwen.smartman.modules.notify.vo.NotifyBusinessTreeVO;
import com.qianwen.smartman.modules.notify.vo.NotifyDefaultObjectVO;
import com.qianwen.smartman.modules.notify.vo.NotifySettingVO;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@Api(value = "业务通知配置", tags = {"业务通知配置"})
@RestController
@ApiResource({"blade-notify/business-notify"})
@NonDS
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/controller/BusinessNotifyController.class */
public class BusinessNotifyController extends BladeController {
    private final IBusinessNotifyService businessNotifyService;
    private final IBusinessNotifyStateService businessNotifyStateService;
    private final INotifyDefaultPersonService notifyDefaultPersonService;
 
    public BusinessNotifyController(final IBusinessNotifyService businessNotifyService, final IBusinessNotifyStateService businessNotifyStateService, final INotifyDefaultPersonService notifyDefaultPersonService) {
        this.businessNotifyService = businessNotifyService;
        this.businessNotifyStateService = businessNotifyStateService;
        this.notifyDefaultPersonService = notifyDefaultPersonService;
    }
 
    @ApiOperationSupport(order = 2)
    @GetMapping({"/tree"})
    @ApiOperation("业务通知列表")
    public R<List<NotifyBusinessTreeVO>> tree() {
        return R.data(this.businessNotifyService.tree());
    }
 
    @ApiOperationSupport(order = 1)
    @GetMapping
    @ApiOperation("业务通知数据")
    public R<BusinessNotifyVO> getBusinessNotify(@RequestParam String businessKey) {
        BusinessNotifyVO businessNotifyVO = new BusinessNotifyVO();
        businessNotifyVO.setDefaultObject(this.notifyDefaultPersonService.getByBusinessKey(businessKey));
        businessNotifyVO.setBusinessNotifyDTOList(this.businessNotifyService.list(businessKey));
        return R.data(businessNotifyVO);
    }
 
    @ApiOperationSupport(order = 1)
    @GetMapping({"state"})
    @ApiOperation("业务通知数据")
    public R<BusinessNotifyStateVO> getBusinessNotifyState(@RequestParam String businessKey, Long businessId) {
        BusinessNotifyStateVO vo = this.businessNotifyStateService.getByBusinessKeyAndBusinessId(businessKey, businessId);
        return R.data(vo);
    }
 
    @PostMapping
    @ApiOperationSupport(order = 1)
    @ApiOperation("业务通知设置新增")
    public R<NotifySettingVO> saveBusinessNotify(@RequestBody NotifyDefaultObjectVO notifyDefaultObjectVO) {
        this.notifyDefaultPersonService.saveNotifyDefaultPerson(notifyDefaultObjectVO);
        return R.success("");
    }
 
    @ApiOperationSupport(order = 2)
    @GetMapping({"/list"})
    @ApiOperation(value = "业务通知表列表", notes = "传入map")
    public R<List<BusinessNotifyDTO>> list(@RequestParam String businessKey) {
        return R.data(this.businessNotifyService.list(businessKey));
    }
 
    @PostMapping({"/save"})
    @ApiOperationSupport(order = 4)
    @ApiOperation("业务通知表新增")
    public R<NotifyBusinessSaveVO> insert(@Valid @RequestBody NotifyBusinessSaveVO notifyBusinessVO) {
        return R.data(this.businessNotifyService.save(notifyBusinessVO));
    }
 
    @ApiOperationSupport(order = 8)
    @PutMapping({"/modify"})
    @ApiOperation("修改模板")
    public R<NotifyTemplateEntity> modify(@Valid @RequestBody NotifyTemplateEntity notifyTemplateEntity) {
        return R.data(this.businessNotifyService.modify(notifyTemplateEntity));
    }
 
    @DeleteMapping({"/remove"})
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "业务通知表删除", notes = "传入ids")
    public R remove(@RequestParam @ApiParam(value = "主键", required = true) Long templateId) {
        return R.status(this.businessNotifyService.remove(templateId));
    }
 
    @PutMapping({"/changeStatus"})
    @ApiOperation("切换状态")
    public R<Boolean> changeStatus(@RequestBody NotifyBusinessChangeStatusVO changeStatusVO) {
        return R.status(this.businessNotifyService.change(changeStatusVO).booleanValue());
    }
}