Jelajahi Sumber

添加流程审核钉钉提醒

zhangcl 5 bulan lalu
induk
melakukan
148a4b6f24
17 mengubah file dengan 513 tambahan dan 8 penghapusan
  1. 20 2
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java
  2. 7 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/dal/mysql/product/SupplierMapper.java
  3. 7 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/SupplierService.java
  4. 5 0
      yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/SupplierServiceImpl.java
  5. 21 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dingtalk/DingtalkSendApi.java
  6. 37 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dingtalk/dto/code/DingtalkCodeSendReqDTO.java
  7. 36 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dingtalk/dto/send/DingtalkSendSingleToUserReqDTO.java
  8. 33 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dingtalk/dto/send/NotifySendResponse.java
  9. 11 0
      yudao-module-system/yudao-module-system-biz/pom.xml
  10. 124 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/DingtalkSendServiceImpl.java
  11. 21 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/vo/DingTalkConfigParams.java
  12. 53 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/vo/DingTalkMsgParams.java
  13. 57 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/vo/NotifyChannel.java
  14. 71 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/vo/NotifyTemplate.java
  15. 0 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/util/DingtalkUtil.java
  16. 5 0
      yudao-server/src/main/resources/application-dev.yaml
  17. 5 0
      yudao-server/src/main/resources/application-local.yaml

+ 20 - 2
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java

@@ -7,12 +7,16 @@ import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcess
 import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO;
 import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO;
 import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO;
 import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO;
 import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskTimeoutReqDTO;
 import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskTimeoutReqDTO;
+import cn.iocoder.yudao.module.system.api.dingtalk.DingtalkSendApi;
 import cn.iocoder.yudao.module.system.api.sms.SmsSendApi;
 import cn.iocoder.yudao.module.system.api.sms.SmsSendApi;
+import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
+import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.validation.annotation.Validated;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -29,6 +33,12 @@ public class BpmMessageServiceImpl implements BpmMessageService {
     @Resource
     @Resource
     private SmsSendApi smsSendApi;
     private SmsSendApi smsSendApi;
 
 
+    @Resource
+    private DingtalkSendApi dingtalkSendApi;
+
+    @Resource
+    private AdminUserApi adminUserApi;
+
     @Resource
     @Resource
     private WebProperties webProperties;
     private WebProperties webProperties;
 
 
@@ -58,8 +68,16 @@ public class BpmMessageServiceImpl implements BpmMessageService {
         templateParams.put("taskName", reqDTO.getTaskName());
         templateParams.put("taskName", reqDTO.getTaskName());
         templateParams.put("startUserNickname", reqDTO.getStartUserNickname());
         templateParams.put("startUserNickname", reqDTO.getStartUserNickname());
         templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
         templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
-        smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(),
-                BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams));
+        /* smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(),
+                BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams)); */
+        // 任务指定到具体人时 钉钉提醒
+        // 根据审批人的id查询手机号
+        AdminUserRespDTO user = adminUserApi.getUser(reqDTO.getAssigneeUserId());
+        // 构建消息提醒格式 【DeepOil】供应商审核流程-S20250314061116cce-中国石化,请前往 http://1.94.244.160:91/ 处理。 [2023-05-19 09:02:51]
+        // SupplierDO supplier = supplierService.getByBpmProcessId(reqDTO.getProcessInstanceId());
+        // String msg = "【DeepOil】供应商审核流程"+"-"+supplier.getCode()+"-"+supplier.getName()+",请前往 http://1.94.244.160:91/ 处理。"+"["+new Date()+"]";
+        String msg = "【DeepOil】供应商审核流程 - 有新的供应商信息需要审核"+",请前往 http://1.94.244.160:91/ 处理。"+"["+new Date()+"]";
+        dingtalkSendApi.send(user.getMobile(), msg);
     }
     }
 
 
     @Override
     @Override

+ 7 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/dal/mysql/product/SupplierMapper.java

@@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
 import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.SupplierPageReqVO;
 import cn.iocoder.yudao.module.supplier.controller.admin.product.vo.SupplierPageReqVO;
+import cn.iocoder.yudao.module.supplier.dal.dataobject.product.CertificateDO;
 import cn.iocoder.yudao.module.supplier.dal.dataobject.product.SupplierDO;
 import cn.iocoder.yudao.module.supplier.dal.dataobject.product.SupplierDO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 
 
