From 3b759ef71bb48f9bb6f8445770d20e8ea7921788 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 06 一月 2026 13:58:14 +0800
Subject: [PATCH] Merge branch 'wuhuyancao' of http://139.186.142.91:10010/r/productDev/dmvisit into wuhuyancao

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetGridServiceImpl.java |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 107 insertions(+), 3 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetGridServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetGridServiceImpl.java
index 38fdeae..939f95e 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetGridServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetGridServiceImpl.java
@@ -7,6 +7,9 @@
 import com.doumee.core.dingTalk.DingTalkStream;
 import com.doumee.core.exception.BusinessException;
 import com.doumee.core.haikang.model.HKConstants;
+import com.doumee.core.jiandaoyun.api.arch.DeptApiClient;
+import com.doumee.core.jiandaoyun.api.jdy.FormDataApiClient;
+import com.doumee.core.jiandaoyun.model.form.FormDataCreateParam;
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.DateUtil;
 import com.doumee.dao.business.*;
@@ -28,12 +31,14 @@
 import com.hikvision.artemis.sdk.config.ArtemisConfig;
 import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
+import okhttp3.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -709,6 +714,14 @@
                             //                    StringUtils.join(memberList.stream().filter(i->StringUtils.isNotBlank(i.getDdId())).map(i->i.getDdId()).collect(Collectors.toList()),","),
                             //                      dingTalk.getAlarmNoticeMsg(warningPush.getRegion(),DateUtil.getCurrDateTime(),content));
                             //            warningPush.setStatus(noticeFlag?Constants.ONE:Constants.TWO);
+                            List<String> ddUserIdList = memberList.stream().filter(i->StringUtils.isNotBlank(i.getDdId())).map(i->i.getDdId()).collect(Collectors.toList());
+                            if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ddUserIdList)){
+                                for (String ddUserId:ddUserIdList) {
+                                    this.getJDYData(warningEvent,ddUserId,
+                                            systemDictDataBiz.queryByCode(Constants.JDY_CONFIG,Constants.JDY_ENTRY_ID).getCode()
+                                    );
+                                }
+                            }
                         }
                         warningPushMapper.insert(warningPush);
                         warningEvent.setStatus(Constants.ONE);
@@ -739,6 +752,78 @@
                 }
             }
         }
+    }
+
+
+    /**
+     * 绠�閬撲簯娑堟伅鎺ㄩ�� 瀹氬埗
+     * @param warningEvent
+     * @param ddUserId 鎺ユ敹浜� 閽夐拤涓婚敭
+     * @param entryId 琛ㄥ崟ID
+     * @throws IOException
+     */
+    public void getJDYData(WarningEvent warningEvent,String ddUserId , String entryId)  {
+        try {
+            log.error("绠�閬撲簯鍙戦�侀�氱煡杩斿洖淇℃伅寮�濮�"  );
+            FormDataApiClient apiClient = new FormDataApiClient(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_API_KEY).getCode()
+                    ,systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_API_HOST).getCode());
+            FormDataCreateParam param  =new FormDataCreateParam();
+            param.setData(this.getJdyChildData(warningEvent,ddUserId));
+            param.setApp_id(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_APPID).getCode());
+            param.setEntry_id(entryId);
+            param.setIs_start_trigger(false);
+            param.setIs_start_trigger(true);
+            Map<String, Object>  response =  apiClient.singleDataCreate(param,apiClient.getDefaultVersion());
+            /*
+             Map<String,Object> map = new HashMap<>();
+            map.put("app_id",appid);
+            map.put("entry_id",entryId);
+            map.put("is_start_workflow","false");
+            map.put("is_start_trigger","true");
+            map.put("data",this.getJdyChildData(warningEvent,ddUserId));
+            OkHttpClient client = new OkHttpClient().newBuilder()
+                    .build();
+            MediaType mediaType = MediaType.parse("application/json");
+            RequestBody body = RequestBody.create(mediaType, JSONObject.toJSONString(map));//"{\"data\":{\"notice_time\":{\"value\":\"2025-12-23 04:56:29\"},\"title\":{\"value\":\"璺ㄨ秺鐢熶骇绾縗"},\"user\":{\"value\":\"1568490244651036\"},\"content\":{\"value\":\"璺ㄨ秺鐢熶骇绾�-鑺滄箹鐗╂祦涓績鍖楀洿澧欒繃閬撲笢\"},\"notice_type\":{\"value\":\"璺ㄨ秺鐢熶骇绾縗"}},\"is_start_trigger\":\"true\",\"app_id\":\"6909d0fbdb93b068192dc4a9\",\"entry_id\":\"694a19ecf57e071788efc20b\",\"is_start_workflow\":\"false\"}");
+            log.error("绠�閬撲簯鍙戦�侀�氱煡璇锋眰淇℃伅" + JSONObject.toJSONString(map));
+            Request request = new Request.Builder()
+                    .url(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_API_HOST).getCode()+"v5/app/entry/data/create")
+                    .method("POST", body)
+                    .addHeader("Authorization", "Bearer "+jdyApiKey)
+                    .addHeader("Content-Type", "application/json")
+                    .build();
+            Response response = client.newCall(request).execute();*/
+            log.error("绠�閬撲簯鍙戦�侀�氱煡杩斿洖淇℃伅" + JSONObject.toJSONString(response));
+        }catch (Exception e){
+            log.error("绠�閬撲簯鍙戦�侀�氱煡杩斿洖淇℃伅寮傚父锛�" + e.getMessage());
+        }
+    }
+
+
+    public Map<String,Object> getJdyChildData(WarningEvent warningEvent,String ddUserId){
+        Map<String,Object> dataMap = new HashMap<>();
+
+        Map<String,Object> title = new HashMap<>();
+        title.put("value",warningEvent.getTitle());
+        dataMap.put("title",title);
+
+        Map<String,Object> user = new HashMap<>();
+        user.put("value",ddUserId);
+        dataMap.put("user",user);
+
+        Map<String,Object> notice_time = new HashMap<>();
+        notice_time.put("value",DateUtil.getCurrDateTime());
+        dataMap.put("notice_time",notice_time);
+
+        Map<String,Object> notice_type = new HashMap<>();
+        notice_type.put("value",warningEvent.getTitle());
+        dataMap.put("notice_type",notice_type);
+
+        Map<String,Object> content = new HashMap<>();
+        content.put("value",warningEvent.getContent());
+        dataMap.put("content",content);
+
+        return dataMap;
     }
 
 
