Browse Source

快手预警,发送人添加领导

zhaoxian 2 years ago
parent
commit
66c2476d53

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MailLogMapper.java

@@ -27,4 +27,6 @@ public interface MailLogMapper extends BaseMapper<MailLog> {
     String getUserNameByUserId(@Param("userId") String transferor);
 
     JSONObject getWeChatByMail(@Param("mail") String mail);
+
+    List<JSONObject> getWChatIdByAccountId(@Param("accountId") Long accountId);
 }

+ 23 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MailLogMapper.xml

@@ -51,6 +51,29 @@
 
     </select>
 
+
+    <select id="getWChatIdByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+        select wexin_id, corp_id, wexin_name
+        from ctop_corp_wexin_user
+        where user_id = (select ctop_user_allocation.user_id
+                         from ctop_user_allocation
+                         where account_id = #{accountId} limit 1)
+        union all
+        select wexin_id, corp_id, wexin_name
+        from ctop_corp_wexin_user
+        where user_id = (select leader_id
+                         from sys_user
+                         where id = (SELECT ctop_user_allocation.user_id
+                                     FROM ctop_user_allocation
+                                     WHERE account_id = #{accountId}
+            LIMIT 1))
+        union all
+        select wexin_id, corp_id, wexin_name
+        from ctop_corp_wexin_user
+        where user_id = 'f6a6843879c949618e4a859140c8a127';
+
+    </select>
+
     <select id="getUserNameByUserId" resultType="java.lang.String">
     select
     realname

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/ISendMessageService.java

@@ -2,4 +2,6 @@ package cn.com.ctop.common.module.service;
 
 public interface ISendMessageService {
     void sendMessage(String id, String text);
+
+    void sendMessageByAccountId(Long accountId, String text);
 }

+ 10 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/SendMessageServiceImpl.java

@@ -9,6 +9,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Slf4j
 @Service
 public class SendMessageServiceImpl implements ISendMessageService {
@@ -25,4 +27,12 @@ public class SendMessageServiceImpl implements ISendMessageService {
             log.info("消息发送成功,userId:{}", userId);
         }
     }
+
+    @Override
+    public void sendMessageByAccountId(Long accountId, String text) {
+        List<JSONObject> list = mailLogMapper.getWChatIdByAccountId(accountId);
+        for (JSONObject jsonObject : list) {
+            corpWexinUtils.sendMessageByWeChatId(jsonObject, text);
+        }
+    }
 }

+ 2 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/WarningOperationServiceImpl.java

@@ -70,7 +70,7 @@ public class WarningOperationServiceImpl implements IWarningOperationService {
         warningOperationLogService.save(warningOperationLog);
         log.info("出价方式预警,暂停组成功,accountId:{},unitId:{}", advertiserId, unitId);
         try {
-            sendMessageService.sendMessage(userId, text);
+            sendMessageService.sendMessageByAccountId(advertiserId, text);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -103,7 +103,7 @@ public class WarningOperationServiceImpl implements IWarningOperationService {
         warningOperationLogService.save(warningOperationLog);
         log.info("出价过高预警,暂停组成功,accountId:{},unitId:{}", advertiserId, unitId);
         try {
-            sendMessageService.sendMessage(userId, text);
+            sendMessageService.sendMessageByAccountId(advertiserId, text);
         } catch (Exception e) {
             e.printStackTrace();
         }