| | |
| | | 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; |
| | |
| | | deptIdList.add(deptId); |
| | | } |
| | | if(CollectionUtils.isNotEmpty(deptIdList)){ |
| | | syncDelCompany(deptIdList); |
| | | syncDelCompany( companyMapper.selectList(new QueryWrapper<Company>() |
| | | .lambda() |
| | | .eq(Company::getIsdeleted,Constants.ZERO) |
| | | .in(Company::getErpId,deptIdList) |
| | | )); |
| | | } |
| | | }else if(eventType.equals("org_dept_create")||eventType.equals("org_dept_modify")){ |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | |
| | | .in(Company::getId, delIds) |
| | | .notIn(fIds.size()>0,Company::getHkId, fIds)); |
| | | companyMapper.update(null,new UpdateWrapper<Company>().lambda() |
| | | .set(Company::getHkStatus,Constants.TWO) |
| | | .set(Company::getHkStatus,Constants.ZERO) |
| | | .set(Company::getHkDate,date) |
| | | .in(Company::getId, delIds) |
| | | .in(fIds.size()>0,Company::getHkId, fIds)); |
| | |
| | | if(list !=null && list.size()>0){ |
| | | List<Company> addList = new ArrayList<>(); |
| | | List<Company> updateList = new ArrayList<>(); |
| | | List<Long> delIds = new ArrayList<>();//修改为使用钉钉id erpId |
| | | List<Company> delIds = new ArrayList<>();//修改为使用钉钉id 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); |
| | |
| | | // "dept_no": 1,//数字 1 为根部门编号。483636217:芜湖市公司 |
| | | // "has_child": true |
| | | //} |
| | | DeptApiClient deptApiClient = new DeptApiClient(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.API_KEY).getCode() |
| | | DeptApiClient deptApiClient = new DeptApiClient(systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_API_KEY).getCode() |
| | | ,systemDictDataBiz.queryByCode(Constants.JDY_CONFIG, Constants.JDY_API_HOST).getCode()); |
| | | try { |
| | | int root = 1; |
| | |
| | | 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<Long> delIds = new ArrayList<>();//修改为使用钉钉id erpId |
| | | List<Company> delIds = new ArrayList<>();//修改为使用钉钉id 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); |
| | |
| | | } |
| | | 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){ |
| | | e.printStackTrace(); |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "同步数据异常!"); |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "同步数据异常!"+e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private void dealCompanyChangeListJdy(List<DeptEntityModel> list, List<Company> addList, List<Company> updateList, List<Long> delIds, List<Company> allList) { |
| | | 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) { |
| | | Date date = new Date(); |
| | | for(DeptEntityModel respone : list){ |
| | | Company param = new Company(); |
| | |
| | | //根据erpid查询企业信息,判断是新增还是更新 |
| | | Company company = findCompanyByERPId(allList,respone.getDept_no().toString()); |
| | | if(company == null){ |
| | | //如果是新增 |
| | | //封装新增组织对象数据 |
| | | addList.add(getAddCompanyModel(param)); |
| | | }else{ |
| | |
| | | if(allList!=null && allList.size()>0){ |
| | | for(Company c : allList){ |
| | | if(!isCompanyDeletedJdy(c,list)){ |
| | | delIds.add(Long.valueOf(c.getErpId())); |
| | | delIds.add(c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | private void dealCompanyChangeList(List<OapiV2DepartmentGetResponse.DeptGetResponse> list, List<Company> addList, List<Company> updateList, List<Long> delIds, List<Company> allList) { |
| | | private void dealCompanyChangeList(List<OapiV2DepartmentGetResponse.DeptGetResponse> list, List<Company> addList, |
| | | List<Company> updateList, List<Company> delIds, List<Company> allList) { |
| | | Date date = new Date(); |
| | | for(OapiV2DepartmentGetResponse.DeptGetResponse respone : list){ |
| | | Company param = new Company(); |
| | |
| | | if(allList!=null && allList.size()>0){ |
| | | for(Company c : allList){ |
| | | if(!isCompanyDeleted(c,list)){ |
| | | delIds.add(Long.valueOf(c.getErpId())); |
| | | delIds.add(c); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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()); |
| | |
| | | |
| | | company.setType(Constants.ONE); |
| | | String rootOrgId = systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_ROOTORG_CODE).getCode(); |
| | | Company root =getRootCompanyModel(rootOrgId); |
| | | String jdyRootId = systemDictDataBiz.queryByCode(Constants.JDY_CONFIG,Constants.JDY_COMPANY_ROOT_NO).getCode(); |
| | | Company root =getRootCompanyModel(rootOrgId,jdyRootId); |
| | | company.setHkParentId(rootOrgId); |
| | | company.setCompanyPath(company.getId()+"/");//名称路径 |
| | | company.setCompanyNamePath(company.getName());//名称路径 |
| | | company.setHkParentId(rootOrgId); |
| | | String idPath = ""; |
| | | if(StringUtils.isNotBlank(company.getErpParentId())){ |
| | | Company parent = companyMapper.selectOne(new QueryWrapper<Company>().lambda().eq(Company::getErpId,company.getErpParentId()) |
| | | if(StringUtils.isNotBlank(param.getErpParentId())){ |
| | | Company parent = companyMapper.selectOne(new QueryWrapper<Company>().lambda().eq(Company::getErpId,param.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(),"对不起,组织信息错误"); |
| | |
| | | * @param rootOrgId |
| | | * @return |
| | | */ |
| | | private Company getRootCompanyModel(String rootOrgId) { |
| | | private Company getRootCompanyModel(String rootOrgId,String erpId) { |
| | | Company root = companyMapper.selectOne(new QueryWrapper<Company>().lambda() |
| | | .eq(Company::getIsdeleted,Constants.ZERO) |
| | | .isNull(Company::getParentId) |
| | |
| | | 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()); |
| | |
| | | public Company syncDDEditCompanyModel(Company param,Company company){ |
| | | company.setErpParentId(param.getErpParentId().toString()); |
| | | String rootOrgId = systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_ROOTORG_CODE).getCode(); |
| | | Company root =getRootCompanyModel(rootOrgId); |
| | | String jdyRootId = systemDictDataBiz.queryByCode(Constants.JDY_CONFIG,Constants.JDY_COMPANY_ROOT_NO).getCode(); |
| | | Company root =getRootCompanyModel(rootOrgId,jdyRootId); |
| | | String idPath = ""; |
| | | if(StringUtils.isNotBlank(company.getErpParentId())){ |
| | | Company parent = companyMapper.selectOne(new QueryWrapper<Company>().lambda() |
| | |
| | | |
| | | |
| | | |
| | | public void syncDelCompany(List<Long> deptIdList){ |
| | | List<Company> companyList = companyMapper.selectList(new QueryWrapper<Company>() |
| | | public void syncDelCompany(List<Company> companyList ){ |
| | | /* List<Company> companyList = companyMapper.selectList(new QueryWrapper<Company>() |
| | | .lambda() |
| | | .eq(Company::getIsdeleted,Constants.ZERO) |
| | | .in(Company::getErpId,deptIdList) |
| | | ); |
| | | .in(Company::getId,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) |