From ef6499ac58f7b0ea357295912da3f753d2af1773 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 06 三月 2026 10:02:37 +0800
Subject: [PATCH] 更改头部

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java |  819 ++-------------------------------------------------------
 1 files changed, 39 insertions(+), 780 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
index 34f3fb1..756854a 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
@@ -15,7 +15,6 @@
 import com.doumee.core.dingTalk.DingTalk;
 import com.doumee.core.erp.ErpConstants;
 import com.doumee.core.erp.model.openapi.request.erp.OrgListRequest;
-import com.doumee.core.erp.model.openapi.response.erp.ERPApiResponse;
 import com.doumee.core.erp.model.openapi.response.erp.ErpOrgListResponse;
 import com.doumee.core.exception.BusinessException;
 import com.doumee.core.haikang.model.HKConstants;
@@ -50,7 +49,6 @@
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
-import org.checkerframework.checker.units.qual.C;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -196,6 +194,7 @@
 
         return false;
     }
+
 
     private OrgAddRequest getOrgAddModel(Company c ) {
         OrgAddRequest model = new OrgAddRequest();
@@ -807,11 +806,7 @@
                     deptIdList.add(deptId);
                 }
                 if(CollectionUtils.isNotEmpty(deptIdList)){
-                    syncDelCompany( companyMapper.selectList(new QueryWrapper<Company>()
-                            .lambda()
-                            .eq(Company::getIsdeleted,Constants.ZERO)
-                            .in(Company::getErpId,deptIdList)
-                    ));
+                    syncDelCompany(deptIdList);
                 }
             }else if(eventType.equals("org_dept_create")||eventType.equals("org_dept_modify")){
                 for (int i = 0; i < jsonArray.size(); i++) {
@@ -863,7 +858,7 @@
                     .in(Company::getId, delIds)
                     .notIn(fIds.size()>0,Company::getHkId, fIds));
             companyMapper.update(null,new UpdateWrapper<Company>().lambda()
-                    .set(Company::getHkStatus,Constants.ZERO)
+                    .set(Company::getHkStatus,Constants.TWO)
                     .set(Company::getHkDate,date)
                     .in(Company::getId, delIds)
                     .in(fIds.size()>0,Company::getHkId, fIds));
@@ -877,7 +872,7 @@
             if(list !=null && list.size()>0){
                 List<Company> addList = new ArrayList<>();
                 List<Company> updateList = new ArrayList<>();
-                List<Company> delIds = new ArrayList<>();//淇敼涓轰娇鐢ㄩ拤閽塱d  erpId
+                List<Long> delIds = new ArrayList<>();//淇敼涓轰娇鐢ㄩ拤閽塱d  erpId
                 List<Company>  allList = companyMapper.selectList(new QueryWrapper<Company>().lambda()
                         .eq(Company::getIsdeleted,Constants.ZERO).eq(Company::getType,Constants.ONE));
                 dealCompanyChangeList(list,addList,updateList,delIds,allList);
@@ -896,28 +891,20 @@
     @Override
     public String syncJdyCompany() {
         //{
-        //  "dept_no": 1,//鏁板瓧 1 涓烘牴閮ㄩ棬缂栧彿銆�483636217锛氳姕婀栧競鍏徃
+        //  "dept_no": 1,//鏁板瓧 1 涓烘牴閮ㄩ棬缂栧彿銆�
         //  "has_child": true
         //}
-        DeptApiClient deptApiClient = new DeptApiClient(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_API_KEY).getCode()
-                ,systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_API_HOST).getCode());
+        DeptApiClient deptApiClient = new DeptApiClient(HttpConstant.API_KEY, HttpConstant.HOST);
         try {
-            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());
+            Map<String, Object> result =  deptApiClient.deptList(1,true,deptApiClient.getDefaultVersion());
             if(result!=null && result.get("departments")!=null ){
                 TypeReference<List<DeptEntityModel>> typeReference =     new TypeReference<List<DeptEntityModel>>(){};
                 Object obj = result.get("departments");
                 List<DeptEntityModel> list =  com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(obj), typeReference.getType());
-                list = sortJdyListBYParent(list,root);
                 if(list !=null && list.size()>0){
                     List<Company> addList = new ArrayList<>();
                     List<Company> updateList = new ArrayList<>();
-                    List<Company> delIds = new ArrayList<>();//淇敼涓轰娇鐢ㄩ拤閽塱d  erpId
+                    List<Long> delIds = new ArrayList<>();//淇敼涓轰娇鐢ㄩ拤閽塱d  erpId
                     List<Company>  allList = companyMapper.selectList(new QueryWrapper<Company>().lambda()
                             .eq(Company::getIsdeleted,Constants.ZERO).eq(Company::getType,Constants.ONE));
                     dealCompanyChangeListJdy(list,addList,updateList,delIds,allList);
@@ -926,754 +913,18 @@
                     }
                     return "鍚屾鏁版嵁锛氭柊澧炪��"+addList.size()+"銆戞潯锛屾洿鏂般��"+updateList.size()+"銆戞潯锛屽垹闄ゃ��"+delIds.size()+"銆戞潯";
                 }else{
-                    throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "鍚屾绠�鍗曚簯鏁版嵁涓虹┖锛�");
+                    throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "鍚屾閽夐拤鏁版嵁涓虹┖锛�");
                 }
             }
