Explorar el Código

修改五级机构增加部门问题

wks hace 2 años
padre
commit
5921c3a357

+ 7 - 1
src/main/java/com/ydtech/modules/admin/dao/SysDeptMapper.java

@@ -9,7 +9,13 @@ import java.util.List;
 public interface SysDeptMapper extends BaseMapper<SysDept> {
 
 
-    String getMaxId(@Param(value = "deptId") String deptId);
+    /**
+     * 查询Id 值
+     * @param deptId 部门
+     * @param deptType 类型
+     * @return
+     */
+    String getMaxId(@Param(value = "deptId") String deptId, @Param(value = "deptType")String deptType);
     /**
      *  @version
      *  @author: hxl

+ 50 - 40
src/main/java/com/ydtech/modules/admin/service/impl/SysDeptServiceImpl.java

@@ -51,11 +51,10 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
     private SysUserTreeShowLevelService sysUserTreeShowLevelService;
 
 
-
     /**
      * 根据用户权限和指定部门ID,查询并构建部门树。
      *
-     * @param deptId 部门ID,用于查询特定部门及其子部门,如果为空或特定值,则查询用户所在部门及其子部门。
+     * @param deptId           部门ID,用于查询特定部门及其子部门,如果为空或特定值,则查询用户所在部门及其子部门。
      * @param managementSource 管理范围来源标识,用于不同场景下的部门树构建。
      * @return 返回符合用户权限和管理范围的部门树列表。
      */
@@ -78,9 +77,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
         }
         // 如果指定的部门ID为空或特定值,则使用当前用户所在部门ID
         if (null == deptId || "".equals(deptId) || "undefined".equals(deptId)) {
-            if(!treeShowLevel.getShowLevel().equals("all")) {
+            if (!treeShowLevel.getShowLevel().equals("all")) {
                 deptId = user.getDeptId();
-            }else{
+            } else {
                 deptId = "9";
             }
         }
@@ -127,7 +126,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
                     break;
                 } else {
                     int finalLevel = level;
-                    resultTmp = resultTmp.stream().filter(x->x.getComlevel().equals(String.valueOf(finalLevel))).collect(Collectors.toList());
+                    resultTmp = resultTmp.stream().filter(x -> x.getComlevel().equals(String.valueOf(finalLevel))).collect(Collectors.toList());
                     result.clear();
                     result.addAll(resultTmp);
                 }
@@ -146,13 +145,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
 
         if (showLevel.equals("same")) {
             if (null != managementSource && !"undefined".equals(managementSource) && !"".equals(managementSource)) {
-                if (sysDept.getManagementSource().equals(managementSource)){
+                if (sysDept.getManagementSource().equals(managementSource)) {
                     sysDeptList.clear();
                     sysDeptList.add(sysDept);
-                }else {
+                } else {
                     return new ArrayList<>();
                 }
-            }else {
+            } else {
                 sysDeptList.clear();
                 sysDeptList.add(sysDept);
             }
@@ -171,7 +170,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
                         }
                         i.getChildren().addAll(value);
                         //处理总部的排序为空造成的空指针报错处理  add by   hxl
-                        i.setOrderNum(i.getOrderNum()==null?0:i.getOrderNum());
+                        i.setOrderNum(i.getOrderNum() == null ? 0 : i.getOrderNum());
                         result.add(i);
                     }
                 })
