doum
3 天以前 d352184d3364e379da38e56d6aa53c1f53f517ca
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.*;
@@ -715,8 +718,6 @@
                            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()
                                    );
                                }
@@ -758,34 +759,44 @@
     * 简道云消息推送 定制
     * @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 void getJDYData(WarningEvent warningEvent,String ddUserId , String entryId)  {
        try {
            log.error("简道云发送通知返回信息开始"  );
            FormDataApiClient apiClient = new FormDataApiClient(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.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.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());
        }
    }
@@ -1105,8 +1116,6 @@
                        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()
                                );