doum
2 天以前 d352184d3364e379da38e56d6aa53c1f53f517ca
最新版本541200007最新版本541200007
已修改9个文件
117 ■■■■■ 文件已修改
server/jiandaoyun_service/src/main/java/com/doumee/core/jiandaoyun/constants/HttpConstant.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/jiandaoyun_service/src/main/java/com/doumee/core/jiandaoyun/model/http/ApiClient.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/jiandaoyun_service/src/main/java/com/doumee/core/jiandaoyun/model/request/MemberPushData.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/system_service/src/main/java/com/doumee/core/utils/Constants.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetGridServiceImpl.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetLogServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/jiandaoyun_service/src/main/java/com/doumee/core/jiandaoyun/constants/HttpConstant.java
@@ -4,7 +4,8 @@
 * http 相关的常量
 */
public class HttpConstant {
    public static final String HOST = "https://api.jiandaoyun.com/api/";
//    public static final String HOST = "https://api.jiandaoyun.com/api/";
//    public static final String HOST = "https://lcdp.ahyc.com.cn:30443/api/";
    /**
     * 部门相关的接口前缀
server/jiandaoyun_service/src/main/java/com/doumee/core/jiandaoyun/model/http/ApiClient.java
@@ -1,5 +1,6 @@
package com.doumee.core.jiandaoyun.model.http;
import com.alibaba.fastjson.JSONObject;
import com.doumee.core.jiandaoyun.util.LimitUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
@@ -119,11 +120,12 @@
     */
    public Map<String, Object> sendPostRequest(HttpRequestParam param) throws Exception {
        if (param == null || StringUtils.isBlank(param.getPath())) {
            throw new RuntimeException("缺失参数!");
            throw new Exception("缺失参数!");
        }
        HttpClient client = getSSLHttpClient();
        Header[] headers = getHttpHeaders(this.getApiKey());
        String url = this.host + param.getPath();
        log.error("===简道云接口url:"+url);
        HttpRequestBase request = new HttpPost(url);
        // 请求参数
@@ -148,9 +150,11 @@
            result = (Map<String, Object>) mapper.readValue(response.getEntity().getContent(), Object.class);
        }
        if (statusCode >= 400) {
            throw new RuntimeException("请求错误,statusCode:" + statusCode + ",Error Code: " + result.get("code") + ", Error Msg: " + result.get("msg"));
            log.error("===简道云接口:请求错误,statusCode:" + statusCode + ",Error Code: " + result.get("code") + ", Error Msg: " + result.get("msg"));
            throw new Exception("请求错误,statusCode:" + statusCode + ",Error Code: " + result.get("code") + ", Error Msg: " + result.get("msg"));
        } else {
            // 处理返回结果
            log.error("===简道云接口:请求成功result:" + JSONObject.toJSONString(result));
            return result;
        }
    }
server/jiandaoyun_service/src/main/java/com/doumee/core/jiandaoyun/model/request/MemberPushData.java
@@ -16,6 +16,7 @@
    private String sex;
    private String job_date;
    private String can_visit;//可拜访 不可拜访
    private String master;//是 否
    private String phone;
    private String name;
    private String idcardno;
