wangqiang 2 år sedan
förälder
incheckning
08bd742547

+ 0 - 153
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reimbursementApproval/approvalType/controller/CwReimbursementTypeController.java

@@ -1,153 +0,0 @@
-package com.jeeplus.finance.reimbursementApproval.approvalType.controller;
-
-import com.jeeplus.finance.reimbursementApproval.approvalType.domain.CwReimbursementTypeInfo;
-import com.jeeplus.finance.reimbursementApproval.approvalType.mapper.CwReimbursementTypeMapper;
-import com.jeeplus.finance.reimbursementApproval.approvalType.service.CwReimbursementTypeForTreeDataService;
-import com.jeeplus.finance.reimbursementApproval.approvalType.service.CwReimbursementTypeService;
-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 = "/reimbursementApproval/type")
-public class CwReimbursementTypeController {
-
-    @Resource
-    private CwReimbursementTypeService service;
-
-    @Resource
-    private CwReimbursementTypeForTreeDataService treeService;
-
-    @Resource
-    private CwReimbursementTypeMapper mapper;
-
-    /**
-     * 列表查询
-     * @param info
-     * @return
-     */
-    @ApiOperation(value = "列表查询")
-    @GetMapping("/list")
-    public ResponseEntity<List<CwReimbursementTypeInfo>> list(CwReimbursementTypeInfo info) {
-        List<CwReimbursementTypeInfo> list = service.list(info);
-        return ResponseEntity.ok(list);
-    }
-
-    /**
-     * 列表查询
-     * @param info
-     * @return
-     */
-    @ApiOperation(value = "列表查询")
-    @GetMapping("/bxList")
-    public ResponseEntity<List<CwReimbursementTypeInfo>> bxList(CwReimbursementTypeInfo info) {
-        List<CwReimbursementTypeInfo> list = service.bxList2(info);
-        return ResponseEntity.ok(list);
-    }
-
-    /**
-     * 采购类型列表查询
-     * @param info
-     * @return
-     */
-    @ApiOperation(value = "采购类型列表查询")
-    @GetMapping("/cgList")
-    public ResponseEntity<List<CwReimbursementTypeInfo>> cgList(CwReimbursementTypeInfo info) {
-        List<CwReimbursementTypeInfo> list = service.cgList(info);
-        return ResponseEntity.ok(list);
-    }
-
-    /**
-     * 新增/修改
-     * @param info
-     * @return
-     */
-    @ApiOperation(value = "新增/修改")
-    @PostMapping("/save")
-    public ResponseEntity<String> save(@RequestBody CwReimbursementTypeInfo info) {
-        String s = service.save(info);
-        return ResponseEntity.ok(s);
-    }
-
-    /**
-     * 根据id查询
-     * @param id
-     * @return
-     */
-    @ApiOperation(value = "根据id查询")
-    @GetMapping("/findById")
-    public ResponseEntity<CwReimbursementTypeInfo> findById(String id) {
-        CwReimbursementTypeInfo 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<CwReimbursementTypeInfo>> treeData(@RequestParam(required = false) String extId, @RequestParam(required = false) String type) throws Exception{
-        List<CwReimbursementTypeInfo> infos = treeService.treeDataForType(extId, type);
-        return ResponseEntity.ok(infos);
-    }
-
-    /**
-     * 查询树形
-     * @param extId 排除的ID
-     * @return
-     */
-    @ApiOperation(value = "查询树形")
-    @GetMapping("/treeData1")
-    public ResponseEntity<List<CwReimbursementTypeInfo>> treeData1(@RequestParam(required = false) String extId, @RequestParam(required = false) String type) throws Exception{
-        List<CwReimbursementTypeInfo> infos = treeService.treeDataForType1(extId, type);
-        return ResponseEntity.ok(infos);
-    }
-
-    /**
-     * 查询树形
-     * @param extId 排除的ID
-     * @return
-     */
-    @ApiOperation(value = "查询树形")
-    @GetMapping("/summaryTreeData")
-    public ResponseEntity<List<CwReimbursementTypeInfo>> summaryTreeData(@RequestParam(required = false) String extId, @RequestParam(required = false) String type) throws Exception{
-        List<CwReimbursementTypeInfo> infos = treeService.summaryTreeData(extId, type);
-        return ResponseEntity.ok(infos);
-    }
-
-    /**
-     * 查询树形
-     * @param extId 排除的ID
-     * @return
-     */
-    @ApiOperation(value = "查询树形")
-    @GetMapping("/treeData2")
-    public ResponseEntity<List<CwReimbursementTypeInfo>> treeData2(@RequestParam(required = false) String extId, @RequestParam(required = false) String type) throws Exception{
-        List<CwReimbursementTypeInfo> infos = treeService.treeDataForType2(extId, type);
-        return ResponseEntity.ok(infos);
-    }
-
-}

+ 0 - 105
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reimbursementApproval/approvalType/domain/CwReimbursementTypeInfo.java

@@ -1,105 +0,0 @@
-package com.jeeplus.finance.reimbursementApproval.approvalType.domain;
-
-import com.baomidou.mybatisplus.annotation.*;
-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.Date;
-import java.util.List;
-
-/**
- * 报销类型信息列表
- * @author: 王强
- * @create: 2022-11-25 08:59
- **/
-@Data
-@TableName(value = "cw_reimbursement_type_info")
-public class CwReimbursementTypeInfo extends TreeEntity<CwReimbursementTypeInfo> {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 实体主键
-     */
-    @TableId
-    private String id;
-
-    /**
-     * 创建日期
-     */
-    @TableField(fill = FieldFill.INSERT)
-    private Date createDate;
-
-    /**
-     * 创建人
-     */
-    @Query
-    @TableField(fill = FieldFill.INSERT)
-    private String createBy;
-
-    /**
-     * 更新日期
-     */
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private Date updateDate;
-
-    /**
-     * 更新人
-     */
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private String updateBy;
-
-    /**
-     * 逻辑删除标记
-     */
-    @TableLogic
-    @TableField(fill = FieldFill.INSERT)
-    private Integer delFlag;
-
-    /**
-     * 层级
-     */
-    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;
-}

+ 0 - 15
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reimbursementApproval/approvalType/domain/OfficeDomain.java

@@ -1,15 +0,0 @@
-package com.jeeplus.finance.reimbursementApproval.approvalType.domain;
-
-import lombok.Data;
-
-/**
- * @author: 王强
- * @create: 2023-02-15 13:31
- **/
-@Data
-public class OfficeDomain {
-    private String id;     //部门id
-    private String name;    //部门名称
-    private String grade;   //部门等级
-    private String parentId; //父级部门id
-}

+ 0 - 92
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reimbursementApproval/approvalType/mapper/CwReimbursementTypeMapper.java

@@ -1,92 +0,0 @@
-package com.jeeplus.finance.reimbursementApproval.approvalType.mapper;
-
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Constants;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.jeeplus.core.domain.TreeMapper;
-import com.jeeplus.finance.reimbursementApproval.approvalType.domain.CwReimbursementTypeInfo;
-import com.jeeplus.finance.reimbursementApproval.approvalType.domain.OfficeDomain;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author: 王强
- * @create: 2022-11-25 09:02
- **/
-public interface CwReimbursementTypeMapper extends BaseMapper<CwReimbursementTypeInfo>, TreeMapper<CwReimbursementTypeInfo> {
-
-    /**
-     * 查询数据集合
-     * @param queryWrapper
-     * @return
-     */
-    List<CwReimbursementTypeInfo> findList(@Param(Constants.WRAPPER) Wrapper<CwReimbursementTypeInfo> queryWrapper);
-
-
-    List<CwReimbursementTypeInfo> bxList2(@Param(Constants.WRAPPER) Wrapper<CwReimbursementTypeInfo> 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
-     */
-    CwReimbursementTypeInfo 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
-     */
-    List<CwReimbursementTypeInfo> getAllList();
-
-    /**
-     * 删除报销类型关联表对应信息
-     * @param id
-     */
-    void deleteReimbursementTypeOfficeInfo(String id);
-
-    /**
-     * 新增报销类型和部门关联信息
-     * @param id
-     * @param OfficeIdList
-     */
-    void saveReimbursementTypeOfficeInfo(@Param("id") String id , @Param("officeIdList") List<String> OfficeIdList);
-}

+ 0 - 282
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reimbursementApproval/approvalType/mapper/xml/CwReimbursementTypeMapper.xml

@@ -1,282 +0,0 @@
-<?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.finance.reimbursementApproval.approvalType.mapper.CwReimbursementTypeMapper">
-	<resultMap id="BaseResultMap" type="com.jeeplus.finance.reimbursementApproval.approvalType.domain.CwReimbursementTypeInfo">
-		<id property="id" column="id" jdbcType="VARCHAR"/>
-		<result property="createBy" column="create_by_id" jdbcType="VARCHAR"/>
-		<result property="createDate" column="create_time" jdbcType="TIMESTAMP"/>
-		<result property="updateBy" column="update_by_id" jdbcType="VARCHAR"/>
-		<result property="updateDate" 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_id as "areaId",
-        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 "createDate",
-		so.update_by_id as "updateBy.id",
-		so.update_time as "updateDate",
-        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 cw_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 cw_reimbursement_type_info a
-		LEFT JOIN
-		(SELECT GROUP_CONCAT(c.name) as name,c.office_id,c.reimbursement_type_id FROM
-		(SELECT name,cw.office_id,cw.reimbursement_type_id
-		FROM cw_reimbursement_type_office_info cw
-		LEFT JOIN sys_office so on cw.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 cw_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
-			cw_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
-			cw_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
-			cw_reimbursement_type_info
-		WHERE
-			del_flag = 0
-			AND id = #{parentId}
-    </select>
-	<select id="getChildId" resultType="java.lang.String">
-		select id from cw_reimbursement_type_info where parent_id = #{id}
-	</select>
-	<select id="getAllList"
-			resultType="com.jeeplus.finance.reimbursementApproval.approvalType.domain.CwReimbursementTypeInfo">
-		select * from cw_reimbursement_type_info where  del_flag = '0' order by sort asc
-	</select>
-	<select id="bxList2"
-			resultType="com.jeeplus.finance.reimbursementApproval.approvalType.domain.CwReimbursementTypeInfo">
-		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
-					cw_reimbursement_type_info a
-				WHERE
-					del_flag = 0
-					AND a.id IN (
-					SELECT
-						id
-					FROM
-						cw_reimbursement_type_info a
-					WHERE
-						del_flag = 0
-					AND a.parent_id NOT IN ( SELECT b.reimbursement_type_id FROM cw_reimbursement_type_office_info b)
-					AND a.id NOT IN ( SELECT b.reimbursement_type_id FROM cw_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
-					cw_reimbursement_type_info a
-					WHERE
-					del_flag = 0
-					and a.parent_id in (SELECT b.reimbursement_type_id FROM cw_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
-					cw_reimbursement_type_info a
-					WHERE
-					del_flag = 0
-					and a.parent_id in
-						(SELECT
-							id
-						FROM
-							cw_reimbursement_type_info a
-						WHERE
-							del_flag = 0
-							and a.parent_id in (SELECT b.reimbursement_type_id FROM cw_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
-					cw_reimbursement_type_info a
-					WHERE
-					del_flag = 0
-					and a.id in (SELECT b.reimbursement_type_id FROM cw_reimbursement_type_office_info b WHERE b.office_id = #{officeId})
-				) t
-			${ew.customSqlSegment}
-	</select>
-	<select id="officeInfo"
-			resultType="com.jeeplus.finance.reimbursementApproval.approvalType.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.finance.reimbursementApproval.approvalType.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.finance.reimbursementApproval.approvalType.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 cw_reimbursement_type_office_info where reimbursement_type_id = #{id}
-	</delete>
-
-	<insert id="saveReimbursementTypeOfficeInfo">
-		<foreach collection="officeIdList" item="officeId" separator=";">
-			insert into cw_reimbursement_type_office_info(reimbursement_type_id,office_id) values(#{id},#{officeId})
-		</foreach>
-	</insert>
-</mapper>

+ 0 - 178
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reimbursementApproval/approvalType/service/CwReimbursementTypeForTreeDataService.java

@@ -1,178 +0,0 @@
-package com.jeeplus.finance.reimbursementApproval.approvalType.service;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.jeeplus.core.service.TreeService;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.jeeplus.core.service.dto.TreeDTO;
-import com.jeeplus.finance.reimbursementApproval.approvalType.domain.CwReimbursementTypeInfo;
-import com.jeeplus.finance.reimbursementApproval.approvalType.mapper.CwReimbursementTypeMapper;
-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 CwReimbursementTypeForTreeDataService extends TreeService<CwReimbursementTypeMapper, CwReimbursementTypeInfo> {
-
-    @Resource
-    private CwReimbursementTypeMapper typeMapper;
-
-    /**
-     * 获取JSON树形数据。
-     *
-     * @param extId 排除的ID
-     * @param type 禁选类型
-     * @return
-     */
-    public List<CwReimbursementTypeInfo> treeDataForType(String extId, String type) throws Exception{
-        //获取所有的业务类型为1的数据
-//        List<CwReimbursementTypeInfo> allList = typeMapper.getAllList("1");
-        List<CwReimbursementTypeInfo> allList = typeMapper.findList (new LambdaQueryWrapper<>( (Class <CwReimbursementTypeInfo>) entityClass ).orderByAsc ( CwReimbursementTypeInfo::getSort ));
-        CwReimbursementTypeInfo root = entityClass.getConstructor ( ).newInstance ( );
-        root.setId ( TreeDTO.getRootId () );
-        List <CwReimbursementTypeInfo> rootTree = this.formatListToTreeForType ( root, allList, extId, type );
-        return rootTree;
-    }
-
-    /**
-     * 获取JSON树形数据。
-     *
-     * @param extId 排除的ID
-     * @param type 禁选类型
-     * @return
-     */
-    public List<CwReimbursementTypeInfo> treeDataForType1(String extId, String type) throws Exception{
-        //获取所有的业务类型为1的数据
-        List<CwReimbursementTypeInfo> allList = typeMapper.getAllList();
-//        List<CwReimbursementTypeInfo> allList = super.list (new LambdaQueryWrapper<>( (Class <CwReimbursementTypeInfo>) entityClass ).orderByAsc ( CwReimbursementTypeInfo::getSort ));
-        CwReimbursementTypeInfo root = entityClass.getConstructor ( ).newInstance ( );
-        root.setId ( TreeDTO.getRootId () );
-        List <CwReimbursementTypeInfo> rootTree = this.formatListToTreeForType ( root, allList, extId, type );
-        return rootTree;
-    }
-
-    /**
-     * 获取JSON树形数据。
-     *
-     * @param extId 排除的ID
-     * @param type 禁选类型
-     * @return
-     */
-    public List<CwReimbursementTypeInfo> summaryTreeData(String extId, String type) throws Exception{
-        //获取所有的业务类型为1的数据
-        List<CwReimbursementTypeInfo> allList = typeMapper.getAllList();
-        CwReimbursementTypeInfo root = entityClass.getConstructor ( ).newInstance ( );
-        root.setId ( TreeDTO.getRootId () );
-        List <CwReimbursementTypeInfo> rootTree = this.formatListToTreeForType ( root, allList, extId, type );
-        return rootTree;
-    }
-
-    /**
-     * 获取JSON树形数据。
-     *
-     * @param extId 排除的ID
-     * @param type 禁选类型
-     * @return
-     */
-    public List<CwReimbursementTypeInfo> treeDataForType2(String extId, String type) throws Exception{
-        //获取所有的业务类型为1的数据
-        List<CwReimbursementTypeInfo> allList = typeMapper.getAllList();
-//        List<CwReimbursementTypeInfo> allList = super.list (new LambdaQueryWrapper<>( (Class <CwReimbursementTypeInfo>) entityClass ).orderByAsc ( CwReimbursementTypeInfo::getSort ));
-        CwReimbursementTypeInfo root = entityClass.getConstructor ( ).newInstance ( );
-        root.setId ( TreeDTO.getRootId () );
-        List <CwReimbursementTypeInfo> 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 <CwReimbursementTypeInfo> formatListToTreeForType (CwReimbursementTypeInfo root, List <CwReimbursementTypeInfo> allList, String extId, String type) {
-        String rootId = root.getId ( );
-        // 最终的树形态
-        List <CwReimbursementTypeInfo> trees = Lists.newArrayList ( );
-
-        // 把需要构造树的所有列表, 根据以父id作为key, 整理为列表
-        Map<String, List <CwReimbursementTypeInfo>> treeMap = Maps.newHashMap ( );
-        for (CwReimbursementTypeInfo entity : allList) {
-            List <CwReimbursementTypeInfo> 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 <CwReimbursementTypeInfo> children = treeMap.get ( rootId );
-        for (CwReimbursementTypeInfo 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(CwReimbursementTypeInfo parent, Map <String, List <CwReimbursementTypeInfo>> treeMap) {
-        List <CwReimbursementTypeInfo> children = treeMap.get ( parent.getId ( ) );
-        parent.setChildren ( children );
-        if ( children != null && !children.isEmpty ( ) ) {
-            for (CwReimbursementTypeInfo child : children) {
-                formatFillChildren ( child, treeMap );
-            }
-        }
-    }
-}

+ 0 - 345
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reimbursementApproval/approvalType/service/CwReimbursementTypeService.java

@@ -1,345 +0,0 @@
-package com.jeeplus.finance.reimbursementApproval.approvalType.service;
-
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.jeeplus.core.domain.BaseEntity;
-import com.jeeplus.finance.reimbursementApproval.approvalType.domain.CwReimbursementTypeInfo;
-import com.jeeplus.finance.reimbursementApproval.approvalType.domain.OfficeDomain;
-import com.jeeplus.finance.reimbursementApproval.approvalType.mapper.CwReimbursementTypeMapper;
-import com.jeeplus.sys.service.dto.OfficeDTO;
-import com.jeeplus.sys.service.dto.UserDTO;
-import com.jeeplus.sys.utils.UserUtils;
-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.*;
-import java.util.stream.Collectors;
-
-/**
- * @author: 王强
- * @create: 2022-11-25 09:13
- **/
-@Service
-public class CwReimbursementTypeService {
-
-    @Resource
-    private CwReimbursementTypeMapper mapper;
-
-    public List<CwReimbursementTypeInfo> bxList2(CwReimbursementTypeInfo info) {
-        LambdaQueryWrapper<CwReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
-        if(StringUtils.isNotBlank(info.getName())){
-            //根据type模糊查询
-            List<CwReimbursementTypeInfo> cwReimbursementTypeInfoList = mapper.selectList(new QueryWrapper<CwReimbursementTypeInfo>().lambda()
-                    .like(StringUtils.isNotBlank(info.getName()), CwReimbursementTypeInfo::getName, info.getName())
-            );
-            List<String> collect = cwReimbursementTypeInfoList.stream().map(CwReimbursementTypeInfo::getId).collect(Collectors.toList());
-            //materialTypeInfoList的父级id全部获取
-            List<String> cupIdList = cwReimbursementTypeInfoList.stream().map(CwReimbursementTypeInfo::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 -> {
-                    CwReimbursementTypeInfo 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<CwReimbursementTypeInfo> list = mapper.selectList(new LambdaQueryWrapper<CwReimbursementTypeInfo>().eq(CwReimbursementTypeInfo::getParentId, item));
-                if (CollectionUtil.isNotEmpty(list)) {
-                    List<String> collect1 = list.stream().map(CwReimbursementTypeInfo::getId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
-                    if (CollectionUtil.isNotEmpty(collect1)) {
-                        childIdList.addAll(collect1);
-                        //获取collect的下级的下级的id
-                        collect1.stream().forEach(i -> {
-                            List<CwReimbursementTypeInfo> l = mapper.selectList(new LambdaQueryWrapper<CwReimbursementTypeInfo>().eq(CwReimbursementTypeInfo::getParentId, i));
-                            if (CollectionUtil.isNotEmpty(l)) {
-                                List<String> collect2 = l.stream().map(CwReimbursementTypeInfo::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(CwReimbursementTypeInfo::getId,idList);
-            }else{
-                return new ArrayList<>();
-            }
-        }
-        if (ObjectUtil.isNotEmpty(info)) {
-            if (StringUtils.isNotBlank(info.getLike())){
-                wrapper.likeRight(CwReimbursementTypeInfo::getSort,info.getLike());
-            }
-        }
-//        if (info.getSort() != null) {
-//            wrapper.like(CwReimbursementTypeInfo::getSort, info.getSort());
-//        }
-
-        wrapper.eq(BaseEntity::getDelFlag, 0);
-        wrapper.orderByAsc(CwReimbursementTypeInfo::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.isNotEmpty(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<CwReimbursementTypeInfo> list(CwReimbursementTypeInfo info) {
-        QueryWrapper<CwReimbursementTypeInfo> wrapper = new QueryWrapper<>();
-        if(StringUtils.isNotBlank(info.getName())){
-            //根据type模糊查询
-            List<CwReimbursementTypeInfo> cwReimbursementTypeInfoList = mapper.selectList(new QueryWrapper<CwReimbursementTypeInfo>().lambda()
-                    .like(StringUtils.isNotBlank(info.getName()), CwReimbursementTypeInfo::getName, info.getName())
-            );
-            List<String> collect = cwReimbursementTypeInfoList.stream().map(CwReimbursementTypeInfo::getId).collect(Collectors.toList());
-            //materialTypeInfoList的父级id全部获取
-            List<String> cupIdList = cwReimbursementTypeInfoList.stream().map(CwReimbursementTypeInfo::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 -> {
-                    CwReimbursementTypeInfo 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<CwReimbursementTypeInfo> list = mapper.selectList(new LambdaQueryWrapper<CwReimbursementTypeInfo>().eq(CwReimbursementTypeInfo::getParentId, item));
-                if (CollectionUtil.isNotEmpty(list)) {
-                    List<String> collect1 = list.stream().map(CwReimbursementTypeInfo::getId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
-                    if (CollectionUtil.isNotEmpty(collect1)) {
-                        childIdList.addAll(collect1);
-                        //获取collect的下级的下级的id
-                        collect1.stream().forEach(i -> {
-                            List<CwReimbursementTypeInfo> l = mapper.selectList(new LambdaQueryWrapper<CwReimbursementTypeInfo>().eq(CwReimbursementTypeInfo::getParentId, i));
-                            if (CollectionUtil.isNotEmpty(l)) {
-                                List<String> collect2 = l.stream().map(CwReimbursementTypeInfo::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(CwReimbursementTypeInfo::getBusinessType, "1");
-
-        wrapper.eq("a.del_flag", 0);
-        wrapper.orderByAsc("a.sort");
-        return mapper.findList(wrapper);
-    }
-
-
-    /**
-     * 根据id查询项目详情
-     * @param id
-     * @return
-     */
-    public CwReimbursementTypeInfo getById(String id) {
-        CwReimbursementTypeInfo info = mapper.getById(id);
-        if(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<CwReimbursementTypeInfo> bxList(CwReimbursementTypeInfo info) {
-        LambdaQueryWrapper<CwReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
-        if (StringUtils.isNotEmpty(info.getName())) {
-            wrapper.like(CwReimbursementTypeInfo::getName, info.getName());
-        }
-        if (ObjectUtil.isNotEmpty(info)) {
-            if (StringUtils.isNotBlank(info.getLike())){
-                wrapper.likeRight(CwReimbursementTypeInfo::getSort,info.getLike());
-            }
-        }
-        if (info.getSort() != null) {
-            wrapper.like(CwReimbursementTypeInfo::getSort, info.getSort());
-        }
-
-        wrapper.eq(BaseEntity::getDelFlag, 0);
-        wrapper.orderByAsc(CwReimbursementTypeInfo::getSort);
-        return mapper.selectList(wrapper);
-    }
-
-    public List<CwReimbursementTypeInfo> cgList(CwReimbursementTypeInfo info) {
-        LambdaQueryWrapper<CwReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
-        if (StringUtils.isNotEmpty(info.getName())) {
-            wrapper.like(CwReimbursementTypeInfo::getName, info.getName());
-        }
-        if (info.getSort() != null) {
-            wrapper.like(CwReimbursementTypeInfo::getSort, info.getSort());
-        }
-
-        wrapper.eq(BaseEntity::getDelFlag, 0);
-        wrapper.orderByAsc(CwReimbursementTypeInfo::getSort);
-        return mapper.selectList(wrapper);
-    }
-
-    public String save(CwReimbursementTypeInfo 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(CwReimbursementTypeInfo info) {
-        // 判断名称是否已存在
-        Integer isExist = mapper.checkNameIsExist(info.getName(), info.getParentId());
-        if (isExist > 0) {
-            return "false";
-        }
-        // 获取当前登录人信息
-        UserDTO userDto = UserUtils.getCurrentUserDTO();
-        // 生成id值
-        String id = UUID.randomUUID().toString().replace("-", "");
-        info.setId(id);
-        info.setCreateBy(userDto.getId());
-        info.setCreateDate(new Date());
-        info.setUpdateBy(userDto.getId());
-        info.setUpdateDate(new Date());
-        info.setDelFlag(0);
-        // 生成序号/层级
-        getNo(info);
-        mapper.insert(info);
-        return "操作完成";
-    }
-
-    /**
-     * 修改
-     * @param info
-     * @return
-     */
-    public String update(CwReimbursementTypeInfo info) {
-        // 获取当前登录人信息
-        UserDTO userDto = UserUtils.getCurrentUserDTO();
-        info.setUpdateBy(userDto.getId());
-        info.setUpdateDate(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 CwReimbursementTypeInfo getNo(CwReimbursementTypeInfo info) {
-        CwReimbursementTypeInfo parentInfo = null;
-        if (!"0".equals(info.getParentId())) {
-            //根据parentId查询父节点信息
-            LambdaQueryWrapper<CwReimbursementTypeInfo> 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;
-    }
-}

+ 0 - 21
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reimbursementApproval/approvalType/service/dto/CwReimbursementTypeDto.java

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