From 1c20c8231980a8d4b91688ff8641a06d3b2f68ab Mon Sep 17 00:00:00 2001 From: MrShi <1878285526@qq.com> Date: 星期二, 14 十月 2025 16:34:22 +0800 Subject: [PATCH] 改bug --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java | 63 +++++++++++++++++++------------ 1 files changed, 39 insertions(+), 24 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 5f76792..b2edb5a 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 @@ -17,9 +17,9 @@ import com.doumee.core.haikang.model.param.respose.OrgOrUserAddResponse; import com.doumee.core.haikang.model.param.respose.OrgUpdateFailureResponse; import com.doumee.core.haikang.service.HKService; -import com.doumee.core.model.LoginUserInfo; -import com.doumee.core.model.PageData; -import com.doumee.core.model.PageWrap; +import com.doumee.service.business.third.model.LoginUserInfo; +import com.doumee.service.business.third.model.PageData; +import com.doumee.service.business.third.model.PageWrap; import com.doumee.core.utils.Constants; import com.doumee.core.utils.Utils; import com.doumee.dao.admin.request.UpdateCompanySortDTO; @@ -96,12 +96,19 @@ if(StringUtils.isBlank(parent.getHkId())){ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝鐖剁骇缁勭粐淇℃伅灏氭湭鍚屾涓嬪彂鎴愬姛~"); } - if(Constants.equalsInteger(parent.getType(),Constants.ZERO)){ - //濡傛灉鐖剁骇鏄浉鍏虫柟缁勭粐锛屼笅绾т笉鑳藉缓绔嬪唴閮ㄧ粍缁� - if(Constants.equalsInteger(company.getType(),Constants.ONE)){ - 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(),"瀵逛笉璧凤紝缁勭粐淇℃伅閿欒"); } + }else if(Objects.isNull(parent.getType())){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝缁勭粐淇℃伅閿欒"); } +// if(Constants.equalsInteger(parent.getType(),Constants.ZERO)){ +// //濡傛灉鐖剁骇鏄浉鍏虫柟缁勭粐锛屼笅绾т笉鑳藉缓绔嬪唴閮ㄧ粍缁� +// if(Constants.equalsInteger(company.getType(),Constants.ONE)){ +// throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝鐩稿叧鏂圭粍缁囷紝涓嬬骇涓嶈兘寤虹珛鍐呴儴缁勭粐~"); +// } +// } idPath = parent.getCompanyPath(); company.setHkParentId(parent.getHkId()); company.setCompanyPath(parent.getCompanyPath()+company.getId()+"/"); @@ -117,6 +124,7 @@ company.setHkDate(company.getCreateDate()); company.setEditDate(company.getCreateDate()); company.setEditor(company.getCreator()); + company.setPinyin(Constants.getChinesePingyin(company.getName())); company.setHkId(UUID.randomUUID().toString().replace("-","")); companyMapper.insert(company); //涓嬪彂娴峰悍瀹夐槻骞冲彴 @@ -208,6 +216,7 @@ insert.setCode(company.getCode()); insert.setParentId(company.getParentId()); insert.setLinkName(company.getLinkName()); + company.setPinyin(Constants.getChinesePingyin(company.getName())); insert.setLinkPhone(company.getLinkPhone()); companyMapper.insert(insert); return insert.getId(); @@ -289,22 +298,25 @@ if(model == null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "瀵逛笉璧凤紝缁勭粐淇℃伅涓嶅瓨鍦▇"); } - if( Constants.equalsInteger(Constants.ONE,model.getType())&& Constants.equalsInteger(Constants.ZERO,company.getType())){ - //濡傛灉鐢卞唴閮ㄧ粍缁囧垏鎹㈡垚鍐呴儴缁勭粐锛屾帓鏌ヤ笅绾х粍缁囨槸鍚︽湁鍐呴儴缁勭粐 - if(companyJoinMapper.selectCount(new QueryWrapper<Company>().lambda() - .eq(Company::getIsdeleted,Constants.ZERO ) - .eq(Company::getType,Constants.ONE ) - .ne(Company::getId,model.getId()) - .likeRight(Company::getCompanyPath,model.getCompanyPath())) >0){ - throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "瀵逛笉璧凤紝涓嬬骇閮ㄩ棬瀛樺湪鍐呴儴缁勭粐锛岃閮ㄩ棬涓嶆敮鎸佸垏鎹负鐩稿叧鏂圭粍缁囷紒~"); - } - } + +// if( Constants.equalsInteger(Constants.ONE,model.getType())&& Constants.equalsInteger(Constants.ZERO,company.getType())){ +// //濡傛灉鐢卞唴閮ㄧ粍缁囧垏鎹㈡垚鍐呴儴缁勭粐锛屾帓鏌ヤ笅绾х粍缁囨槸鍚︽湁鍐呴儴缁勭粐 +// if(companyJoinMapper.selectCount(new QueryWrapper<Company>().lambda() +// .eq(Company::getIsdeleted,Constants.ZERO ) +// .eq(Company::getType,Constants.ONE ) +// .ne(Company::getId,model.getId()) +// .likeRight(Company::getCompanyPath,model.getCompanyPath())) >0){ +// throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "瀵逛笉璧凤紝涓嬬骇閮ㄩ棬瀛樺湪鍐呴儴缁勭粐锛岃閮ㄩ棬涓嶆敮鎸佸垏鎹负鐩稿叧鏂圭粍缁囷紒~"); +// } +// } + company.setType(null); company.setEditDate(new Date()); company.setEditor(user.getId()); company.setHkStatus(Constants.ONE); company.setHkDate(company.getHkDate()); company.setHkId(StringUtils.defaultString(model.getHkId(),UUID.randomUUID().toString().replace("-",""))); company.setParentId(null);//涓嶆敮鎸佷慨鏀圭埗绾� + company.setPinyin(Constants.getChinesePingyin(company.getName())); companyMapper.updateById(company); //鏇存柊鐨刢ompanyPath String newName = model.getCompanyNamePath().replace(model.getName(),company.getName()); @@ -322,7 +334,6 @@ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝缁勭粐鍚屾涓嬪彂澶辫触锛岃绋嶅悗閲嶈瘯"); } } - } @Override @@ -452,7 +463,7 @@ if (company.getQueryHiddenDanger() != null && Constants.equalsInteger(company.getQueryHiddenDanger(),Constants.ONE)) { queryWrapper.apply(" t.id in ( select hdp.COMPANY_ID from hidden_danger_param hdp where hdp.ISDELETED = 0 and hdp.STATUS = 0 and hdp.TYPE = 0 ) "); } - queryWrapper.orderByDesc(Company::getCreateDate); + queryWrapper.orderByAsc(Company::getPinyin); queryWrapper.leftJoin(Company.class,Company::getId,Company::getParentId); queryWrapper.select(" t.* ") .select("(select count(m.id) from member m where m.COMPANY_ID=t.id and m.ISDELETED=0) as countNum") ; @@ -564,10 +575,9 @@ queryWrapper.ge(Company::getFsDate, Utils.Date.getStart(pageWrap.getModel().getFsDate())); queryWrapper.le(Company::getFsDate, Utils.Date.getEnd(pageWrap.getModel().getFsDate())); } - queryWrapper.orderByDesc(Company::getCreateDate); queryWrapper.leftJoin(Company.class,Company::getId,Company::getParentId); /* .leftJoin(Member.class, Member::getId,Company::getHeadId)*/ - /* queryWrapper.leftJoin(" company c on c.id=t.parent_id");*/ + /* queryWrapper.leftJoin(" company c on c.id=t.parent_id");*/ queryWrapper.selectAll(Company.class) .select("(select count(m.id) from member m where m.COMPANY_ID=t.id and m.ISDELETED=0) as countNum") ; queryWrapper.select("t1.name",Company::getParentName); @@ -575,6 +585,7 @@ queryWrapper.eq(Objects.nonNull(pageWrap.getModel().getStatus()),Company::getStatus,Constants.ZERO); queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getName()),Company::getName,pageWrap.getModel().getName()); queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getParentName()),"c.name",pageWrap.getModel().getParentName()); + queryWrapper.orderByAsc(Company::getSortnum); IPage<Company> companyIPage = companyJoinMapper.selectJoinPage(page, Company.class, queryWrapper); return PageData.from(companyIPage); } @@ -603,7 +614,8 @@ LambdaQueryWrapper<Company> wrapper = new LambdaQueryWrapper<>(); wrapper.eq(Company::getIsdeleted,Constants.ZERO) - .eq(Constants.equalsInteger(type,Constants.ONE),Company::getType,type); + .eq(Constants.equalsInteger(type,Constants.ONE),Company::getType,type) + .orderByAsc(Company::getSortnum); List<Company> companies = companyMapper.selectList(wrapper); return getCompanyTree( companies, null); } @@ -617,7 +629,8 @@ if(origin == DataSyncConfig.origin.erp){ collect= companies.stream().filter(s -> ( StringUtils.defaultString(s.getErpParentId(),"").equals(StringUtils.defaultString(parentId)))).collect(Collectors.toList()); }else if(origin == DataSyncConfig.origin.hk){ - collect= companies.stream().filter(s -> ( StringUtils.defaultString(s.getHkParentId(),"").equals(StringUtils.defaultString(parentId)))).collect(Collectors.toList()); + collect= companies.stream().filter(s -> + ( StringUtils.defaultString(s.getHkParentId(),"").equals(StringUtils.defaultString(parentId)))).collect(Collectors.toList()); }else{ collect= companies.stream().filter(s -> (StringUtils.defaultString(s.getParentId()+"","").equals(StringUtils.defaultString(parentId)))).collect(Collectors.toList()); } @@ -655,6 +668,7 @@ if (CollectionUtils.isEmpty(companies)){ return; } + company.setPinyin(Constants.getChinesePingyin(company.getName())); //鏂板鐨勬儏鍐靛瓨鍦ㄨ褰� if (Objects.isNull(company.getId())){ throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"鍏徃鍚嶇О宸插瓨鍦�"); @@ -682,7 +696,8 @@ queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Company::getEditor); queryWrapper.eq(Company::getIsdeleted,Constants.ZERO); if(Objects.nonNull(type) && ( Constants.equalsInteger(type,Constants.ONE) || Constants.equalsInteger(type,Constants.ZERO))){ - queryWrapper.eq(type!=null,Company::getType,type); +// queryWrapper.eq(type!=null,Company::getType,type); + queryWrapper.apply("( t.type = "+type+" or t.type = -1 )"); }else if(Objects.nonNull(type) && Constants.equalsInteger(type,Constants.TWO)){ String companySpecialId = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SPECIAL_COMPANY_ID).getCode(); if(StringUtils.isNotBlank(companySpecialId)){ -- Gitblit v1.9.3