@@ -41,4 +42,10 @@ public interface SupplierMapper extends BaseMapperX<SupplierDO> {
                 .orderByDesc(SupplierDO::getId));
                 .orderByDesc(SupplierDO::getId));
     }
     }
 
 
+    default SupplierDO selectByBpmProcessInstanceId(String processInstanceId) {
+        return selectOne(new LambdaQueryWrapperX<SupplierDO>()
+                .eq(SupplierDO::getProcessInstanceId, processInstanceId));
+
+    }
+
 }
 }

+ 7 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/SupplierService.java

@@ -77,4 +77,11 @@ public interface SupplierService {
      * @param id        供应商编号
      * @param id        供应商编号
      */
      */
     SupplierRespVO allSupplierInfo(Long id);
     SupplierRespVO allSupplierInfo(Long id);
+
+    /**
+     * 根据流程实例id查询供应商信息
+     *
+     * @param bpmProcessInstanceId        流程实例id
+     */
+    SupplierDO getByBpmProcessId(String bpmProcessInstanceId);
 }
 }

+ 5 - 0
yudao-module-supplier/yudao-module-supplier-biz/src/main/java/cn/iocoder/yudao/module/supplier/service/product/SupplierServiceImpl.java

@@ -186,4 +186,9 @@ public class SupplierServiceImpl implements SupplierService {
         return supplierRespVO;
         return supplierRespVO;
     }
     }
 
 
+    @Override
+    public SupplierDO getByBpmProcessId(String bpmProcessInstanceId) {
+        return supplierMapper.selectByBpmProcessInstanceId(bpmProcessInstanceId);
+    }
+
 }
 }

+ 21 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dingtalk/DingtalkSendApi.java

@@ -0,0 +1,21 @@
+package cn.iocoder.yudao.module.system.api.dingtalk;
+
+import cn.iocoder.yudao.module.system.api.dingtalk.dto.send.NotifySendResponse;
+
+/**
+ * 钉钉消息发送 API 接口
+ *
+ * @author suiyy
+ */
+public interface DingtalkSendApi {
+
+    /**
+     * 钉钉统一发送方法
+     *
+     * @param sendAccount 被通知对象 手机号
+     * @param sendContent 通知内容
+     * @return com.yanfan.common.core.notify.NotifySendResponse
+     */
+    NotifySendResponse send(String sendAccount, String sendContent);
+
+}

+ 37 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dingtalk/dto/code/DingtalkCodeSendReqDTO.java

@@ -0,0 +1,37 @@
+package cn.iocoder.yudao.module.system.api.dingtalk.dto.code;
+
+import cn.iocoder.yudao.framework.common.validation.InEnum;
+import cn.iocoder.yudao.framework.common.validation.Mobile;
+import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 短信验证码的发送 Request DTO
+ *
+ * @author 芋道源码
+ */
+@Data
+public class DingtalkCodeSendReqDTO {
+
+    /**
+     * 手机号
+     */
+    @Mobile
+    @NotEmpty(message = "手机号不能为空")
+    private String mobile;
+    /**
+     * 发送场景
+     */
+    @NotNull(message = "发送场景不能为空")
+    @InEnum(SmsSceneEnum.class)
+    private Integer scene;
+    /**
+     * 发送 IP
+     */
+    @NotEmpty(message = "发送 IP 不能为空")
+    private String createIp;
+
+}

+ 36 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dingtalk/dto/send/DingtalkSendSingleToUserReqDTO.java

@@ -0,0 +1,36 @@
+package cn.iocoder.yudao.module.system.api.dingtalk.dto.send;
+
+import cn.iocoder.yudao.framework.common.validation.Mobile;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import java.util.Map;
+
+/**
+ * 短信发送给 Admin 或者 Member 用户
+ *
+ * @author 芋道源码
+ */
+@Data
+public class DingtalkSendSingleToUserReqDTO {
+
+    /**
+     * 用户编号
+     */
+    private Long userId;
+    /**
+     * 手机号
+     */
+    @Mobile
+    private String mobile;
+    /**
+     * 短信模板编号
+     */
+    @NotEmpty(message = "短信模板编号不能为空")
+    private String templateCode;
+    /**
+     * 短信模板参数
+     */
+    private Map<String, Object> templateParams;
+
+}