server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -65,6 +65,7 @@
    public static final String JDY_CAR_SECRET = " JDY_CAR_SECRET";
    public static final String JDY_SECRET ="JDY_SECRET";
    public static final String JDY_MEMBER_PUSH_STATUS_URL ="JDY_MEMBER_PUSH_STATUS_URL";
    public static final String JDY_API_HOST = "API_HOST";
    /**
     * 操作类型,用于做接口验证分组
@@ -92,6 +93,7 @@
    public static final String LOCATION ="LOCATION" ;
    public static final String API_KEY ="API_KEY" ;
    public static final String JDY_CONFIG ="JDY_CONFIG" ;
    public static final String JDY_COMPANY_ROOT_NO ="JDY_COMPANY_ROOT_NO" ;
    public static final String CABINET_CONFIG ="CABINET_CONFIG" ;
    public static final String BLOW_TIME ="BLOW_TIME" ;
    public static final String PRESSURE ="PRESSURE" ;
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
@@ -891,12 +891,19 @@
    @Override
    public String syncJdyCompany() {
        //{
        //  "dept_no": 1,//数字 1 为根部门编号。
        //  "dept_no": 1,//数字 1 为根部门编号。483636217:芜湖市公司
        //  "has_child": true
        //}
        DeptApiClient deptApiClient = new DeptApiClient(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.API_KEY).getCode(), HttpConstant.HOST);
        DeptApiClient deptApiClient = new DeptApiClient(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.API_KEY).getCode()
                ,systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_API_HOST).getCode());
        try {
            Map<String, Object> result =  deptApiClient.deptList(1,true,deptApiClient.getDefaultVersion());
            int root = 1;
            try {
                root = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_COMPANY_ROOT_NO).getCode());
            }catch (Exception e){
            }
            Map<String, Object> result =  deptApiClient.deptList(root,true,deptApiClient.getDefaultVersion());
            if(result!=null && result.get("departments")!=null ){
                TypeReference<List<DeptEntityModel>> typeReference =     new TypeReference<List<DeptEntityModel>>(){};
                Object obj = result.get("departments");
@@ -920,7 +927,6 @@
            e.printStackTrace();
            throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "同步数据异常!");
        }
        return null;
    }
@@ -977,7 +983,6 @@
        }
    }
    /**
     * 整理钉钉同步 新增组织对象
     * @return
@@ -995,7 +1000,6 @@
    private Company getUpdateCompanyModel(Company param, Company company) {
        return syncDDEditCompanyModel(param,company);
    }
    /**
     * 根据ERPID  判断数据是否已在集合里存在
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()
                                );
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetLogServiceImpl.java
@@ -270,8 +270,6 @@
                                if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ddUserIdList)){
                                    for (String ddUserId:ddUserIdList) {
                                        impl.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()
                                        );
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -2498,6 +2498,7 @@
                    .eq( Member::getType,Constants.TWO )
                    .last("limit 1"));
        }
        boolean addOrEdit = false;
        if(member == null){
            //新增人员
            if(data.getDeleter()!=null){
@@ -2506,6 +2507,7 @@
            }
            member = getAddOrUpdateModelFromJDY(data,true);
            this.create(member);
            addOrEdit=true;
        }else{
            //更新人员
            if(data.getDeleter()!=null){
@@ -2515,8 +2517,16 @@
                //更新人员信息
                Member updateMember =getAddOrUpdateModelFromJDY(data,false);
                updateMember.setId(member.getId());
                addOrEdit=true;
                this.updateById(updateMember);
            }
        }
        if(addOrEdit && Constants.equalsInteger(member.getHeadStatus(),Constants.ONE) && member.getCompanyModel()!=null){
            //如果是部门主管
            Company updateCom = new Company();
            updateCom.setHeadId(member.getId());
            updateCom.setId(member.getCompanyModel().getId());
            companyMapper.updateById(updateCom);//更新部门主管人员
        }
    }
@@ -2535,6 +2545,9 @@
        }
        if(StringUtils.isNotBlank(data.getCan_visit())){
            member.setCanVisit(StringUtils.equals(data.getCan_visit(),"可拜访")?1:0);
        }
        if(StringUtils.isNotBlank(data.getMaster())){
            member.setHeadStatus(StringUtils.equals(data.getMaster(),"是")?1:0);
        }
        member.setErpId(data.getUsername());
        if(data.getDepartment()!=null){
@@ -2609,7 +2622,8 @@
    @Override
    public String syncJdyUserInfo() {
        DeptApiClient deptApiClient = new DeptApiClient(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.API_KEY).getCode(), HttpConstant.HOST);
        DeptApiClient deptApiClient = new DeptApiClient(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.API_KEY).getCode()
                ,systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_API_HOST).getCode());
        try {
            Map<String, Object> result =  deptApiClient.deptMemberList(1,true,deptApiClient.getDefaultVersion());
            if(result!=null && result.get("users")!=null ){
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java
@@ -546,8 +546,6 @@
                                        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ddUserIdList)){
                                            for (String ddUserId:ddUserIdList) {
                                                impl.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()
                                                );