-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from lianluoyi/dev
V1.31.0版本更新
- Loading branch information
Showing
65 changed files
with
3,108 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
easyink-admin/src/main/java/com/easyink/web/controller/openapi/AppIdInfoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package com.easyink.web.controller.openapi; | ||
|
||
|
||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
import com.easyink.common.core.domain.AjaxResult; | ||
import com.easyink.common.utils.ServletUtils; | ||
import com.easyink.wecom.login.util.LoginTokenService; | ||
import com.easyink.wecom.openapi.constant.AppInfoConst; | ||
import com.easyink.wecom.openapi.domain.entity.AppCallbackSetting; | ||
import com.easyink.wecom.openapi.domain.resp.BaseOpenApiResp; | ||
import com.easyink.wecom.openapi.domain.vo.AppIdGenVO; | ||
import com.easyink.wecom.openapi.dto.AddCallbackDTO; | ||
import com.easyink.wecom.openapi.dto.EditCallbackDTO; | ||
import com.easyink.wecom.openapi.service.AppCallbackSettingService; | ||
import com.easyink.wecom.openapi.service.AppIdInfoService; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import io.swagger.annotations.ApiParam; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 类名: 开发参数生成接口 | ||
* | ||
* @author : silver_chariot | ||
* @date : 2022/3/14 11:39 | ||
*/ | ||
@RestController | ||
@RequestMapping("/wecom/openapi") | ||
@Api(tags = {"开发参数生成接口"}) | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class AppIdInfoController { | ||
|
||
private final AppIdInfoService appIdGenService; | ||
private final AppCallbackSettingService appCallbackSettingService; | ||
|
||
|
||
@PostMapping("/appInfo/create") | ||
@ApiOperation("生成开发账号") | ||
public AjaxResult<AppIdGenVO> create() { | ||
return AjaxResult.success(appIdGenService.create(LoginTokenService.getLoginUser().getCorpId())); | ||
} | ||
|
||
@GetMapping("/appInfo/get") | ||
@ApiOperation("获取开发参数") | ||
public AjaxResult<AppIdGenVO> get() { | ||
return AjaxResult.success(appIdGenService.getVO(LoginTokenService.getLoginUser().getCorpId())); | ||
} | ||
|
||
@PostMapping("/appInfo/refreshSecret") | ||
@ApiOperation("刷新appSecret") | ||
public AjaxResult<AppIdGenVO> refreshSecret() { | ||
return AjaxResult.success(appIdGenService.refreshSecret(LoginTokenService.getLoginUser().getCorpId())); | ||
} | ||
|
||
@GetMapping("/callback/list") | ||
@ApiOperation("获取消息订阅的回调地址") | ||
public AjaxResult<List<AppCallbackSetting>> getCallbackList() { | ||
return AjaxResult.success(appCallbackSettingService.list(new LambdaQueryWrapper<AppCallbackSetting>() | ||
.eq(AppCallbackSetting::getCorpId, LoginTokenService.getLoginUser().getCorpId()) | ||
)); | ||
} | ||
|
||
@PostMapping("/callback") | ||
@ApiOperation("新增消息订阅的回调地址") | ||
public AjaxResult<Void> addCallbackUrl(@RequestBody AddCallbackDTO dto) { | ||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId()); | ||
return AjaxResult.success(appCallbackSettingService.addUrl(dto)); | ||
} | ||
@PutMapping("/callback") | ||
@ApiOperation("编辑消息订阅的回调地址") | ||
public AjaxResult<Void> editCallbackUrl(@RequestBody EditCallbackDTO dto) { | ||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId()); | ||
appCallbackSettingService.editUrl(dto); | ||
return AjaxResult.success(); | ||
} | ||
|
||
@DeleteMapping("/callback/{id}") | ||
@ApiOperation("删除消息订阅的回调地址") | ||
public AjaxResult<Void> delCallbackUrl( @PathVariable("id")Long id) { | ||
appCallbackSettingService.deleteUrl(id); | ||
return AjaxResult.success(); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
@GetMapping("/validate") | ||
@ApiOperation("校验签名") | ||
public BaseOpenApiResp<Integer> validate() { | ||
log.info("[openApi]收到校验签名请求,{}", ServletUtils.getRequest()); | ||
return BaseOpenApiResp.success(AppInfoConst.TICKET_EXPIRE_TIME); | ||
} | ||
|
||
|
||
} |
20 changes: 20 additions & 0 deletions
20
easyink-admin/src/main/java/com/easyink/web/controller/openapi/OpenApiController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.easyink.web.controller.openapi; | ||
|
||
|
||
import io.swagger.annotations.Api; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* 类名: 对外开放的api接口 | ||
* | ||
* @author : silver_chariot | ||
* @date : 2022/3/14 15:44 | ||
*/ | ||
@RestController | ||
@RequestMapping("/open_api") | ||
@Api(tags = {"对外开放的api接口"}) | ||
public class OpenApiController { | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
easyink-common/src/main/java/com/easyink/common/enums/callback/WecomCallbackEventEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.easyink.common.enums.callback; | ||
|
||
import com.easyink.common.utils.StringUtils; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
import java.util.Arrays; | ||
|
||
/** | ||
* 类名: 企微回调事件枚举 | ||
* | ||
* @author : silver_chariot | ||
* @date : 2023/7/14 10:29 | ||
**/ | ||
@Getter | ||
@AllArgsConstructor | ||
public enum WecomCallbackEventEnum { | ||
UNKNOWN("unknown"), | ||
/** | ||
* 新增客户 | ||
*/ | ||
ADD_EXTERNAL_CONTACT("add_external_contact"), | ||
/** | ||
* 流失客户 | ||
*/ | ||
DEL_FOLLOW_USER("del_follow_user"), | ||
/** | ||
* 编辑客户 | ||
*/ | ||
EDIT_EXTERNAL_CONTACT("edit_external_contact"), | ||
; | ||
|
||
|
||
/** | ||
* 类型 | ||
*/ | ||
private String type; | ||
|
||
/** | ||
* 根据类型返回枚举 | ||
* | ||
* @param type 回调类型 | ||
* @return {@link WecomCallbackEventEnum} | ||
*/ | ||
|
||
public static WecomCallbackEventEnum getByType(String type) { | ||
if (StringUtils.isBlank(type)) { | ||
return UNKNOWN; | ||
} | ||
return Arrays.stream(values()).filter(a -> type.equals(a.getType())).findFirst().orElse(UNKNOWN); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.