@@ -210,10 +209,16 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
             AssertionUtils.isStringEmpty(sysDept.getArea(), "四级机构区必填");
             number = sysDept.getArea().substring(0, 6);
         } else {
-            if (comlevel.equals("5")) {
+            String deptType = "";
+
+            if ("C".equals(sysDept.getDeptType()) && comlevel.equals("5")) {
                 sysDeptVo.setDeptType("M");
+            } else if ("D".equals(sysDept.getDeptType())) {
+                sysDeptVo.setDeptType("D");
+                deptType = "M";
             }
-            String maxId = baseMapper.getMaxId(sysDept.getParentId());
+
+            String maxId = baseMapper.getMaxId(sysDept.getParentId(), deptType);
             if (!maxId.equals("0")) {
                 String substring = maxId.substring(sysDept.getParentId().length() + 1);
                 int i = Integer.parseInt("1" + substring) + 1;
@@ -239,7 +244,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
         }
         SysDept parentDept = baseMapper.selectById(sysDept.getParentId());
 
-        if (parentDept.getComlevel().equals("5")){
+        if (parentDept.getComlevel().equals("5")) {
             sysDept.setManagementSource(parentDept.getManagementSource());
         }
 
@@ -305,7 +310,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
                     break;
                 }
             }
-           baseMapper.updateById(record);
+            baseMapper.updateById(record);
         }
         //向下换位
         if (newOrderNum > orderNum) {
@@ -432,7 +437,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
         LambdaQueryWrapper<SysDept> lqw = new LambdaQueryWrapper<>();
         lqw.eq(SysDept::getDelFlag, 0);
         lqw.likeRight(SysDept::getId, deptId);
-        lqw.and((wrapper)->{wrapper.eq(SysDept::getDeptType,'C').or().eq(SysDept::getId,'9');});
+        lqw.and((wrapper) -> {
+            wrapper.eq(SysDept::getDeptType, 'C').or().eq(SysDept::getId, '9');
+        });
         List<SysDept> sysDeptList = list(lqw);
         Map<String, List<SysDept>> map = sysDeptList.stream().collect(Collectors.groupingBy(SysDept::getParentId));
         sysDeptList.forEach(i -> i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>())));
@@ -448,31 +455,31 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
         LambdaQueryWrapper<SysDept> lqw = new LambdaQueryWrapper<>();
         lqw.eq(SysDept::getDelFlag, 0);
         lqw.likeRight(SysDept::getId, deptId);
-        lqw.eq(SysDept::getDeptType,'D');
+        lqw.eq(SysDept::getDeptType, 'D');
         lqw.apply(" exists (SELECT 1 FROM  `sys_dept` b WHERE sys_dept.parent_id = b.`id` AND b.`comlevel`='5') ");
         List<SysDept> sysDeptList = list(lqw);
         return sysDeptList;
     }
+
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/4/28 10:24
-     *  @Description: 查询省、市、县 、门店的列表
+     * @version
+     * @author: hxl
+     * @Date: 2024/4/28 10:24
+     * @Description: 查询省、市、县 、门店的列表
      */
     @Override
     public List<SysDept> queryListByParentId(String level, String parentId) {
-        return sysDeptMapper.queryListByParentId(level,parentId);
+        return sysDeptMapper.queryListByParentId(level, parentId);
     }
 
     @Override
