Forráskód Böngészése

报销类别及文印附件调整

sangwenwei 7 hónapja
szülő
commit
6efc2f0b7c

+ 10 - 21
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/inscription/service/InscriptionService.java

@@ -15,6 +15,7 @@ import com.jeeplus.business.inscription.mapper.InscriptionMapper;
 import com.jeeplus.business.inscription.service.dto.InscriptionDTO;
 import com.jeeplus.business.project.domain.JyProject;
 import com.jeeplus.business.project.mapper.JyProjectMapper;
+import com.jeeplus.business.project.utils.FileUtils;
 import com.jeeplus.common.TokenProvider;
 import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.flowable.feign.IFlowableApi;
@@ -35,6 +36,7 @@ import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.ss.usermodel.WorkbookFactory;
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
 import org.apache.poi.xwpf.usermodel.XWPFParagraph;
+import org.apache.tools.ant.taskdefs.Sleep;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBody;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -123,18 +125,12 @@ public class InscriptionService {
      */
     public Integer getPageTotal( InscriptionDTO inscriptionDTO) throws IOException {
         Integer total=0;
-        String path="C:/localpath/";
-        File dir = new File(path);
-        if (!dir.exists()) {
-            boolean result = dir.mkdirs();  // 使用 mkdirs,不仅可以创建最后一层目录,还会创建所有父目录。
-
-            if (result) {
-                System.out.println("文件夹创建成功!");
-            } else {
-                System.out.println("文件夹创建失败!");
-            }
-        } else {
-            System.out.println("文件夹已存在!");
+        String path=null;
+        String fileName = "";
+        if(System.getProperty("os.name").toLowerCase().contains("win")){
+            path = "D:/attachment-file/";
+        }else{
+            path = "/attachment-file/";
         }
 
         String aliyunUrl = "http://cdn.gangwaninfo.com";
@@ -146,7 +142,7 @@ public class InscriptionService {
                 String file = aliyunUrl + info.getUrl();
 
                 file = file.replace("amp;","");
-                String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
+                fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
                 String cons = "";
                 if (file.contains(aliyunUrl)){
                     cons = aliyunUrl;
@@ -192,14 +188,7 @@ public class InscriptionService {
             }catch (Exception e){
 
             }finally {
-                if(StringUtils.isNotBlank(deleteFile)){
-                    //根据路径创建文件对象
-                    File file = new File(deleteFile);
-                    //路径是个文件且不为空时删除文件
-                    if(file.isFile()&&file.exists()){
-                        file.delete();
-                    }
-                }
+                FileUtils.delFile(path+fileName);
             }
 
         }

+ 167 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/reimApprovalType/controller/JyReimbursementTypeController.java

@@ -0,0 +1,167 @@
+package com.jeeplus.pubmodules.reimApprovalType.controller;
+
+import com.jeeplus.pubmodules.reimApprovalType.domain.JyReimbursementTypeInfo;
+import com.jeeplus.pubmodules.reimApprovalType.mapper.JyReimbursementTypeMapper;
+import com.jeeplus.pubmodules.reimApprovalType.service.JyReimbursementTypeForTreeDataService;
+import com.jeeplus.pubmodules.reimApprovalType.service.JyReimbursementTypeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-25 09:18
+ **/
+@RestController
+@Api(tags ="嘉溢-报销类型管理")
+@RequestMapping(value = "/jyReimbursementApproval/type")
+public class JyReimbursementTypeController {
+
+    @Resource
+    private JyReimbursementTypeService service;
+
+    @Resource
+    private JyReimbursementTypeForTreeDataService treeService;
+
+    @Resource
+    private JyReimbursementTypeMapper mapper;
+
+    /**
+     * 列表查询
+     * @param info
+     * @return
+     */
+    @ApiOperation(value = "列表查询")
+    @GetMapping("/list")
+    public ResponseEntity<List<JyReimbursementTypeInfo>> list(JyReimbursementTypeInfo info) {
+        List<JyReimbursementTypeInfo> list = service.list(info);
+        return ResponseEntity.ok(list);
+    }
+
+    /**
+     * 列表查询
+     * @param info
+     * @return
+     */
+    @ApiOperation(value = "列表查询")
+    @GetMapping("/bxList")
+    public ResponseEntity<List<JyReimbursementTypeInfo>> bxList(JyReimbursementTypeInfo info) {
+        List<JyReimbursementTypeInfo> list = service.bxList2(info);
+        return ResponseEntity.ok(list);
+    }
+
+    /**
+     * 采购类型列表查询
+     * @param info
+     * @return
+     */
+    @ApiOperation(value = "采购类型列表查询")
+    @GetMapping("/cgList")
+    public ResponseEntity<List<JyReimbursementTypeInfo>> cgList(JyReimbursementTypeInfo info) {
+        List<JyReimbursementTypeInfo> list = service.cgList(info);
+        return ResponseEntity.ok(list);
+    }
+
+    /**
+     * 新增/修改
+     * @param info
+     * @return
+     */
+    @ApiOperation(value = "新增/修改")
+    @PostMapping("/save")
+    public ResponseEntity<String> save(@RequestBody JyReimbursementTypeInfo info) {
+        String s = service.save(info);
+        return ResponseEntity.ok(s);
+    }
+
+    /**
+     * 根据id查询
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "根据id查询")
+    @GetMapping("/findById")
+    public ResponseEntity<JyReimbursementTypeInfo> findById(String id) {
+        JyReimbursementTypeInfo info = service.getById(id);
+        return ResponseEntity.ok(info);
+    }
+
+    /**
+     * 根据id删除
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "根据id删除")
+    @GetMapping("/deleteById")
+    public ResponseEntity<String> deleteById(String id) {
+        mapper.deleteById(id);
+        return ResponseEntity.ok("操作完成");
+    }
+
+    /**
+     * 查询树形
+     * @param extId 排除的ID
+     * @return
+     */
+    @ApiOperation(value = "查询树形")
+    @GetMapping("/treeData")
+    public ResponseEntity<List<JyReimbursementTypeInfo>> treeData(@RequestParam(required = false) String extId, @RequestParam(required = false) String type) throws Exception{
+        List<JyReimbursementTypeInfo> infos = treeService.treeDataForType(extId, type);
+        return ResponseEntity.ok(infos);
+    }
+
+    /**
+     * 查询树形
+     * @param extId 排除的ID
+     * @return
+     */
+    @ApiOperation(value = "查询树形")
+    @GetMapping("/treeData1")
+    public ResponseEntity<List<JyReimbursementTypeInfo>> treeData1(@RequestParam(required = false) String extId, @RequestParam(required = false) String type) throws Exception{
+        List<JyReimbursementTypeInfo> infos = treeService.treeDataForType1(extId, type);
+        return ResponseEntity.ok(infos);
+    }
+
+    /**
+     * 查询树形
+     * @param extId 排除的ID
+     * @return
+     */
+    @ApiOperation(value = "查询树形")
+    @GetMapping("/summaryTreeData")
+    public ResponseEntity<List<JyReimbursementTypeInfo>> summaryTreeData(@RequestParam(required = false) String extId, @RequestParam(required = false) String type) throws Exception{
+        List<JyReimbursementTypeInfo> infos = treeService.summaryTreeData(extId, type);
+        return ResponseEntity.ok(infos);
+    }
+
+    /**
+     * 查询树形
+     * @param extId 排除的ID
+     * @return
+     */
+    @ApiOperation(value = "查询树形")
+    @GetMapping("/treeData2")
+    public ResponseEntity<List<JyReimbursementTypeInfo>> treeData2(@RequestParam(required = false) String extId, @RequestParam(required = false) String type) throws Exception{
+        List<JyReimbursementTypeInfo> infos = treeService.treeDataForType2(extId, type);
+        return ResponseEntity.ok(infos);
+    }
+
+
+    /**
+     * 根据报销类型查询判定项目是否单选还是多选
+     * @param typeId
+     * @return
+     */
+    @ApiOperation(value = "根据报销类型查询判定项目是否单选还是多选")
+    @GetMapping("/findReimbursementTypeSingleSelectById")
+    public ResponseEntity<JyReimbursementTypeInfo> findReimbursementTypeSingleSelectById(@RequestParam String typeId){
+        JyReimbursementTypeInfo s = service.findReimbursementTypeSingleSelectById(typeId);
+        return ResponseEntity.ok(s);
+    }
+
+
+}

+ 64 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/reimApprovalType/domain/JyReimbursementTypeInfo.java

@@ -0,0 +1,64 @@
+package com.jeeplus.pubmodules.reimApprovalType.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.TreeEntity;
+import com.jeeplus.core.query.Query;
+import com.jeeplus.sys.service.dto.OfficeDTO;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 报销类型信息列表
+ **/
+@Data
+@TableName(value = "jy_reimbursement_type_info")
+public class JyReimbursementTypeInfo extends TreeEntity<JyReimbursementTypeInfo> {
+
+    private static final long serialVersionUID = 1L;
+    /**
+     * 层级
+     */
+    private String level;
+
+    /**
+     * 报销类型名称
+     */
+    @Query
+    private String name;
+
+    /**
+     * 序号
+     */
+    @Query
+    private Integer sort;
+
+    /**
+     * 父节点id
+     */
+    private String parentId;
+
+    private String parentIds;
+
+    @TableField(exist = false)
+    private Boolean disabled = false;
+
+    @TableField(exist = false)
+    private String like;
+
+    //关联部门
+    @TableField(exist = false)
+    private String relateDepartment;
+
+    //报销部门id
+    @TableField(exist = false)
+    private String officeId;
+
+    /**
+     * 关联的officeIdList
+     */
+    private List<String> officeIdList;
+
+    private List<OfficeDTO> officeDTOList;
+}

+ 94 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/reimApprovalType/mapper/JyReimbursementTypeMapper.java

@@ -0,0 +1,94 @@
+package com.jeeplus.pubmodules.reimApprovalType.mapper;
+
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.jeeplus.core.domain.TreeMapper;
+import com.jeeplus.pubmodules.reimApprovalType.domain.JyReimbursementTypeInfo;
+import com.jeeplus.pubmodules.reimApprovalType.domain.OfficeDomain;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-25 09:02
+ **/
+public interface JyReimbursementTypeMapper extends BaseMapper<JyReimbursementTypeInfo>, TreeMapper<JyReimbursementTypeInfo> {
+
+    /**
+     * 查询数据集合
+     * @param queryWrapper
+     * @return
+     */
+    List<JyReimbursementTypeInfo> findList(@Param(Constants.WRAPPER) Wrapper<JyReimbursementTypeInfo> queryWrapper);
+
+    //@InterceptorIgnore(tenantLine = "true")
+    List<JyReimbursementTypeInfo> bxList2(@Param(Constants.WRAPPER) Wrapper<JyReimbursementTypeInfo> queryWrapper,
+                                          @Param("officeId") String officeId);
+
+    /**
+     * 查找当前登陆人的部门的信息
+     * @param id
+     * @return
+     */
+    OfficeDomain officeInfo(@Param("id") String id);
+
+    /**
+     * 当前登陆人为三级部门时查二级部门方法
+     * @param id
+     * @return
+     */
+    OfficeDomain officeInfo2(@Param("id") String id);
+
+    /**
+     * 递归方式获取父级部门信息
+     * @param id
+     * @return
+     */
+    List<OfficeDomain> officeInfo3(@Param("id") String id);
+
+    /**
+     * 根据id查询详情信息
+     * @param id
+     * @return
+     */
+    @InterceptorIgnore(tenantLine = "true")
+    JyReimbursementTypeInfo getById(String id);
+    /**
+     * 根据name和parentId查询名称是否重复
+     * @param name
+     * @param parentId
+     * @return
+     */
+    Integer checkNameIsExist(@Param("name") String name, @Param("parentId") String parentId);
+
+    Integer getNo(@Param("parentId") String parentId);
+
+    Integer getLevel(@Param("parentId") String parentId);
+
+    List<String> getChildId(String id);
+
+    /**
+     * 获取所有业务类型的数据
+     * @return
+     */
+    @InterceptorIgnore(tenantLine = "true")
+    List<JyReimbursementTypeInfo> getAllList();
+
+    /**
+     * 删除报销类型关联表对应信息
+     * @param id
+     */
+    void deleteReimbursementTypeOfficeInfo(String id);
+
+    /**
+     * 新增报销类型和部门关联信息
+     * @param id
+     * @param OfficeIdList
+     */
+    void saveReimbursementTypeOfficeInfo(@Param("id") String id , @Param("officeIdList") List<String> OfficeIdList);
+
+    JyReimbursementTypeInfo findReimbursementTypeSingleSelectById(String id);
+}

+ 294 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/reimApprovalType/mapper/xml/JyReimbursementTypeMapper.xml

@@ -0,0 +1,294 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jeeplus.pubmodules.reimApprovalType.mapper.JyReimbursementTypeMapper">
+	<resultMap id="BaseResultMap" type="com.jeeplus.pubmodules.reimApprovalType.domain.JyReimbursementTypeInfo">
+		<id property="id" column="id" jdbcType="VARCHAR"/>
+		<result property="createById" column="create_by_id" jdbcType="VARCHAR"/>
+		<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+		<result property="updateById" column="update_by_id" jdbcType="VARCHAR"/>
+		<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+		<result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+
+		<result property="level" column="level" jdbcType="VARCHAR"/>
+		<result property="name" column="name" jdbcType="VARCHAR"/>
+		<result property="sort" column="sort" jdbcType="VARCHAR"/>
+		<result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
+		<result property="parentIds" column="parent_ids" jdbcType="VARCHAR"/>
+		<collection property="officeDTOList" ofType="com.jeeplus.sys.service.dto.OfficeDTO" column="id" select="getOfficeClient"></collection>
+
+	</resultMap>
+
+
+	<sql id="Base_Column_List">
+        a.id,
+        a.create_by_id,
+        a.create_time,
+        a.update_by_id,
+        a.update_time,
+        a.del_flag,
+        a.level,
+		a.name,
+		a.sort,
+		a.parent_id,
+		a.parent_ids
+    </sql>
+
+	<sql id="officeColumns">
+    	so.id as "id",
+        so.parent_id as "parent.id",
+        so.parent_ids as "parentIds",
+        so.name as "name",
+        so.sort as "sort",
+        so.area as "area",
+        so.code as "code",
+        so.type as "type",
+        so.grade as "grade",
+        so.address as "address",
+        so.zip_code as "zipCode",
+        so.master as "master",
+        so.phone as "phone",
+        so.fax as "fax",
+        so.email as "email",
+        so.useable as "useable",
+        so.primary_person as "primaryPerson",
+        so.deputy_person as "deputyPerson",
+		so.create_by_id as "createBy.id",
+		so.create_time as "createTime",
+		so.update_by_id as "updateBy.id",
+		so.update_time as "updateTime",
+        so.remarks as "remarks",
+        so.del_flag as "delFlag",
+        so.is_public as "isPublic",
+        so.administrator as "administrator"
+    </sql>
+
+	<select id="getOfficeClient" resultType="com.jeeplus.sys.service.dto.OfficeDTO">
+		select
+		<include refid="officeColumns"></include>
+		from sys_office so
+		left join jy_reimbursement_type_office_info rtoi on rtoi.office_id = so.id and so.del_flag = '0'
+		where rtoi.reimbursement_type_id = #{id}
+	</select>
+
+
+	<select id="findList" resultMap="BaseResultMap">
+		select
+		<include refid="Base_Column_List"></include>
+		,d.`name` as relateDepartment
+		from jy_reimbursement_type_info a
+		LEFT JOIN
+		(SELECT GROUP_CONCAT(c.name) as name,c.office_id,c.reimbursement_type_id FROM
+		(SELECT name,jy.office_id,jy.reimbursement_type_id
+		FROM jy_reimbursement_type_office_info jy
+		LEFT JOIN sys_office so on jy.office_id = so.id) c GROUP BY c.reimbursement_type_id) d
+		on a.id = d.reimbursement_type_id
+		${ew.customSqlSegment}
+	</select>
+
+
+	<select id="getById" resultMap="BaseResultMap">
+		select
+		<include refid="Base_Column_List"></include>
+		from jy_reimbursement_type_info a
+		<where>
+			a.del_flag = 0 and a.id = #{id}
+		</where>
+	</select>
+
+	<select id="checkNameIsExist" resultType="java.lang.Integer">
+        SELECT
+			COUNT( 0 )
+		FROM
+			jy_reimbursement_type_info
+		WHERE
+			del_flag = 0
+			AND `name` = #{name}
+			AND parent_id = #{parentId}
+    </select>
+    <select id="getNo" resultType="java.lang.Integer">
+        SELECT
+			(MAX(`sort`) + 1) AS `sort`
+		FROM
+			jy_reimbursement_type_info
+		WHERE
+			del_flag = 0
+			AND parent_id = #{parentId}
+    </select>
+    <select id="getLevel" resultType="java.lang.Integer">
+        SELECT
+			(MAX(level) + 1) AS `level`
+		FROM
+			jy_reimbursement_type_info
+		WHERE
+			del_flag = 0
+			AND id = #{parentId}
+    </select>
+	<select id="getChildId" resultType="java.lang.String">
+		select id from jy_reimbursement_type_info where parent_id = #{id}
+	</select>
+	<select id="getAllList"
+			resultType="com.jeeplus.pubmodules.reimApprovalType.domain.JyReimbursementTypeInfo">
+		select * from jy_reimbursement_type_info where  del_flag = '0' order by sort asc
+	</select>
+	<select id="bxList2"
+			resultType="com.jeeplus.pubmodules.reimApprovalType.domain.JyReimbursementTypeInfo">
+		SELECT
+			t.id,
+			t.create_time,
+			t.create_by_id,
+			t.update_time,
+			t.update_by_id,
+			t.del_flag,
+			t.LEVEL,
+			t.NAME,
+			t.sort,
+			t.parent_id,
+			t.parent_ids
+			FROM
+				(
+				SELECT
+					id,
+					create_time,
+					a.create_by_id,
+					a.update_time,
+					a.update_by_id,
+					a.del_flag,
+					a.LEVEL,
+					a.NAME,
+					a.sort,
+					a.parent_id,
+					a.parent_ids
+				FROM
+					jy_reimbursement_type_info a
+				WHERE
+					del_flag = 0
+					AND a.id IN (
+					SELECT
+						id
+					FROM
+						jy_reimbursement_type_info a
+					WHERE
+						del_flag = 0
+					AND a.parent_id NOT IN ( SELECT b.reimbursement_type_id FROM jy_reimbursement_type_office_info b)
+					AND a.id NOT IN ( SELECT b.reimbursement_type_id FROM jy_reimbursement_type_office_info b)
+					)
+					union
+				SELECT
+					id,
+					create_time,
+					a.create_by_id,
+					a.update_time,
+					a.update_by_id,
+					a.del_flag,
+					a.LEVEL,
+					a.NAME,
+					a.sort,
+					a.parent_id,
+					a.parent_ids
+					FROM
+					jy_reimbursement_type_info a
+					WHERE
+					del_flag = 0
+					and a.parent_id in (SELECT b.reimbursement_type_id FROM jy_reimbursement_type_office_info b WHERE b.office_id = #{officeId})
+				union
+				SELECT
+					id,
+					create_time,
+					a.create_by_id,
+					a.update_time,
+					a.update_by_id,
+					a.del_flag,
+					a.LEVEL,
+					a.NAME,
+					a.sort,
+					a.parent_id,
+					a.parent_ids
+					FROM
+					jy_reimbursement_type_info a
+					WHERE
+					del_flag = 0
+					and a.parent_id in
+						(SELECT
+							id
+						FROM
+							jy_reimbursement_type_info a
+						WHERE
+							del_flag = 0
+							and a.parent_id in (SELECT b.reimbursement_type_id FROM jy_reimbursement_type_office_info b WHERE b.office_id = #{officeId})
+						)
+				UNION
+				SELECT
+					id,
+					create_time,
+					a.create_by_id,
+					a.update_time,
+					a.update_by_id,
+					a.del_flag,
+					a.LEVEL,
+					a.NAME,
+					a.sort,
+					a.parent_id,
+					a.parent_ids
+					FROM
+					jy_reimbursement_type_info a
+					WHERE
+					del_flag = 0
+					and a.id in (SELECT b.reimbursement_type_id FROM jy_reimbursement_type_office_info b WHERE b.office_id = #{officeId})
+				) t
+			${ew.customSqlSegment}
+	</select>
+	<select id="officeInfo"
+			resultType="com.jeeplus.pubmodules.reimApprovalType.domain.OfficeDomain">
+		SELECT id,name,grade,parent_id FROM sys_office WHERE id = #{id} and del_flag = 0
+	</select>
+	<select id="officeInfo2"
+			resultType="com.jeeplus.pubmodules.reimApprovalType.domain.OfficeDomain">
+		SELECT id,name,grade,parent_id FROM sys_office WHERE id =
+		(SELECT parent_id FROM sys_office WHERE id = #{id} and del_flag = 0)
+		 and del_flag = 0
+	</select>
+	<select id="officeInfo3"
+			resultType="com.jeeplus.pubmodules.reimApprovalType.domain.OfficeDomain">
+		SELECT T2.ID, T2.parent_id,T2.name,T2.grade
+			FROM
+			(SELECT @r := #{id}, @l := 0) vars,
+			(SELECT
+				@r as _id,
+				(SELECT
+					@r := parent_id
+					FROM
+					sys_office
+					WHERE
+					id = _id
+				) as parent_id,
+				@l := @l + 1 as lv1
+				FROM sys_office h
+				WHERE
+				@r != 0
+			) T1
+		join sys_office T2 on T1._id = T2.id and T2.del_flag = 0
+		ORDER BY grade desc
+	</select>
+
+	<delete id="deleteReimbursementTypeOfficeInfo">
+		delete from jy_reimbursement_type_office_info where reimbursement_type_id = #{id}
+	</delete>
+
+	<insert id="saveReimbursementTypeOfficeInfo">
+		<foreach collection="officeIdList" item="officeId" separator=";">
+			insert into jy_reimbursement_type_office_info(reimbursement_type_id,office_id) values(#{id},#{officeId})
+		</foreach>
+	</insert>
+
+
+
+
+	<select id="findReimbursementTypeSingleSelectById" resultType="com.jeeplus.pubmodules.reimApprovalType.domain.JyReimbursementTypeInfo">
+		select
+		<include refid="Base_Column_List"></include>
+		from jy_reimbursement_type_info a
+		<where>
+			a.del_flag = 0 and a.id = (select parent_id from jy_reimbursement_type_info where id = #{id})
+		</where>
+	</select>
+</mapper>

+ 178 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/reimApprovalType/service/JyReimbursementTypeForTreeDataService.java

@@ -0,0 +1,178 @@
+package com.jeeplus.pubmodules.reimApprovalType.service;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.core.service.TreeService;
+import com.jeeplus.core.service.dto.TreeDTO;
+import com.jeeplus.pubmodules.reimApprovalType.domain.JyReimbursementTypeInfo;
+import com.jeeplus.pubmodules.reimApprovalType.mapper.JyReimbursementTypeMapper;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-25 09:01
+ **/
+@Service
+public class JyReimbursementTypeForTreeDataService extends TreeService<JyReimbursementTypeMapper, JyReimbursementTypeInfo> {
+
+    @Resource
+    private JyReimbursementTypeMapper typeMapper;
+
+    /**
+     * 获取JSON树形数据。
+     *
+     * @param extId 排除的ID
+     * @param type 禁选类型
+     * @return
+     */
+    public List<JyReimbursementTypeInfo> treeDataForType(String extId, String type) throws Exception{
+        //获取所有的业务类型为1的数据
+//        List<JyReimbursementTypeInfo> allList = typeMapper.getAllList("1");
+        List<JyReimbursementTypeInfo> allList = typeMapper.findList (new LambdaQueryWrapper<>( (Class <JyReimbursementTypeInfo>) entityClass ).orderByAsc ( JyReimbursementTypeInfo::getSort ));
+        JyReimbursementTypeInfo root = entityClass.getConstructor ( ).newInstance ( );
+        root.setId ( TreeDTO.getRootId () );
+        List <JyReimbursementTypeInfo> rootTree = this.formatListToTreeForType ( root, allList, extId, type );
+        return rootTree;
+    }
+
+    /**
+     * 获取JSON树形数据。
+     *
+     * @param extId 排除的ID
+     * @param type 禁选类型
+     * @return
+     */
+    public List<JyReimbursementTypeInfo> treeDataForType1(String extId, String type) throws Exception{
+        //获取所有的业务类型为1的数据
+        List<JyReimbursementTypeInfo> allList = typeMapper.getAllList();
+//        List<JyReimbursementTypeInfo> allList = super.list (new LambdaQueryWrapper<>( (Class <JyReimbursementTypeInfo>) entityClass ).orderByAsc ( JyReimbursementTypeInfo::getSort ));
+        JyReimbursementTypeInfo root = entityClass.getConstructor ( ).newInstance ( );
+        root.setId ( TreeDTO.getRootId () );
+        List <JyReimbursementTypeInfo> rootTree = this.formatListToTreeForType ( root, allList, extId, type );
+        return rootTree;
+    }
+
+    /**
+     * 获取JSON树形数据。
+     *
+     * @param extId 排除的ID
+     * @param type 禁选类型
+     * @return
+     */
+    public List<JyReimbursementTypeInfo> summaryTreeData(String extId, String type) throws Exception{
+        //获取所有的业务类型为1的数据
+        List<JyReimbursementTypeInfo> allList = typeMapper.getAllList();
+        JyReimbursementTypeInfo root = entityClass.getConstructor ( ).newInstance ( );
+        root.setId ( TreeDTO.getRootId () );
+        List <JyReimbursementTypeInfo> rootTree = this.formatListToTreeForType ( root, allList, extId, type );
+        return rootTree;
+    }
+
+    /**
+     * 获取JSON树形数据。
+     *
+     * @param extId 排除的ID
+     * @param type 禁选类型
+     * @return
+     */
+    public List<JyReimbursementTypeInfo> treeDataForType2(String extId, String type) throws Exception{
+        //获取所有的业务类型为1的数据
+        List<JyReimbursementTypeInfo> allList = typeMapper.getAllList();
+//        List<JyReimbursementTypeInfo> allList = super.list (new LambdaQueryWrapper<>( (Class <JyReimbursementTypeInfo>) entityClass ).orderByAsc ( JyReimbursementTypeInfo::getSort ));
+        JyReimbursementTypeInfo root = entityClass.getConstructor ( ).newInstance ( );
+        root.setId ( TreeDTO.getRootId () );
+        List <JyReimbursementTypeInfo> rootTree = this.formatListToTreeForType ( root, allList, extId, type );
+        return rootTree;
+    }
+
+    /**
+     * 以root为根节点, 将allList从线性列表转为树形列表
+     *
+     * @param root    根节点, 为空抛出空指针异常
+     * @param allList 所有需要参与构造为树的列表
+     * @param extId   需要排除在树之外的节点(子节点一并被排除)
+     * @return java.util.List<T>
+     * @Author 滕鑫源
+     * @Date 2020/10/23 17:04
+     **/
+    public List <JyReimbursementTypeInfo> formatListToTreeForType (JyReimbursementTypeInfo root, List <JyReimbursementTypeInfo> allList, String extId, String type) {
+        String rootId = root.getId ( );
+        // 最终的树形态
+        List <JyReimbursementTypeInfo> trees = Lists.newArrayList ( );
+
+        // 把需要构造树的所有列表, 根据以父id作为key, 整理为列表
+        Map<String, List <JyReimbursementTypeInfo>> treeMap = Maps.newHashMap ( );
+        for (JyReimbursementTypeInfo entity : allList) {
+            List <JyReimbursementTypeInfo> entities = treeMap.get ( entity.getParentId ( ) );
+            if ( entities == null ) {
+                entities = Lists.newLinkedList ( );
+            }
+
+            // 剔除排除项, 构造treeMap, 转递归为线性操作
+            if ( StrUtil.isBlank ( extId ) || (!extId.equals ( entity.getId ( ) ) && entity.getParentIds ( ).indexOf ( "," + extId + "," ) == -1) ) {
+                entities.add ( entity );
+                treeMap.put ( entity.getParentId ( ), entities );
+            }
+
+            if (StringUtils.isNotEmpty(type)) {
+                //禁选类型设置disable值为true
+                if ("last".equals(type)) {
+                    allList.stream().forEach(item -> {
+                        if (StringUtils.isNotBlank(item.getParentId())) {
+                            if (item.getParentId().equals(entity.getId())) {
+                                entity.setDisabled(true);
+                            }
+                        }
+                    });
+                } else {
+                    if (type.contains(entity.getLevel())) {
+                        entity.setDisabled(true);
+                    }
+                }
+            }
+        }
+
+        // 没有给定的子树, 返回空树
+        if ( treeMap.get ( rootId ) == null || treeMap.get ( rootId ).isEmpty ( ) ) {
+            return trees;
+        }
+
+        // 开始递归格式化
+        List <JyReimbursementTypeInfo> children = treeMap.get ( rootId );
+        for (JyReimbursementTypeInfo parent : children) {
+            formatFillChildren ( parent, treeMap );
+            trees.add ( parent );
+        }
+        if ( StrUtil.equals ( rootId, TreeDTO.getRootId () ) ) {
+            return children;
+        } else {
+            root.setChildren ( trees );
+            return Lists.newArrayList ( root );
+        }
+    }
+    /**
+     * 从treeMap中取出子节点填入parent, 并递归此操作
+     *
+     * @param parent
+     * @param treeMap
+     * @return void
+     * @Author 滕鑫源
+     * @Date 2020/9/30 16:33
+     **/
+    private void formatFillChildren(JyReimbursementTypeInfo parent, Map <String, List <JyReimbursementTypeInfo>> treeMap) {
+        List <JyReimbursementTypeInfo> children = treeMap.get ( parent.getId ( ) );
+        parent.setChildren ( children );
+        if ( children != null && !children.isEmpty ( ) ) {
+            for (JyReimbursementTypeInfo child : children) {
+                formatFillChildren ( child, treeMap );
+            }
+        }
+    }
+}

+ 374 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/reimApprovalType/service/JyReimbursementTypeService.java

@@ -0,0 +1,374 @@
+package com.jeeplus.pubmodules.reimApprovalType.service;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.jeeplus.common.TokenProvider;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.pubmodules.reimApprovalType.domain.JyReimbursementTypeInfo;
+import com.jeeplus.pubmodules.reimApprovalType.domain.OfficeDomain;
+import com.jeeplus.pubmodules.reimApprovalType.mapper.JyReimbursementTypeMapper;
+import com.jeeplus.sys.feign.IUserApi;
+import com.jeeplus.sys.service.dto.OfficeDTO;
+import com.jeeplus.sys.service.dto.UserDTO;
+import org.apache.commons.compress.utils.Lists;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+//import com.jeeplus.test.materialManagement.materialType.domain.MaterialTypeInfo;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-25 09:13
+ **/
+@Service
+public class JyReimbursementTypeService {
+
+    @Resource
+    private JyReimbursementTypeMapper mapper;
+
+    public List<JyReimbursementTypeInfo> bxList2(JyReimbursementTypeInfo info) {
+        LambdaQueryWrapper<JyReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
+        if(StringUtils.isNotBlank(info.getName())){
+            //根据type模糊查询
+            List<JyReimbursementTypeInfo> jyReimbursementTypeInfoList = mapper.selectList(new QueryWrapper<JyReimbursementTypeInfo>().lambda()
+                    .like(StringUtils.isNotBlank(info.getName()), JyReimbursementTypeInfo::getName, info.getName())
+            );
+            List<String> collect = jyReimbursementTypeInfoList.stream().map(JyReimbursementTypeInfo::getId).collect(Collectors.toList());
+            //materialTypeInfoList的父级id全部获取
+            List<String> cupIdList = jyReimbursementTypeInfoList.stream().map(JyReimbursementTypeInfo::getParentId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
+            //获取materialTypeInfoList的父级id的父级id
+            List<String> cupIdPList = new ArrayList<>();
+            if (CollectionUtil.isNotEmpty(cupIdList)) {
+                cupIdList.stream().forEach(item -> {
+                    JyReimbursementTypeInfo byId = mapper.selectById(item);
+                    if (ObjectUtil.isNotEmpty(byId)) {
+                        if (StringUtils.isNotBlank(byId.getParentId())) {
+                            cupIdPList.add(byId.getParentId());
+                        }
+                    }
+                });
+            }
+            //获取collect的下级id
+            List<String> childIdList = new ArrayList<>();
+            collect.stream().forEach(item -> {
+                List<JyReimbursementTypeInfo> list = mapper.selectList(new LambdaQueryWrapper<JyReimbursementTypeInfo>().eq(JyReimbursementTypeInfo::getParentId, item));
+                if (CollectionUtil.isNotEmpty(list)) {
+                    List<String> collect1 = list.stream().map(JyReimbursementTypeInfo::getId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
+                    if (CollectionUtil.isNotEmpty(collect1)) {
+                        childIdList.addAll(collect1);
+                        //获取collect的下级的下级的id
+                        collect1.stream().forEach(i -> {
+                            List<JyReimbursementTypeInfo> l = mapper.selectList(new LambdaQueryWrapper<JyReimbursementTypeInfo>().eq(JyReimbursementTypeInfo::getParentId, i));
+                            if (CollectionUtil.isNotEmpty(l)) {
+                                List<String> collect2 = l.stream().map(JyReimbursementTypeInfo::getId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
+                                if (CollectionUtil.isNotEmpty(collect2)) {
+                                    childIdList.addAll(collect2);
+                                }
+                            }
+                        });
+                    }
+                }
+            });
+            //将获取到的这几个id集合融合到一起并去重,然后根据id查询,即可得到结果
+            collect.addAll(cupIdList);
+            collect.addAll(cupIdPList);
+            collect.addAll(childIdList);
+
+            List<String> idList = collect.stream().distinct().collect(Collectors.toList());
+            if(CollectionUtil.isNotEmpty(idList)){
+                wrapper.in(JyReimbursementTypeInfo::getId,idList);
+            }else{
+                return new ArrayList<>();
+            }
+        }
+        if (ObjectUtil.isNotEmpty(info)) {
+            if (StringUtils.isNotBlank(info.getLike())){
+                wrapper.likeRight(JyReimbursementTypeInfo::getSort,info.getLike());
+            }
+        }
+//        if (info.getSort() != null) {
+//            wrapper.like(JyReimbursementTypeInfo::getSort, info.getSort());
+//        }
+
+        wrapper.eq(BaseEntity::getDelFlag, 0);
+        wrapper.orderByAsc(JyReimbursementTypeInfo::getSort);
+        //查当前登陆人的父级部门的id为江苏兴光的
+//        OfficeDomain officeInfo = mapper.officeInfo(info.getOfficeId());
+//        if (null != officeInfo && officeInfo.getGrade().equals("2")){
+//            info.setOfficeId(officeInfo.getId());
+//        } else if (null != officeInfo && officeInfo.getGrade().equals("3")) {
+//            officeInfo = mapper.officeInfo2(officeInfo.getId());
+//            if (null != officeInfo){
+//                info.setOfficeId(officeInfo.getId());
+//            }
+//        }
+        //使用递归的方式来查当前登陆人部门父节点信息
+        List<OfficeDomain> officeDomains = mapper.officeInfo3(info.getOfficeId());
+        if (null != officeDomains && officeDomains.size()>0){
+            for (int i=0;i<officeDomains.size()-1;i++){
+                //当get(i)的父级id与 i+1的id相同,并且i+的部门层级为1的时候
+                if (officeDomains.get(i).getParentId().equals(officeDomains.get(i+1).getId()) && StringUtils.isNotBlank(officeDomains.get(i+1).getGrade()) &&
+                        officeDomains.get(i+1).getGrade().equals("1")){
+                    info.setOfficeId(officeDomains.get(i).getId());
+                }
+            }
+        }
+        return mapper.bxList2(wrapper,info.getOfficeId());
+    }
+
+    public List<JyReimbursementTypeInfo> list(JyReimbursementTypeInfo info) {
+        QueryWrapper<JyReimbursementTypeInfo> wrapper = new QueryWrapper<>();
+        if(StringUtils.isNotBlank(info.getName())){
+            //根据type模糊查询
+            List<JyReimbursementTypeInfo> jyReimbursementTypeInfoList = mapper.selectList(new QueryWrapper<JyReimbursementTypeInfo>().lambda()
+                    .like(StringUtils.isNotBlank(info.getName()), JyReimbursementTypeInfo::getName, info.getName())
+            );
+            List<String> collect = jyReimbursementTypeInfoList.stream().map(JyReimbursementTypeInfo::getId).collect(Collectors.toList());
+            //materialTypeInfoList的父级id全部获取
+            List<String> cupIdList = jyReimbursementTypeInfoList.stream().map(JyReimbursementTypeInfo::getParentId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
+            //获取materialTypeInfoList的父级id的父级id
+            List<String> cupIdPList = new ArrayList<>();
+            if (CollectionUtil.isNotEmpty(cupIdList)) {
+                cupIdList.stream().forEach(item -> {
+                    JyReimbursementTypeInfo byId = mapper.selectById(item);
+                    if (ObjectUtil.isNotEmpty(byId)) {
+                        if (StringUtils.isNotBlank(byId.getParentId())) {
+                            cupIdPList.add(byId.getParentId());
+                        }
+                    }
+                });
+            }
+            //获取collect的下级id
+            List<String> childIdList = new ArrayList<>();
+            collect.stream().forEach(item -> {
+                List<JyReimbursementTypeInfo> list = mapper.selectList(new LambdaQueryWrapper<JyReimbursementTypeInfo>().eq(JyReimbursementTypeInfo::getParentId, item));
+                if (CollectionUtil.isNotEmpty(list)) {
+                    List<String> collect1 = list.stream().map(JyReimbursementTypeInfo::getId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
+                    if (CollectionUtil.isNotEmpty(collect1)) {
+                        childIdList.addAll(collect1);
+                        //获取collect的下级的下级的id
+                        collect1.stream().forEach(i -> {
+                            List<JyReimbursementTypeInfo> l = mapper.selectList(new LambdaQueryWrapper<JyReimbursementTypeInfo>().eq(JyReimbursementTypeInfo::getParentId, i));
+                            if (CollectionUtil.isNotEmpty(l)) {
+                                List<String> collect2 = l.stream().map(JyReimbursementTypeInfo::getId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
+                                if (CollectionUtil.isNotEmpty(collect2)) {
+                                    childIdList.addAll(collect2);
+                                }
+                            }
+                        });
+                    }
+                }
+            });
+            //将获取到的这几个id集合融合到一起并去重,然后根据id查询,即可得到结果
+            collect.addAll(cupIdList);
+            collect.addAll(cupIdPList);
+            collect.addAll(childIdList);
+
+            List<String> idList = collect.stream().distinct().collect(Collectors.toList());
+            if(CollectionUtil.isNotEmpty(idList)){
+                wrapper.in("a.id",idList);
+            }else{
+                return new ArrayList<>();
+            }
+        }
+//        wrapper.eq(JyReimbursementTypeInfo::getBusinessType, "1");
+
+        wrapper.eq("a.del_flag", 0);
+        wrapper.orderByAsc("a.sort");
+        return mapper.findList(wrapper);
+    }
+
+
+    /**
+     * 根据id查询项目详情
+     * @param id
+     * @return
+     */
+    public JyReimbursementTypeInfo getById(String id) {
+        JyReimbursementTypeInfo info = mapper.getById(id);
+        if( null != info && null != info.getOfficeDTOList() && info.getOfficeDTOList().size()>0){
+            List<String> officeIdList = Lists.newArrayList();
+            for (OfficeDTO office : info.getOfficeDTOList()) {
+                officeIdList.add(office.getId());
+            }
+            info.setOfficeIdList(officeIdList);
+        }
+        return info;
+    }
+
+    public List<JyReimbursementTypeInfo> bxList(JyReimbursementTypeInfo info) {
+        LambdaQueryWrapper<JyReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
+        if (StringUtils.isNotEmpty(info.getName())) {
+            wrapper.like(JyReimbursementTypeInfo::getName, info.getName());
+        }
+        if (ObjectUtil.isNotEmpty(info)) {
+            if (StringUtils.isNotBlank(info.getLike())){
+                wrapper.likeRight(JyReimbursementTypeInfo::getSort,info.getLike());
+            }
+        }
+        if (info.getSort() != null) {
+            wrapper.like(JyReimbursementTypeInfo::getSort, info.getSort());
+        }
+
+        wrapper.eq(BaseEntity::getDelFlag, 0);
+        wrapper.orderByAsc(JyReimbursementTypeInfo::getSort);
+        return mapper.selectList(wrapper);
+    }
+
+    public List<JyReimbursementTypeInfo> cgList(JyReimbursementTypeInfo info) {
+        LambdaQueryWrapper<JyReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
+        if (StringUtils.isNotEmpty(info.getName())) {
+            wrapper.like(JyReimbursementTypeInfo::getName, info.getName());
+        }
+        if (info.getSort() != null) {
+            wrapper.like(JyReimbursementTypeInfo::getSort, info.getSort());
+        }
+
+        wrapper.eq(BaseEntity::getDelFlag, 0);
+        wrapper.orderByAsc(JyReimbursementTypeInfo::getSort);
+        return mapper.selectList(wrapper);
+    }
+
+    public String save(JyReimbursementTypeInfo info) {
+        // parentId未传值,则表示一级菜单
+        if(StringUtils.isEmpty(info.getParentId())) {
+            info.setParentId("0");
+        }
+        // 保存数据
+        if (StringUtils.isNotEmpty(info.getId())) {
+            return update(info);
+        }
+        return add(info);
+    }
+
+    /**
+     * 新增
+     * @param info
+     * @return
+     */
+    public String add(JyReimbursementTypeInfo info) {
+        // 判断名称是否已存在
+        Integer isExist = mapper.checkNameIsExist(info.getName(), info.getParentId());
+        if (isExist > 0) {
+            return "false";
+        }
+        // 获取当前登录人信息
+        UserDTO userDto = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken ( ));
+//        UserDTO userDto = UserUtils.getCurrentUserDTO();
+        // 生成id值
+        String id = UUID.randomUUID().toString().replace("-", "");
+        info.setId(id);
+        info.setCreateById(userDto.getId());
+        info.setCreateTime(new Date());
+        info.setUpdateById(userDto.getId());
+        info.setUpdateTime(new Date());
+        info.setDelFlag(0);
+        // 生成序号/层级
+        getNo(info);
+        //对关联的公司id进行处理
+        if (null != info.getOfficeIdList() && info.getOfficeIdList().size()>0) {
+            //首先删除原有关联信息
+            mapper.deleteReimbursementTypeOfficeInfo(info.getId());
+            //将新的关联信息进行保存
+            mapper.saveReimbursementTypeOfficeInfo(info.getId(),info.getOfficeIdList());
+        }
+        info.setOfficeIdList(null);
+        mapper.insert(info);
+        return "操作完成";
+    }
+
+    /**
+     * 修改
+     * @param info
+     * @return
+     */
+    public String update(JyReimbursementTypeInfo info) {
+        // 获取当前登录人信息
+        UserDTO userDto = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken ( ));
+//        UserDTO userDto = UserUtils.getCurrentUserDTO();
+        info.setUpdateById(userDto.getId());
+        info.setUpdateTime(new Date());
+        //对关联的公司id进行处理
+        if (null != info.getOfficeIdList() && info.getOfficeIdList().size()>0) {
+            //首先删除原有关联信息
+            mapper.deleteReimbursementTypeOfficeInfo(info.getId());
+            //将新的关联信息进行保存
+            mapper.saveReimbursementTypeOfficeInfo(info.getId(),info.getOfficeIdList());
+//            info.setOfficeIdList(null);
+        } else if (null != info.getOfficeIdList() && info.getOfficeIdList().isEmpty()){
+            //首先删除原有关联信息
+            mapper.deleteReimbursementTypeOfficeInfo(info.getId());
+        }
+        info.setOfficeIdList(null);
+        mapper.updateById(info);
+        return "操作完成";
+    }
+
+    /**
+     * 生成序号/层级
+     * @param info
+     * @return
+     */
+    public JyReimbursementTypeInfo getNo(JyReimbursementTypeInfo info) {
+        JyReimbursementTypeInfo parentInfo = null;
+        if (!"0".equals(info.getParentId())) {
+            //根据parentId查询父节点信息
+            LambdaQueryWrapper<JyReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(BaseEntity::getDelFlag, 0);
+            wrapper.eq(BaseEntity::getId, info.getParentId());
+            parentInfo = mapper.selectOne(wrapper);
+        }
+        //查询序号
+        Integer no = mapper.getNo(info.getParentId());
+        // 该层级下有数据,正常返回序号值
+        if (no != null) {
+            info.setSort(no);
+        } else {
+            // 父节点存在,根据父节点序号生成;不存在,则表示无上级层级,从1开始
+            if (parentInfo != null) {
+                String s = parentInfo.getSort() + "01";
+                info.setSort(Integer.parseInt(s));
+            } else {
+                info.setSort(1);
+            }
+        }
+        // 生成层级
+        //查询层级
+        Integer level = mapper.getLevel(info.getParentId());
+        if (level != null) {
+            info.setLevel(level.toString());
+        } else {
+            // 父节点存在,根据父节点level生成,不存在,则表示无上级层级,从1开始
+            if (parentInfo != null) {
+                Integer i = Integer.parseInt(parentInfo.getLevel())+1;
+                info.setLevel(i.toString());
+            } else {
+                info.setLevel("1");
+            }
+        }
+        return info;
+    }
+
+
+
+    /**
+     * 根据报销类型查询判定项目是否单选还是多选
+     * @param typeId
+     * @return
+     */
+    public JyReimbursementTypeInfo findReimbursementTypeSingleSelectById(String typeId) {
+        //根据id查询父节点信息
+        JyReimbursementTypeInfo reimbursementTypeSingleSelectById = mapper.findReimbursementTypeSingleSelectById(typeId);
+        return reimbursementTypeSingleSelectById;
+    }
+}

+ 21 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/reimApprovalType/service/dto/JyReimbursementTypeDto.java

@@ -0,0 +1,21 @@
+package com.jeeplus.pubmodules.reimApprovalType.service.dto;
+
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-25 09:04
+ **/
+@Data
+public class JyReimbursementTypeDto extends BaseEntity {
+
+    private String level;
+
+    private String name;
+
+    private Integer sort;
+
+    private String parentId;
+
+}