+ 33 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dingtalk/dto/send/NotifySendResponse.java

@@ -0,0 +1,33 @@
+package cn.iocoder.yudao.module.system.api.dingtalk.dto.send;
+
+import lombok.Data;
+
+/**
+ * @author fastb
+ * @version 1.0
+ * @description: 通知发送响应类
+ * @date 2024-01-11 16:06
+ */
+@Data
+public class NotifySendResponse {
+
+    /**
+     * 发送结果 1-成功;0-失败
+     */
+    private Integer status = 0;
+
+    /**
+     * 返回结果内容
+     */
+    private String resultContent = "";
+
+    /**
+     * 发送内容,变量替换后的
+     */
+    private String sendContent = "";
+
+    /**
+     * 不是使用sendAccount账号发送,而是像钉钉这种,发送所有人或部门,记录这个
+     */
+    private String otherSendAccount = "";
+}

+ 11 - 0
yudao-module-system/yudao-module-system-biz/pom.xml

@@ -123,6 +123,17 @@
             <scope>system</scope>
             <scope>system</scope>
             <systemPath>${project.basedir}/src/main/resources/lib/taobao-sdk-java-auto_1479188381469-20210402.jar</systemPath>
             <systemPath>${project.basedir}/src/main/resources/lib/taobao-sdk-java-auto_1479188381469-20210402.jar</systemPath>
         </dependency>
         </dependency>
+        <!-- 钉钉官方包 -->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>dingtalk</artifactId>
+            <version>1.1.32</version>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>alibaba-dingtalk-service-sdk</artifactId>
+            <version>2.0.0</version>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
 </project>
 </project>

+ 124 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/DingtalkSendServiceImpl.java

