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());
|
}
|
}
|