From 7298d5354963a88643a543b51b90192dc9fc934c Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 11 九月 2025 18:43:14 +0800
Subject: [PATCH] 最新版本541200007

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java |   44 +++++++++++++++++++++++++++-----------------
 1 files changed, 27 insertions(+), 17 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 969cee4..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
@@ -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()+"/");
@@ -291,16 +298,18 @@
         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);
@@ -576,7 +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::getPinyin);
+        queryWrapper.orderByAsc(Company::getSortnum);
         IPage<Company> companyIPage = companyJoinMapper.selectJoinPage(page, Company.class, queryWrapper);
         return PageData.from(companyIPage);
     }
@@ -606,7 +615,7 @@
 
         wrapper.eq(Company::getIsdeleted,Constants.ZERO)
                 .eq(Constants.equalsInteger(type,Constants.ONE),Company::getType,type)
-                .orderByAsc(Company::getPinyin);
+                .orderByAsc(Company::getSortnum);
         List<Company> companies = companyMapper.selectList(wrapper);
         return getCompanyTree( companies, null);
     }
@@ -687,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