-        }catch (BusinessException e){
-            throw  e;
         }catch (Exception e){
-            throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "鍚屾鏁版嵁寮傚父锛�"+e.getMessage());
+            e.printStackTrace();
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "鍚屾鏁版嵁寮傚父锛�");
         }
+
         return null;
     }
 
-    private List<DeptEntityModel> sortJdyListBYParent(List<DeptEntityModel> list, int root) {
-        List<DeptEntityModel> all = new ArrayList<>();
-        for(DeptEntityModel t : list){
-            if(Constants.equalsInteger( t.getParent_no(),root)){
-                all.add(t);
-                if(hasChildCompany(list,t.getDept_no())){
-                    all.addAll(sortJdyListBYParent(list,t.getDept_no()));
-                }
-            }
-        }
-        return  all;
-    }
-
-
-    private boolean hasChildCompany(List<DeptEntityModel> list, Integer deptNo) {
-        for(DeptEntityModel t : list){
-            if(Constants.equalsInteger( t.getParent_no(),deptNo)){
-               return true;
-            }
-        }
-        return  false;
-    }
-
-    public static void main(String[] args) {
-        String temp = " [{" +
-                "\"dept_no\": 567064650," +
-                "\"name\": \"瀹¤娲鹃┗鍔瀄"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567064650\"" +
-                "}, {" +
-                "\"dept_no\": 567086523," +
-                "\"name\": \"姹熷寳鍒嗗眬\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567086523\"" +
-                "}, {" +
-                "\"dept_no\": 567354485," +
-                "\"name\": \"绂诲矖閫�鍏讳汉鍛榎"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567354485\"" +
-                "}, {" +
-                "\"dept_no\": 567303494," +
-                "\"name\": \"绾鐩戝療瀹わ紙宸″療棰嗗灏忕粍鍔炲叕瀹わ級\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567303494\"" +
-                "}, {" +
-                "\"dept_no\": 566874731," +
-                "\"name\": \"鏃犱负甯傚眬绂婚��浼戝姙\"," +
-                "\"parent_no\": 566426902," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566874731\"" +
-                "}, {" +
-                "\"dept_no\": 566426902," +
-                "\"name\": \"绂婚��浼戜汉鍛樺\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566426902\"" +
-                "}, {" +
-                "\"dept_no\": 566981590," +
-                "\"name\": \"鐗╂祦涓績\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566981590\"" +
-                "}, {" +
-                "\"dept_no\": 566499662," +
-                "\"name\": \"鏃犱负甯傚眬锛堣惀閿�閮級\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566499662\"" +
-                "}, {" +
-                "\"dept_no\": 567258434," +
-                "\"name\": \"婀炬矚鍖哄眬锛堣惀閿�閮級\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567258434\"" +
-                "}, {" +
-                "\"dept_no\": 567458554," +
-                "\"name\": \"涓撳崠鐩戠潱绠$悊绉戯紙鍐呴儴涓撳崠绠$悊鐩戠潱绉戙�佺ń鏌ユ敮闃燂級\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567458554\"" +
-                "}, {" +
-                "\"dept_no\": 567139640," +
-                "\"name\": \"婀炬矚鍖哄眬绂婚��浼戝姙\"," +
-                "\"parent_no\": 566426902," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567139640\"" +
-                "}, {" +
-                "\"dept_no\": 566379775," +
-                "\"name\": \"淇℃伅涓績\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566379775\"" +
-                "}, {" +
-                "\"dept_no\": 567298538," +
-                "\"name\": \"浼佷笟绠$悊绉慭"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567298538\"" +
-                "}, {" +
-                "\"dept_no\": 567073617," +
-                "\"name\": \"鍔炲叕瀹"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567073617\"" +
-                "}, {" +
-                "\"dept_no\": 566496812," +
-                "\"name\": \"绻佹槍鍖哄眬绂婚��浼戝姙\"," +
-                "\"parent_no\": 566426902," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566496812\"" +
-                "}, {" +
-                "\"dept_no\": 566643894," +
-                "\"name\": \"鍗楅櫟鍘垮眬绂婚��浼戝姙\"," +
-                "\"parent_no\": 566426902," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566643894\"" +
-                "}, {" +
-                "\"dept_no\": 566699927," +
-                "\"name\": \"娉曡绉戯紙瑙勮寖绠$悊鍔炲叕瀹わ級\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566699927\"" +
-                "}, {" +
-                "\"dept_no\": 567034633," +
-                "\"name\": \"鍏氬缓缇ゅ洟绉戯紙宸ヤ細鍔炲叕瀹わ級\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567034633\"" +
-                "}, {" +
-                "\"dept_no\": 567095650," +
-                "\"name\": \"甯傚眬锛堝叕鍙革級棰嗗\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567095650\"" +
-                "}, {" +
-                "\"dept_no\": 566464722," +
-                "\"name\": \"璐㈠姟绠$悊绉慭"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566464722\"" +
-                "}, {" +
-                "\"dept_no\": 567249497," +
-                "\"name\": \"鑺滄箹甯傚眬鐩村睘鍒嗗眬\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567249497\"" +
-                "}, {" +
-                "\"dept_no\": 567266572," +
-                "\"name\": \"鍗楅櫟鍘垮眬锛堣惀閿�閮級\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567266572\"" +
-                "}, {" +
-                "\"dept_no\": 567394584," +
-                "\"name\": \"绂婚��浼戜汉鍛樺\"," +
-                "\"parent_no\": 566426902," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567394584\"" +
-                "}, {" +
-                "\"dept_no\": 566952603," +
-                "\"name\": \"瀹夊叏绠$悊绉慭"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566952603\"" +
-                "}, {" +
-                "\"dept_no\": 567418536," +
-                "\"name\": \"绻佹槍鍖哄眬锛堣惀閿�閮級\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567418536\"" +
-                "}, {" +
-                "\"dept_no\": 567080624," +
-                "\"name\": \"钀ラ攢涓績\"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567080624\"" +
-                "}, {" +
-                "\"dept_no\": 567395495," +
-                "\"name\": \"浜哄姏璧勬簮绉慭"," +
-                "\"parent_no\": 483636217," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567395495\"" +
-                "}, {" +
-                "\"dept_no\": 566852695," +
-                "\"name\": \"鏃犱负甯傚眬锛堣惀閿�閮級鍔炲叕瀹"," +
-                "\"parent_no\": 566499662," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566852695\"" +
-                "}, {" +
-                "\"dept_no\": 566597911," +
-                "\"name\": \"鏃犱负甯傚眬锛堣惀閿�閮級瑗勫畨鐑熻崏涓撳崠绠$悊鎵�锛堟湇鍔$珯銆佺ń鏌ヤ腑闃燂級\"," +
-                "\"parent_no\": 566499662," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566597911\"" +
-                "}, {" +
-                "\"dept_no\": 567383562," +
-                "\"name\": \"鏃犱负甯傚眬锛堣惀閿�閮級瀹㈡埛鏈嶅姟閮╘"," +
-                "\"parent_no\": 566499662," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567383562\"" +
-                "}, {" +
-                "\"dept_no\": 566596757," +
-                "\"name\": \"棰嗗鐝瓙\"," +
-                "\"parent_no\": 566499662," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566596757\"" +
-                "}, {" +
-                "\"dept_no\": 567126588," +
-                "\"name\": \"鏃犱负甯傚眬锛堣惀閿�閮級鍩庡尯鐑熻崏涓撳崠绠$悊鎵�锛堟湇鍔$珯銆佺ń鏌ヤ腑闃燂級\"," +
-                "\"parent_no\": 566499662," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567126588\"" +
-                "}, {" +
-                "\"dept_no\": 567423457," +
-                "\"name\": \"鏃犱负甯傚眬锛堣惀閿�閮級鐩戝療娉曡鍔瀄"," +
-                "\"parent_no\": 566499662," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567423457\"" +
-                "}, {" +
-                "\"dept_no\": 567444447," +
-                "\"name\": \"鏃犱负甯傚眬锛堣惀閿�閮級楂樻矡鐑熻崏涓撳崠绠$悊鎵�锛堟湇鍔$珯銆佺ń鏌ヤ腑闃燂級\"," +
-                "\"parent_no\": 566499662," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567444447\"" +
-                "}, {" +
-                "\"dept_no\": 566688696," +
-                "\"name\": \"鏃犱负甯傚眬锛堣惀閿�閮級涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級\"," +
-                "\"parent_no\": 566499662," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566688696\"" +
-                "}, {" +
-                "\"dept_no\": 567308492," +
-                "\"name\": \"鍗楅櫟鍘垮眬锛堣惀閿�閮級涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級琛屽姩缁刓"," +
-                "\"parent_no\": 567266572," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567308492\"" +
-                "}, {" +
-                "\"dept_no\": 567311569," +
-                "\"name\": \"涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級琛屽姩缁刓"," +
-                "\"parent_no\": 566499662," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567311569\"" +
-                "}, {" +
-                "\"dept_no\": 566586834," +
-                "\"name\": \"鐗╂祦涓績鍌ㄩ厤閮╘"," +
-                "\"parent_no\": 566981590," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566586834\"" +
-                "}, {" +
-                "\"dept_no\": 567052635," +
-                "\"name\": \"绋芥煡闃焅"," +
-                "\"parent_no\": 566930600," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567052635\"" +
-                "}, {" +
-                "\"dept_no\": 567250603," +
-                "\"name\": \"涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級琛屽姩缁刓"," +
-                "\"parent_no\": 567418536," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567250603\"" +
-                "}, {" +
-                "\"dept_no\": 566714645," +
-                "\"name\": \"鐗╂祦涓績閫佽揣閮╘"," +
-                "\"parent_no\": 566981590," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566714645\"" +
-                "}, {" +
-                "\"dept_no\": 567400554," +
-                "\"name\": \"鐗╂祦涓績缁煎悎閮╘"," +
-                "\"parent_no\": 566981590," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567400554\"" +
-                "}, {" +
-                "\"dept_no\": 901575528," +
-                "\"name\": \"鐗╂祦涓績鎶�鏈儴\"," +
-                "\"parent_no\": 566981590," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"901575528\"" +
-                "}, {" +
-                "\"dept_no\": 567406402," +
-                "\"name\": \"鐗╂祦涓績瀹変繚閮╘"," +
-                "\"parent_no\": 566981590," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567406402\"" +
-                "}, {" +
-                "\"dept_no\": 667523393," +
-                "\"name\": \"鐗╂祦涓績棰嗗\"," +
-                "\"parent_no\": 566981590," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"667523393\"" +
-                "}, {" +
-                "\"dept_no\": 567052636," +
-                "\"name\": \"涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級琛屽姩缁刓"," +
-                "\"parent_no\": 567249497," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567052636\"" +
-                "}, {" +
-                "\"dept_no\": 567351557," +
-                "\"name\": \"鐗╂祦涓績涓浆绔橽"," +
-                "\"parent_no\": 566981590," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567351557\"" +
-                "}, {" +
-                "\"dept_no\": 567052634," +
-                "\"name\": \"姹熷寳鍒嗗眬鍔炲叕瀹"," +
-                "\"parent_no\": 567086523," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567052634\"" +
-                "}, {" +
-                "\"dept_no\": 567359469," +
-                "\"name\": \"鍝佺墝閮╘"," +
-                "\"parent_no\": 567080624," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567359469\"" +
-                "}, {" +
-                "\"dept_no\": 821923828," +
-                "\"name\": \"缁煎悎閮╘"," +
-                "\"parent_no\": 567080624," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"821923828\"" +
-                "}, {" +
-                "\"dept_no\": 567151607," +
-                "\"name\": \"姹熷寳鍒嗗眬涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級\"," +
-                "\"parent_no\": 567086523," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567151607\"" +
-                "}, {" +
-                "\"dept_no\": 567297546," +
-                "\"name\": \"甯傚満閮╘"," +
-                "\"parent_no\": 567080624," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567297546\"" +
-                "}, {" +
-                "\"dept_no\": 566867618," +
-                "\"name\": \"缁堢閮╘"," +
-                "\"parent_no\": 567080624," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566867618\"" +
-                "}, {" +
-                "\"dept_no\": 567314532," +
-                "\"name\": \"璁㈠崟閮╘"," +
-                "\"parent_no\": 567080624," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567314532\"" +
-                "}, {" +
-                "\"dept_no\": 566848639," +
-                "\"name\": \"姹熷寳鍒嗗眬鐩戝療娉曡鍔瀄"," +
-                "\"parent_no\": 567086523," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566848639\"" +
-                "}, {" +
-                "\"dept_no\": 567272560," +
-                "\"name\": \"涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級瀵勯�掔粍\"," +
-                "\"parent_no\": 567258434," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567272560\"" +
-                "}, {" +
-                "\"dept_no\": 566564826," +
-                "\"name\": \"涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級琛屽姩缁刓"," +
-                "\"parent_no\": 567258434," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566564826\"" +
-                "}, {" +
-                "\"dept_no\": 567471441," +
-                "\"name\": \"姹熷寳鍒嗗眬瀹㈡埛鏈嶅姟閮╘"," +
-                "\"parent_no\": 567086523," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567471441\"" +
-                "}, {" +
-                "\"dept_no\": 711701716," +
-                "\"name\": \"姹熷寳鍒嗗眬鍩庡寳鐑熻崏涓撳崠绠$悊鎵�锛堟湇鍔$珯锛塡"," +
-                "\"parent_no\": 567086523," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"711701716\"" +
-                "}, {" +
-                "\"dept_no\": 567103611," +
-                "\"name\": \"棰嗗鐝瓙\"," +
-                "\"parent_no\": 567086523," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567103611\"" +
-                "}, {" +
-                "\"dept_no\": 664801291," +
-                "\"name\": \"姹熷寳鍒嗗眬浜屽潩鐑熻崏涓撳崠绠$悊鎵�锛堟湇鍔$珯锛塡"," +
-                "\"parent_no\": 567086523," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"664801291\"" +
-                "}, {" +
-                "\"dept_no\": 566323801," +
-                "\"name\": \"婀炬矚鍖哄眬锛堣惀閿�閮級鍔炲叕瀹"," +
-                "\"parent_no\": 567258434," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566323801\"" +
-                "}, {" +
-                "\"dept_no\": 567343637," +
-                "\"name\": \"婀炬矚鍖哄眬锛堣惀閿�閮級鍩庡尯鐑熻崏涓撳崠绠$悊鎵�锛堟湇鍔$珯銆佺ń鏌ヤ腑闃燂級\"," +
-                "\"parent_no\": 567258434," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567343637\"" +
-                "}, {" +
-                "\"dept_no\": 567087584," +
-                "\"name\": \"婀炬矚鍖哄眬锛堣惀閿�閮級鐩戝療娉曡鍔瀄"," +
-                "\"parent_no\": 567258434," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567087584\"" +
-                "}, {" +
-                "\"dept_no\": 567058556," +
-                "\"name\": \"瀹㈡埛鏈嶅姟閮╘"," +
-                "\"parent_no\": 567249497," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567058556\"" +
-                "}, {" +
-                "\"dept_no\": 566930600," +
-                "\"name\": \"涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級\"," +
-                "\"parent_no\": 567249497," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566930600\"" +
-                "}, {" +
-                "\"dept_no\": 566592977," +
-                "\"name\": \"涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級琛屽姩缁刓"," +
-                "\"parent_no\": 567086523," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566592977\"" +
-                "}, {" +
-                "\"dept_no\": 567283502," +
-                "\"name\": \"棰嗗鐝瓙\"," +
-                "\"parent_no\": 567249497," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567283502\"" +
-                "}, {" +
-                "\"dept_no\": 567571030," +
-                "\"name\": \"鐩戝療娉曡鍔瀄"," +
-                "\"parent_no\": 567249497," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567571030\"" +
-                "}, {" +
-                "\"dept_no\": 566605742," +
-                "\"name\": \"婀炬矚鍖哄眬锛堣惀閿�閮級瀹㈡埛鏈嶅姟閮╘"," +
-                "\"parent_no\": 567258434," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566605742\"" +
-                "}, {" +
-                "\"dept_no\": 567044634," +
-                "\"name\": \"棰嗗鐝瓙\"," +
-                "\"parent_no\": 567258434," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567044634\"" +
-                "}, {" +
-                "\"dept_no\": 566835635," +
-                "\"name\": \"鍔炲叕瀹"," +
-                "\"parent_no\": 567249497," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566835635\"" +
-                "}, {" +
-                "\"dept_no\": 566844724," +
-                "\"name\": \"鍩庡崡鐑熻崏涓撳崠绠$悊鎵�锛堟湇鍔$珯銆佺ń鏌ヤ腑闃燂級\"," +
-                "\"parent_no\": 567249497," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566844724\"" +
-                "}, {" +
-                "\"dept_no\": 566633782," +
-                "\"name\": \"棰嗗鐝瓙\"," +
-                "\"parent_no\": 567266572," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566633782\"" +
-                "}, {" +
-                "\"dept_no\": 566884644," +
-                "\"name\": \"鍗楅櫟鍘垮眬锛堣惀閿�閮級瀹㈡埛鏈嶅姟閮╘"," +
-                "\"parent_no\": 567266572," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566884644\"" +
-                "}, {" +
-                "\"dept_no\": 566656760," +
-                "\"name\": \"鍗楅櫟鍘垮眬锛堣惀閿�閮級涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級\"," +
-                "\"parent_no\": 567266572," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566656760\"" +
-                "}, {" +
-                "\"dept_no\": 567127606," +
-                "\"name\": \"婀炬矚鍖哄眬锛堣惀閿�閮級涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級\"," +
-                "\"parent_no\": 567258434," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567127606\"" +
-                "}, {" +
-                "\"dept_no\": 566965621," +
-                "\"name\": \"鍗楅櫟鍘垮眬锛堣惀閿�閮級鐩戝療娉曡鍔瀄"," +
-                "\"parent_no\": 567266572," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566965621\"" +
-                "}, {" +
-                "\"dept_no\": 566889723," +
-                "\"name\": \"鍗楅櫟鍘垮眬锛堣惀閿�閮級鍩庡尯鐑熻崏涓撳崠绠$悊鎵�锛堟湇鍔$珯銆佺ń鏌ヤ腑闃燂級\"," +
-                "\"parent_no\": 567266572," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566889723\"" +
-                "}, {" +
-                "\"dept_no\": 573565486," +
-                "\"name\": \"鍗楅櫟鍘垮眬锛堣惀閿�閮級鍔炲叕瀹"," +
-                "\"parent_no\": 567266572," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"573565486\"" +
-                "}, {" +
-                "\"dept_no\": 566880674," +
-                "\"name\": \"鍗楅櫟鍘垮眬绂诲矖閫�鍏讳汉鍛榎"," +
-                "\"parent_no\": 567354485," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566880674\"" +
-                "}, {" +
-                "\"dept_no\": 567176623," +
-                "\"name\": \"绻佹槍鍘垮眬绂诲矖閫�鍏讳汉鍛榎"," +
-                "\"parent_no\": 567354485," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567176623\"" +
-                "}, {" +
-                "\"dept_no\": 567314533," +
-                "\"name\": \"鑺滄箹甯傚眬绂诲矖閫�鍏讳汉鍛榎"," +
-                "\"parent_no\": 567354485," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567314533\"" +
-                "}, {" +
-                "\"dept_no\": 567340287," +
-                "\"name\": \"鏃犱负鍘垮眬绂诲矖閫�鍏讳汉鍛榎"," +
-                "\"parent_no\": 567354485," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567340287\"" +
-                "}, {" +
-                "\"dept_no\": 566636715," +
-                "\"name\": \"鑺滄箹鍘垮眬绂诲矖閫�鍏讳汉鍛榎"," +
-                "\"parent_no\": 567354485," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566636715\"" +
-                "}, {" +
-                "\"dept_no\": 567368506," +
-                "\"name\": \"绻佹槍鍖哄眬锛堣惀閿�閮級鐩戝療娉曡鍔瀄"," +
-                "\"parent_no\": 567418536," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567368506\"" +
-                "}, {" +
-                "\"dept_no\": 567354486," +
-                "\"name\": \"绻佹槍鍖哄眬锛堣惀閿�閮級鍔炲叕瀹"," +
-                "\"parent_no\": 567418536," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567354486\"" +
-                "}, {" +
-                "\"dept_no\": 566960827," +
-                "\"name\": \"绻佹槍鍖哄眬锛堣惀閿�閮級涓撳崠鐩戠潱绠$悊鍔炲叕瀹わ紙鍐呴儴涓撳崠绠$悊鐩戠潱鍔炲叕瀹ゃ�佺ń鏌ュぇ闃燂級\"," +
-                "\"parent_no\": 567418536," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566960827\"" +
-                "}, {" +
-                "\"dept_no\": 566649730," +
-                "\"name\": \"绻佹槍鍖哄眬锛堣惀閿�閮級鍩庡尯鐑熻崏涓撳崠绠$悊鎵�锛堟湇鍔$珯銆佺ń鏌ヤ腑闃燂級\"," +
-                "\"parent_no\": 567418536," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566649730\"" +
-                "}, {" +
-                "\"dept_no\": 566455834," +
-                "\"name\": \"绻佹槍鍖哄眬锛堣惀閿�閮級瀹㈡埛鏈嶅姟閮╘"," +
-                "\"parent_no\": 567418536," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566455834\"" +
-                "}, {" +
-                "\"dept_no\": 566975648," +
-                "\"name\": \"棰嗗鐝瓙\"," +
-                "\"parent_no\": 567418536," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"566975648\"" +
-                "}, {" +
-                "\"dept_no\": 822153494," +
-                "\"name\": \"鍖哄煙鍒嗕腑蹇僜"," +
-                "\"parent_no\": 567458554," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"822153494\"" +
-                "}, {" +
-                "\"dept_no\": 567328559," +
-                "\"name\": \"涓撳崠鐩戠潱绠$悊绉戯紙鍐呴儴涓撳崠绠$悊鐩戠潱绉戙�佺ń鏌ユ敮闃燂級琛屽姩缁刓"," +
-                "\"parent_no\": 567458554," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567328559\"" +
-                "}, {" +
-                "\"dept_no\": 567476616," +
-                "\"name\": \"涓撳崠鐩戠潱绠$悊绉戯紙鍐呴儴涓撳崠绠$悊鐩戠潱绉戙�佺ń鏌ユ敮闃燂級鏁版嵁鍒嗘瀽缁刓"," +
-                "\"parent_no\": 567458554," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"567476616\"" +
-                "}, {" +
-                "\"dept_no\": 821950791," +
-                "\"name\": \"鐜板満妫�鏌ョ粍\"," +
-                "\"parent_no\": 822153494," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"821950791\"" +
-                "}, {" +
-                "\"dept_no\": 922652428," +
-                "\"name\": \"缁煎悎绠$悊缁刓"," +
-                "\"parent_no\": 822153494," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"922652428\"" +
-                "}, {" +
-                "\"dept_no\": 822188538," +
-                "\"name\": \"鏁版嵁鍒嗘瀽缁刓"," +
-                "\"parent_no\": 822153494," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"822188538\"" +
-                "}, {" +
-                "\"dept_no\": 981649568," +
-                "\"name\": \"閮ㄩ棬棰嗗\"," +
-                "\"parent_no\": 567080624," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"981649568\"" +
-                "}, {" +
-                "\"dept_no\": 982346282," +
-                "\"name\": \"閮ㄩ棬棰嗗\"," +
-                "\"parent_no\": 567458554," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"982346282\"" +
-                "}, {" +
-                "\"dept_no\": 998004621," +
-                "\"name\": \"閮ㄩ棬棰嗗\"," +
-                "\"parent_no\": 822153494," +
-                "\"type\": 0," +
-                "\"status\": 1," +
-                "\"integrate_id\": \"998004621\"" +
-                "}]" ;
-       TypeReference typeReference =
-                new TypeReference<     List<DeptEntityModel> >() {
-                };
-         List<DeptEntityModel> list = com.alibaba.fastjson.JSONObject.parseObject(temp, typeReference.getType());
-        CompanyServiceImpl obj = new CompanyServiceImpl();
-        list = obj.sortJdyListBYParent(list,483636217);
-        list.size();
-
-    }
-
-    private void dealCompanyChangeListJdy(List<DeptEntityModel> list, List<Company> addList, List<Company> updateList,
-                                          List<Company> delIds, List<Company> allList) {
+    private void dealCompanyChangeListJdy(List<DeptEntityModel> list, List<Company> addList, List<Company> updateList, List<Long> delIds, List<Company> allList) {
         Date date = new Date();
         for(DeptEntityModel respone : list){
             Company param = new Company();
@@ -1684,6 +935,7 @@
             //鏍规嵁erpid鏌ヨ浼佷笟淇℃伅锛屽垽鏂槸鏂板杩樻槸鏇存柊
             Company company = findCompanyByERPId(allList,respone.getDept_no().toString());
             if(company == null){
+                //濡傛灉鏄柊澧�
                 //灏佽鏂板缁勭粐瀵硅薄鏁版嵁
                 addList.add(getAddCompanyModel(param));
             }else{
@@ -1693,13 +945,12 @@
         if(allList!=null && allList.size()>0){
             for(Company  c : allList){
                 if(!isCompanyDeletedJdy(c,list)){
-                    delIds.add(c);
+                    delIds.add(Long.valueOf(c.getErpId()));
                 }
             }
         }
     }
-    private void dealCompanyChangeList(List<OapiV2DepartmentGetResponse.DeptGetResponse> list, List<Company> addList,
-                                       List<Company> updateList, List<Company> delIds, List<Company> allList) {
+    private void dealCompanyChangeList(List<OapiV2DepartmentGetResponse.DeptGetResponse> list, List<Company> addList, List<Company> updateList, List<Long> delIds, List<Company> allList) {
         Date date = new Date();
         for(OapiV2DepartmentGetResponse.DeptGetResponse respone : list){
             Company param = new Company();
@@ -1720,11 +971,12 @@
         if(allList!=null && allList.size()>0){
             for(Company  c : allList){
                 if(!isCompanyDeleted(c,list)){
-                    delIds.add(c);
+                    delIds.add(Long.valueOf(c.getErpId()));
                 }
             }
         }
     }
+
 
     /**
      * 鏁寸悊閽夐拤鍚屾 鏂板缁勭粐瀵硅薄
@@ -1743,6 +995,7 @@
     private Company getUpdateCompanyModel(Company param, Company company) {
         return syncDDEditCompanyModel(param,company);
     }
+
 
     /**
      * 鏍规嵁ERPID  鍒ゆ柇鏁版嵁鏄惁宸插湪闆嗗悎閲屽瓨鍦�
@@ -1790,6 +1043,10 @@
         company.setIsdeleted(Constants.ZERO);
         company.setStatus(Constants.ZERO);
 
+//        company.setName(deptGetResponse.getName());
+//        company.setErpId(deptGetResponse.getDeptId().toString());
+//        company.setErpParentId(deptGetResponse.getParentId().toString());
+//        company.setSortnum(deptGetResponse.getOrder().intValue());//榛樿鏈�涓婇潰
         company.setName(param.getName());
         company.setErpId(param.getErpId() );
         company.setErpParentId(param.getErpParentId());
@@ -1797,19 +1054,22 @@
 
         company.setType(Constants.ONE);
         String rootOrgId = systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_ROOTORG_CODE).getCode();
-        String jdyRootId = systemDictDataBiz.queryByCode(Constants.JDY_CONFIG,Constants.JDY_COMPANY_ROOT_NO).getCode();
-        Company root =getRootCompanyModel(rootOrgId,jdyRootId);
-        company.setHkParentId(rootOrgId);
+        Company root =getRootCompanyModel(rootOrgId);
         company.setCompanyPath(company.getId()+"/");//鍚嶇О璺緞
         company.setCompanyNamePath(company.getName());//鍚嶇О璺緞
+        company.setHkParentId(rootOrgId);
         String idPath = "";
-        if(StringUtils.isNotBlank(param.getErpParentId())){
-            Company parent = companyMapper.selectOne(new QueryWrapper<Company>().lambda().eq(Company::getErpId,param.getErpParentId())
+        if(StringUtils.isNotBlank(company.getErpParentId())){
+            Company parent = companyMapper.selectOne(new QueryWrapper<Company>().lambda().eq(Company::getErpId,company.getErpParentId())
                     .eq(Company::getIsdeleted,Constants.ZERO).last(" limit 1 "));
             if(parent == null || Constants.equalsInteger(parent.getIsdeleted(),Constants.ONE)){
                 //鐖剁骇涓嶅瓨鍦ㄧ殑锛岀洿鎺ユ寕鍦ㄦ牴缁勭粐涓�
                 parent = root;
+//                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝鐖剁骇缁勭粐淇℃伅涓嶅瓨鍦▇");
             }
+//            if(StringUtils.isBlank(parent.getHkId())){
+//                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝鐖剁骇缁勭粐淇℃伅灏氭湭鍚屾涓嬪彂鎴愬姛~");
+//            }
             if(Objects.nonNull(parent.getType())&&!Constants.equalsInteger(parent.getType(),-1)){
                 if(!Constants.equalsInteger(company.getType(),parent.getType())){
                     throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝缁勭粐淇℃伅閿欒");
@@ -1854,7 +1114,7 @@
      * @param rootOrgId
      * @return
      */
-    private Company getRootCompanyModel(String rootOrgId,String erpId) {
+    private Company getRootCompanyModel(String rootOrgId) {
         Company root = companyMapper.selectOne(new QueryWrapper<Company>().lambda()
                 .eq(Company::getIsdeleted,Constants.ZERO)
                 .isNull(Company::getParentId)
@@ -1871,7 +1131,6 @@
             root.setHkStatus(Constants.ONE);
             root.setIsdeleted(Constants.ZERO);
             root.setStatus(Constants.ZERO);
-            root.setErpId(erpId);
             root.setHkCompanyPath(rootOrgId+"/");
             root.setCompanyNamePath(root.getName());
             root.setHkDate(new Date());
@@ -1888,8 +1147,7 @@
     public Company syncDDEditCompanyModel(Company param,Company company){
         company.setErpParentId(param.getErpParentId().toString());
         String rootOrgId = systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_ROOTORG_CODE).getCode();
-        String jdyRootId = systemDictDataBiz.queryByCode(Constants.JDY_CONFIG,Constants.JDY_COMPANY_ROOT_NO).getCode();
-        Company root =getRootCompanyModel(rootOrgId,jdyRootId);
+        Company root =getRootCompanyModel(rootOrgId);
         String idPath = "";
         if(StringUtils.isNotBlank(company.getErpParentId())){
             Company parent = companyMapper.selectOne(new QueryWrapper<Company>().lambda()
@@ -1900,7 +1158,7 @@
             if(parent == null || Constants.equalsInteger(parent.getIsdeleted(),Constants.ONE)){
               parent =root;
             }
-           /*if(Objects.nonNull(parent.getType())&&!Constants.equalsInteger(parent.getType(),-1)){
+       /*   if(Objects.nonNull(parent.getType())&&!Constants.equalsInteger(parent.getType(),-1)){
                 if(!Constants.equalsInteger(company.getType(),parent.getType())){
                     throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝缁勭粐淇℃伅閿欒");
                 }
@@ -1939,15 +1197,16 @@
 
 
 
-    public void syncDelCompany(List<Company> companyList ){
-/*        List<Company> companyList = companyMapper.selectList(new QueryWrapper<Company>()
+    public void syncDelCompany(List<Long> deptIdList){
+        List<Company> companyList = companyMapper.selectList(new QueryWrapper<Company>()
                 .lambda()
                 .eq(Company::getIsdeleted,Constants.ZERO)
-                .in(Company::getId,deptIdList)
-        );*/
+                .in(Company::getErpId,deptIdList)
+        );
         if(CollectionUtils.isNotEmpty(companyList)){
             List<Integer> delIds = companyList.stream().map(i->i.getId()).collect(Collectors.toList());
             List<String> delHKIds = companyList.stream().filter(i->StringUtils.isNotBlank(i.getHkId())).map(i->i.getHkId()).collect(Collectors.toList());
+
             //鏍囪涓氬姟鍒犻櫎
             companyMapper.update(new UpdateWrapper<Company>().lambda()
                     .set(Company::getIsdeleted,Constants.ONE)

--
Gitblit v1.9.3