@@ -0,0 +1,124 @@
+package cn.iocoder.yudao.module.system.service.dingtalk;
+
+import cn.hutool.core.util.StrUtil;
+import cn.iocoder.yudao.module.system.api.dingtalk.DingtalkSendApi;
+import cn.iocoder.yudao.module.system.api.dingtalk.dto.send.DingtalkSendSingleToUserReqDTO;
+import cn.iocoder.yudao.module.system.service.dingtalk.vo.DingTalkMsgParams;
+import cn.iocoder.yudao.module.system.api.dingtalk.dto.send.NotifySendResponse;
+import com.alibaba.fastjson.JSON;
+import com.aliyun.dingtalkoauth2_1_0.Client;
+import com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenRequest;
+import com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenResponse;
+import com.aliyun.teaopenapi.models.Config;
+import com.dingtalk.api.DefaultDingTalkClient;
+import com.dingtalk.api.DingTalkClient;
+import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
+import com.dingtalk.api.request.OapiV2UserGetbymobileRequest;
+import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response;
+import com.dingtalk.api.response.OapiV2UserGetbymobileResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * 钉钉消息 Service 发送的实现
+ *
+ * @author suiyy
+ */
+@Service
+@Slf4j
+public class DingtalkSendServiceImpl implements DingtalkSendApi {
+
+    @Value("${dingtalk.APP_KEY}")
+    private String appKey;
+
+    @Value("${dingtalk.APP_SECRET}")
+    private String appSecret;
+
+    @Value("${dingtalk.AGENT_ID}")
+    private String agentId;
+
+    @Value("${dingtalk.URL_GET_SEND_MESSAGE}")
+    private String sendMsgUrl;
+
+    @Value("${dingtalk.URL_GET_USERINFO_BYMOBILE}")
+    private String getUserInfoByMobile;
+
+    @Override
+    public NotifySendResponse send(String sendAccount, String sendContent) {
+        NotifySendResponse notifySendResponse = new NotifySendResponse();
+        notifySendResponse.setSendContent(sendContent);
+        notifySendResponse.setStatus(1);
+        // 发送
+        try {
+            // 获取应用访问凭证accessToken
+            Config config = new Config();
+            config.protocol = "https";
+            config.regionId = "central";
+            Client client = new Client(config);
+            GetAccessTokenRequest accessTokenRequest = new GetAccessTokenRequest();
+            accessTokenRequest.setAppKey(appKey);
+            accessTokenRequest.setAppSecret(appSecret);
+            GetAccessTokenResponse accessTokenResponse = client.getAccessToken(accessTokenRequest);
+            String accessToken = accessTokenResponse.getBody().getAccessToken();
+            DingTalkClient dingTalkClient = new DefaultDingTalkClient(sendMsgUrl);
+            OapiMessageCorpconversationAsyncsendV2Request req = new OapiMessageCorpconversationAsyncsendV2Request();
+            req.setAgentId(Long.valueOf(agentId));
+            // 优先取发送账号、然后是部门、然后是所有人
+            if (StrUtil.isNotEmpty(sendAccount)) {
+                // 根据手机号获取钉钉userid
+                DingTalkClient dingTalkClientUser = new DefaultDingTalkClient(getUserInfoByMobile);
+                OapiV2UserGetbymobileRequest phoneReq = new OapiV2UserGetbymobileRequest();
+                phoneReq.setMobile(sendAccount);
+                OapiV2UserGetbymobileResponse rsp = dingTalkClientUser.execute(phoneReq, accessToken);
+                String userId = rsp.getResult().getUserid();
+                req.setUseridList(userId);
+                req.setToAllUser(Boolean.FALSE);
+            }
+            OapiMessageCorpconversationAsyncsendV2Request.Msg msg = this.createOapiMessageMsg(null, sendContent);
+            req.setMsg(msg);
+            OapiMessageCorpconversationAsyncsendV2Response rsp = dingTalkClient.execute(req, accessToken);
+            notifySendResponse.setStatus(0 == rsp.getErrcode() ? 1 : 0);
+            notifySendResponse.setResultContent(JSON.toJSONString(rsp));
+        } catch (Exception e) {
+            notifySendResponse.setStatus(0);
+            notifySendResponse.setResultContent(e.toString());
+        }
+        return notifySendResponse;
+    }
+
+    /**
+     * 构建钉钉发送消息
+     *
+     * @param msgParams 消息参数
+     * @return
+     */
+    private OapiMessageCorpconversationAsyncsendV2Request.Msg createOapiMessageMsg(DingTalkMsgParams msgParams, String content) {
+        OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
+        msg.setMsgtype("text");
+        switch (msg.getMsgtype()) {
+            case "text":
+                msg.setText(new OapiMessageCorpconversationAsyncsendV2Request.Text());
+                msg.getText().setContent(content);
+                break;
+            case "link":
+                msg.setLink(new OapiMessageCorpconversationAsyncsendV2Request.Link());
+                msg.getLink().setTitle(msgParams.getTitle());
+                msg.getLink().setText(content);
+                msg.getLink().setMessageUrl(msgParams.getMessageUrl());
+                msg.getLink().setPicUrl(msgParams.getPicUrl());
+                break;
+            case "markdown":
+                msg.setMarkdown(new OapiMessageCorpconversationAsyncsendV2Request.Markdown());
+                msg.getMarkdown().setText(content);
+                msg.getMarkdown().setTitle(msgParams.getTitle());
+                break;
+            default:
+                break;
+        }
+        return msg;
+    }
+
+}

+ 21 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/vo/DingTalkConfigParams.java

@@ -0,0 +1,21 @@
+package cn.iocoder.yudao.module.system.service.dingtalk.vo;
+
+import lombok.Data;
+
+/**
+ * @author suiyy
+ * @version 1.0
+ * @description: 钉钉渠道应用配置类
+ * @date 2024-01-12 17:50
+ */
+@Data
+public class DingTalkConfigParams {
+
+    private String appKey;
+
+    private String appSecret;
+
+    private String agentId;
+
+    private String webHook;
+}

+ 53 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/vo/DingTalkMsgParams.java

@@ -0,0 +1,53 @@
+package cn.iocoder.yudao.module.system.service.dingtalk.vo;
+
+import lombok.Data;
+
+/**
+ * @author suiyy
+ * @version 1.0
+ * @description: 钉钉模版配置参数类
+ * @date 2024-01-12 17:51
+ */
+@Data
+public class DingTalkMsgParams {
+
+    /**
+     * 发送账号
+     */
+    private String sendAccount;
+
+    /**
+     * 是否发送所有人
+     */
+    private String sendAllEnable;
+
+    /**
+     * 发送什么类型的文本
+     */
+    private String msgType;
+
+    /**
+     * 消息内容
+     */
+    private String content;
+
+    /**
+     * 消息标题
+     */
+    private String title;
+
+    /**
+     * 消息链接
+     */
+    private String messageUrl;
+
+    /**
+     * 图片链接
+     */
+    private String picUrl;
+
+    /**
+     * 所属部门id
+     */
+    private String deptId;
+}

