WeCommunityNewGroupController.java
1.74 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
package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto;
import com.linkwechat.wecom.service.IWeCommunityNewGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 社群运营 新客自动拉群 Controller
*
* @author kewen
* @date 2021-02-19
*/
@Controller
@RequestMapping(value = "communityNewGroup")
public class WeCommunityNewGroupController {
@Autowired
private IWeCommunityNewGroupService weCommunityNewGroupService;
/**
* 新增员工活码
*/
@PreAuthorize("@ss.hasPermi('wecom:code:add')")
@Log(title = "员工活码", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody @Validated WeCommunityNewGroupDto communityNewGroupDto) {
try {
weCommunityNewGroupService.add(communityNewGroupDto);
return AjaxResult.success();
} catch (Exception e) {
e.printStackTrace();
if (e instanceof WeComException){
return AjaxResult.error(e.getMessage());
}else {
return AjaxResult.error("请求接口异常!");
}
}
}
}