-    public String queryBelongArea(String deptId){
+    public String queryBelongArea(String deptId) {
         //长度大于8的话 进行切割
         StringBuilder result = new StringBuilder();
-        if(deptId.length() >= 8)
-        {
-            String area = deptId.substring(2,8);
+        if (deptId.length() >= 8) {
+            String area = deptId.substring(2, 8);
             SysArea sysArea = sysAreaMapper.selectOne(new LambdaQueryWrapper<SysArea>().eq(SysArea::getAreaCode, area));
-            if(sysArea == null){
+            if (sysArea == null) {
                 return "";
             }
             List<SysArea> sysAreas = sysAreaService.queryAllParent(sysArea);
@@ -497,28 +504,30 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
         }
         return sysAreas;
     }
+
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/6/28 8:43
-     *  @Description:  查询后线机构树
+     * @version
+     * @author: hxl
+     * @Date: 2024/6/28 8:43
+     * @Description: 查询后线机构树
      */
     @Override
     public List<SysDept> queryHXDeptTree() {
         //所有的后线机构
         List<SysDept> sysDeptsHX = sysDeptMapper.queryHXDeptTree();
         //查询后线中顶级的数据
-        List<SysDept> resultList =new ArrayList<SysDept>();
-        List<SysDept> sysDeptTop = sysDeptsHX.stream().filter(item ->"99".equals(item.getId())).collect(Collectors.toList());
+        List<SysDept> resultList = new ArrayList<SysDept>();
+        List<SysDept> sysDeptTop = sysDeptsHX.stream().filter(item -> "99".equals(item.getId())).collect(Collectors.toList());
         for (SysDept dept : sysDeptTop) {
-            resultList.add(buildDeptTree(dept,sysDeptsHX));
+            resultList.add(buildDeptTree(dept, sysDeptsHX));
         }
         return resultList;
     }
+
     /**
      * 递归构建树形结构
      */
-    private SysDept buildDeptTree(SysDept dept, List<SysDept> deptList){
+    private SysDept buildDeptTree(SysDept dept, List<SysDept> deptList) {
         for (SysDept d : deptList) {
             if (dept.getId().equals(d.getParentId())) {
                 if (null == dept.getChildren()) {
@@ -530,20 +539,21 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
         }
         return dept;
     }
+
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/6/28 8:42
-     *  @Description: 查询前线机构树
+     * @version
+     * @author: hxl
+     * @Date: 2024/6/28 8:42
+     * @Description: 查询前线机构树
      */
     @Override
     public List<SysDept> queryQXDeptTree() {
         List<SysDept> sysDeptAll = sysDeptMapper.queryListByQXDept();
         //查询后线中顶级的数据
-        List<SysDept> resultList =new ArrayList<SysDept>();
-        List<SysDept> sysDeptTop = sysDeptAll.stream().filter(item ->"3".equals(item.getComlevel())).collect(Collectors.toList());
+        List<SysDept> resultList = new ArrayList<SysDept>();
+        List<SysDept> sysDeptTop = sysDeptAll.stream().filter(item -> "3".equals(item.getComlevel())).collect(Collectors.toList());
         for (SysDept dept : sysDeptTop) {
-            resultList.add(buildDeptTree(dept,sysDeptAll));
+            resultList.add(buildDeptTree(dept, sysDeptAll));
         }
         return sysDeptMapper.queryListByQXDept();
     }

+ 6 - 9
src/main/java/com/ydtech/modules/protocols/controller/PtlNewAgreementController.java

@@ -4,20 +4,18 @@ package com.ydtech.modules.protocols.controller;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.constants.enums.InsuranceRisk;
 import com.ydtech.core.page.HttpResult;
-import com.ydtech.core.page.PageRequest;
 import com.ydtech.core.page.PageResult;
 import com.ydtech.modules.base.controller.BaseController;
-import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
 import com.ydtech.modules.order.entity.vo.FeeOrderNewRecordVo;
-import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
-import com.ydtech.modules.protocol.entity.po.PtlAgreementProductCosts;
-import com.ydtech.modules.protocol.entity.vo.PtlAgreementPageVo;
-import com.ydtech.modules.protocol.entity.vo.PtlAgreementProductQueryVo;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
-import com.ydtech.modules.protocols.entity.po.*;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
 import com.ydtech.modules.protocols.entity.vo.*;
-import com.ydtech.modules.protocols.service.*;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsTrajectoryService;
+import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesAttrService;
+import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesNewService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.poi.ss.formula.functions.T;
@@ -25,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
-import java.util.Map;
 
 /**
 *@author: tz

+ 4 - 1
src/main/resources/mapper/modules/admin/SysDeptMapper.xml

@@ -45,8 +45,11 @@
         SELECT IFNULL(MAX(id), 0) maxid
         FROM `sys_dept`
         WHERE parent_id = #{deptId}
-    </select>
+        <if test='deptType != null and deptType != ""'>
+            and id NOT LIKE '%M%'
+        </if>
 
+    </select>
 
     <select id="queryListByParentId" resultType="com.ydtech.modules.admin.model.SysDept">
         SELECT