+ 57 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/vo/NotifyChannel.java

@@ -0,0 +1,57 @@
+package cn.iocoder.yudao.module.system.service.dingtalk.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 通知渠道对象 notify_channel
+ *
+ * @author suiyy
+ * @date 2023-12-01
+ */
+@Data
+@Accessors(chain = true)
+public class NotifyChannel {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Long id;
+
+    /**
+     * 通知名称
+     */
+    private String name;
+
+    /**
+     * 发送渠道类型
+     */
+    private String channelType;
+
+    /**
+     * 服务商
+     */
+    private String provider;
+
+    /**
+     * 配置内容
+     */
+    private String configContent;
+
+    /**
+     * 租户id
+     */
+    private Long tenantId;
+
+    /**
+     * 租户名称
+     */
+    private String tenantName;
+
+    /**
+     * 逻辑删除标识
+     */
+    private Integer delFlag;
+
+}

+ 71 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/vo/NotifyTemplate.java

@@ -0,0 +1,71 @@
+package cn.iocoder.yudao.module.system.service.dingtalk.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 通知模版对象 notify_template
+ *
+ * @author kerwincui
+ * @date 2023-12-01
+ */
+@Data
+@Accessors(chain = true)
+public class NotifyTemplate {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Long id;
+
+    /**
+     * 模版名称
+     */
+    private String name;
+
+    /**
+     * 通知渠道
+     */
+    private Long channelId;
+
+    /**
+     * 业务编码
+     */
+    private String serviceCode;
+
+    private String msgParams;
+
+    /**
+     * 发送账号
+     */
+    private Integer status;
+
+    /**
+     * 逻辑删除标识
+     */
+    private Integer delFlag;
+
+    private String channelName;
+
+    /**
+     * 发送渠道类型
+     */
+    private String channelType;
+
+    /**
+     * 服务商
+     */
+    private String provider;
+
+    /**
+     * 租户id
+     */
+    private Long tenantId;
+
+    /**
+     * 租户名称
+     */
+    private String tenantName;
+
+}

+ 0 - 6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/util/DingtalkUtil.java

@@ -1,6 +1,5 @@
 package cn.iocoder.yudao.module.system.util;
 package cn.iocoder.yudao.module.system.util;
 
 
-import com.alibaba.fastjson.JSONObject;
 import com.dingtalk.api.DefaultDingTalkClient;
 import com.dingtalk.api.DefaultDingTalkClient;
 import com.dingtalk.api.DingTalkClient;
 import com.dingtalk.api.DingTalkClient;
 import com.dingtalk.api.request.OapiGettokenRequest;
 import com.dingtalk.api.request.OapiGettokenRequest;
