rk
9 小时以前 6ae086d3b199c4aa7cb4d594c9b594530eb5e3f8
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetGridServiceImpl.java
@@ -28,12 +28,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 +711,16 @@
                            //                    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.API_KEY).getCode(),
                                            systemDictDataBiz.queryByCode(Constants.JDY_CONFIG,Constants.APPID).getCode(),
                                            systemDictDataBiz.queryByCode(Constants.JDY_CONFIG,Constants.ENTRY_ID).getCode()
                                    );
                                }
                            }
                        }
                        warningPushMapper.insert(warningPush);
                        warningEvent.setStatus(Constants.ONE);
@@ -739,6 +751,68 @@
                }
            }
        }
    }
    /**
     * 简道云消息推送 定制
     * @param warningEvent
     * @param ddUserId 接收人 钉钉主键
     * @param jdyApiKey  简单云APIKEY
     * @param appid  应用ID
     * @param entryId 表单ID
     * @throws IOException
     */
    public void getJDYData(WarningEvent warningEvent,String ddUserId,String jdyApiKey,String appid,String entryId) throws IOException {
        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("https://api.jiandaoyun.com/api/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));
    }
    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;
    }
@@ -1027,6 +1101,17 @@
                        //                    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.API_KEY).getCode(),
                                        systemDictDataBiz.queryByCode(Constants.JDY_CONFIG,Constants.APPID).getCode(),
                                        systemDictDataBiz.queryByCode(Constants.JDY_CONFIG,Constants.ENTRY_ID).getCode()
                                );
                            }
                        }
                    }
                    warningPushMapper.insert(warningPush);
                    warningEvent.setStatus(Constants.ONE);