@@ -818,7 +903,7 @@
 
     }*/
 
-    public List<Integer> processWarnFront(Constants.WarningConfig warningConfig){
+    public List<Integer> processWarnFrontWithEvent(Constants.WarningConfig warningConfig,  List<WarningEvent> returnEventList){
 
         List<WarningRuleDetail> warningRuleDetailList = warningRuleDetailMapper.selectJoinList(WarningRuleDetail.class,new MPJLambdaWrapper<WarningRuleDetail>()
                 .selectAll(WarningRuleDetail.class)
@@ -832,7 +917,7 @@
             return new ArrayList<>();
         }
         //鎵�鏈夋姤璀﹁鍒欓厤缃俊鎭�
-        List<Integer> ruleIdList = warningRuleDetailList.stream().map(i->i.getRuleId()).collect(Collectors.toList());;
+        List<Integer> ruleIdList = warningRuleDetailList.stream().map(i->i.getRuleId()).collect(Collectors.toList());
         Set<Integer> ruleIdSet = new HashSet<>(ruleIdList);
             if(CollectionUtils.isNotEmpty(ruleIdSet)){
             List<Integer> resultList = new ArrayList<>();
@@ -868,6 +953,9 @@
                     );
                     if(this.processWarnFlag(wList,warningEventList)){
                         resultList.add(ruleId);
+                        if(returnEventList != null){
+                            returnEventList.addAll(warningEventList);
+                        }
                     };
                 }else{
                     List<WarningRuleDetail> wList = warningRuleDetails.stream().filter(i->i.getCode().equals(warningConfig.getKey()+"")).collect(Collectors.toList());
@@ -885,6 +973,9 @@
                         );
                         if(this.processWarnFlag(wList,warningEventList)){
                             resultList.add(ruleId);
+                            if(returnEventList != null){
+                                returnEventList.addAll(warningEventList);
+                            }
                         }
                     }
                 }
@@ -892,10 +983,14 @@
             return resultList;
         }
             return new ArrayList<>();
+    }
+
+    public List<Integer> processWarnFront(Constants.WarningConfig warningConfig){
+
+        return  this.processWarnFrontWithEvent(warningConfig,null);
 
 
     }
-
 
 
     /**
@@ -1017,6 +1112,15 @@
                         //                    StringUtils.join(memberList.stream().filter(i->StringUtils.isNotBlank(i.getDdId())).map(i->i.getDdId()).collect(Collectors.toList()),","),
                         //                dingTalk.getAlarmNoticeMsg(warningPush.getRegion(),DateUtil.getCurrDateTime(),warningConfig.getInfo()));
 //                    warningPush.setStatus(noticeFlag?Constants.ONE:Constants.TWO);
+                        List<String> ddUserIdList = memberList.stream().filter(i->StringUtils.isNotBlank(i.getDdId())).map(i->i.getDdId()).collect(Collectors.toList());
+                        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ddUserIdList)){
+                            for (String ddUserId:ddUserIdList) {
+                                this.getJDYData(warningEvent,ddUserId,
+                                        systemDictDataBiz.queryByCode(Constants.JDY_CONFIG,Constants.JDY_ENTRY_ID).getCode()
+
+                                );
+                            }
+                        }
                     }
                     warningPushMapper.insert(warningPush);
                     warningEvent.setStatus(Constants.ONE);

--
Gitblit v1.9.3