@@ -15,11 +14,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 
 
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
 /**
 /**
  * @author suiyy
  * @author suiyy
  * @date 20230602
  * @date 20230602

+ 5 - 0
yudao-server/src/main/resources/application-dev.yaml

@@ -143,11 +143,16 @@ logging:
 
 
 --- #################### 钉微应用相关配置 ####################
 --- #################### 钉微应用相关配置 ####################
 dingtalk:
 dingtalk:
+  AGENT_ID: 3453312373  # DeepOil 微应用 agent_id
+  APP_KEY: dingik345qmyhtysvs2x # 钉钉微应用 appkey
+  APP_SECRET: MIF55t94hRhI2EPaymoUF8-LRhWO6RxTxevYdwE9imdRUEZzxdgpNexqoTn2AIMr # 钉钉微应用 appkey
   GET_ACCESS_TOKEN_URL: https://oapi.dingtalk.com/gettoken  # 获取access_token
   GET_ACCESS_TOKEN_URL: https://oapi.dingtalk.com/gettoken  # 获取access_token
   URL_GET_USERINFO_BYCODE: https://oapi.dingtalk.com/sns/getuserinfo_bycode # 通过二维码扫码获取UNIONID
   URL_GET_USERINFO_BYCODE: https://oapi.dingtalk.com/sns/getuserinfo_bycode # 通过二维码扫码获取UNIONID
   URL_GET_USERINFO_BYUNIONID: https://oapi.dingtalk.com/topapi/user/getbyunionid # 通过UNIONID获取用户信息
   URL_GET_USERINFO_BYUNIONID: https://oapi.dingtalk.com/topapi/user/getbyunionid # 通过UNIONID获取用户信息
   URL_GET_USERINFO_BYUSERID: https://oapi.dingtalk.com/topapi/v2/user/get # 根据用户id获取用户详情 url
   URL_GET_USERINFO_BYUSERID: https://oapi.dingtalk.com/topapi/v2/user/get # 根据用户id获取用户详情 url
   URL_GET_USERINFO_BYAUTHCODE: https://oapi.dingtalk.com/topapi/v2/user/getuserinfo # 通过免登授权码获取用户信息 url
   URL_GET_USERINFO_BYAUTHCODE: https://oapi.dingtalk.com/topapi/v2/user/getuserinfo # 通过免登授权码获取用户信息 url
+  URL_GET_SEND_MESSAGE: https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2 # 发送钉钉工作消息
+  URL_GET_USERINFO_BYMOBILE: https://oapi.dingtalk.com/topapi/v2/user/getbymobile # 根据用户手机号获取钉钉用户信息 url
 
 
 --- #################### 微信公众号相关配置 ####################
 --- #################### 微信公众号相关配置 ####################
 wx: # 参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
 wx: # 参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档

+ 5 - 0
yudao-server/src/main/resources/application-local.yaml

@@ -182,11 +182,16 @@ debug: false
 
 
 --- #################### 钉微应用相关配置 ####################
 --- #################### 钉微应用相关配置 ####################
 dingtalk:
 dingtalk:
+  AGENT_ID: 3453312373  # DeepOil 微应用 agent_id
+  APP_KEY: dingik345qmyhtysvs2x # 钉钉微应用 appkey
+  APP_SECRET: MIF55t94hRhI2EPaymoUF8-LRhWO6RxTxevYdwE9imdRUEZzxdgpNexqoTn2AIMr # 钉钉微应用 appkey
   GET_ACCESS_TOKEN_URL: https://oapi.dingtalk.com/gettoken  # 获取access_token
   GET_ACCESS_TOKEN_URL: https://oapi.dingtalk.com/gettoken  # 获取access_token
   URL_GET_USERINFO_BYCODE: https://oapi.dingtalk.com/sns/getuserinfo_bycode # 通过二维码扫码获取UNIONID
   URL_GET_USERINFO_BYCODE: https://oapi.dingtalk.com/sns/getuserinfo_bycode # 通过二维码扫码获取UNIONID
   URL_GET_USERINFO_BYUNIONID: https://oapi.dingtalk.com/topapi/user/getbyunionid # 通过UNIONID获取用户信息
   URL_GET_USERINFO_BYUNIONID: https://oapi.dingtalk.com/topapi/user/getbyunionid # 通过UNIONID获取用户信息
   URL_GET_USERINFO_BYUSERID: https://oapi.dingtalk.com/topapi/v2/user/get # 根据用户id获取用户详情 url
   URL_GET_USERINFO_BYUSERID: https://oapi.dingtalk.com/topapi/v2/user/get # 根据用户id获取用户详情 url
   URL_GET_USERINFO_BYAUTHCODE: https://oapi.dingtalk.com/topapi/v2/user/getuserinfo # 通过免登授权码获取用户信息 url
   URL_GET_USERINFO_BYAUTHCODE: https://oapi.dingtalk.com/topapi/v2/user/getuserinfo # 通过免登授权码获取用户信息 url
+  URL_GET_SEND_MESSAGE: https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2 # 发送钉钉工作消息
+  URL_GET_USERINFO_BYMOBILE: https://oapi.dingtalk.com/topapi/v2/user/getbymobile # 根据用户手机号获取钉钉用户信息 url
 
 
 --- #################### 微信公众号、小程序相关配置 ####################
 --- #################### 微信公众号、小程序相关配置 ####################
 wx:
 wx: