|
@@ -0,0 +1,49 @@
|
|
|
+package com.zjugis.module.infra.api.ding;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.zjugis.framework.common.pojo.CommonResult;
|
|
|
+import com.zjugis.module.infra.api.ding.dto.DingMessageDto;
|
|
|
+import com.zjugis.module.infra.service.ding.DingService;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author ljy
|
|
|
+ * @version 1.0
|
|
|
+ * @date 2024/4/10 17:22
|
|
|
+ */
|
|
|
+@RestController // 提供 RESTful API 接口,给 Feign 调用
|
|
|
+@Validated
|
|
|
+public class DingApiImpl implements DingApi {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ DingService dingService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param dingMessageDto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public CommonResult<String> sendMessage(DingMessageDto dingMessageDto) {
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("id", dingMessageDto.getUserId());
|
|
|
+ // TODO
|
|
|
+// String userApiUrl = ApiUtils.getzUserOrgRightUrl() + "/UsersApi/getUserById";
|
|
|
+// //调用接口获取数据
|
|
|
+// String userResult = ServiceApiUtils.getDataFromServiceApi(userApiUrl, params);
|
|
|
+// JSONObject userJsonObject = JSONObject.parseObject(userResult);
|
|
|
+// Map<String, Object> userObject = (Map) userJsonObject;
|
|
|
+// String phone = (String) userObject.get("mobilePhone");
|
|
|
+// if(StringUtils.isBlank(phone)){
|
|
|
+// return "用户手机号不存在,无法获取钉钉用户";
|
|
|
+// }
|
|
|
+// return dingService.sendNotification(phone, content);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|