浏览代码

多公司报销调整

sangwenwei 1 年之前
父节点
当前提交
d0e3f29394

+ 3 - 1
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/reimbursement/reimbursementInfo/mapper/ReimbursementInfoMapper.java

@@ -23,7 +23,7 @@ public interface ReimbursementInfoMapper extends BaseMapper<ReimbursementInfo> {
     List<WorkAttachmentInfo> findFiles(@Param("id") String id);
 
     void updateStatusById(@Param("id") String id, @Param("type") String type);
-
+    @InterceptorIgnore(tenantLine = "true")
     List<TreeUserDto> findOfficeList();
 
     /**
@@ -75,4 +75,6 @@ public interface ReimbursementInfoMapper extends BaseMapper<ReimbursementInfo> {
     List<ReimbursementAmountInfoDTO> getInvoiceReimbursementAmountList(@Param("idList") List<String> idList);
     @InterceptorIgnore(tenantLine = "true")
     List<TreeUserDto> findZhglgsUserList( @Param("name")String name);
+    @InterceptorIgnore(tenantLine = "true")
+    List<TreeUserDto> finduserAllList(@Param("name")String name);
 }

+ 18 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/reimbursement/reimbursementInfo/mapper/xml/ReimbursementInfoMapper.xml

@@ -156,6 +156,24 @@
 		</if>
 	</select>
 
+	<select id="finduserAllList" resultType="com.jeeplus.assess.reimbursement.reimbursementInfo.service.dto.TreeUserDto">
+		SELECT
+		a.id,
+		a.`name`,
+		a.office_id AS parent_id,
+		b.`name` AS office_name,
+		true AS is_user
+		FROM
+		sys_user a
+		LEFT JOIN sys_office b ON a.office_id = b.id
+		WHERE
+		a.del_flag = 0 and a.is_admin is null
+		<if test="name != null and name != ''">
+			and a.`name` LIKE CONCAT ('%', #{name}, '%')
+		</if>
+	</select>
+
+
 	<select id="findExportList" resultType="com.jeeplus.assess.reimbursement.reimbursementInfo.service.dto.RetureListDto">
 		SELECT
 			a.id,

+ 15 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/reimbursement/reimbursementInfo/service/ReimbursementInfoService.java

@@ -661,6 +661,7 @@ public class ReimbursementInfoService {
     public List<TreeUserDto> userTree(String name) {
         UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
         List<TreeUserDto> list = new ArrayList<>();
+
         // 查询部门
         List<TreeUserDto> officeList = infoMapper.findOfficeListByCompanyId(userDTO.getCompanyDTO().getId());
         List<TreeUserDto> filterList = new ArrayList<>();
@@ -669,6 +670,19 @@ public class ReimbursementInfoService {
         UserDTO dtoByName = SpringUtil.getBean(IUserApi.class).getByLoginName("潘中","10002");
         List<TreeUserDto> officeList1 = infoMapper.findOfficeListByCompanyId(dtoByName.getCompanyDTO().getId());
         filterList.addAll(officeList1);
+        ArrayList<TreeUserDto> treeUsers = new ArrayList<>();
+        //如果当前登录人角色是多公司报销则查询全部公司
+        if (CollectionUtil.isNotEmpty(userDTO.getRoleDTOList())){
+            for (RoleDTO roleDTO : userDTO.getRoleDTOList()) {
+                RoleDTO roleDTOById = SpringUtil.getBean(IRoleApi.class).getRoleDTOById(roleDTO.getId());
+                if (roleDTOById.getEnName().equals("dgsbx")){
+                    List<TreeUserDto> officeList2 = infoMapper.findOfficeList();
+                    filterList.addAll(officeList2);
+                    List<TreeUserDto> users=infoMapper.finduserAllList(name);
+                    treeUsers.addAll(users);
+                }
+            }
+        }
         /*if (userDTO.isAdmin ()) {
             filterList = officeList;
         } else {
@@ -764,6 +778,7 @@ public class ReimbursementInfoService {
         ArrayList<TreeUserDto> treeUserDtos = new ArrayList<>();
         treeUserDtos.addAll(userList);
         treeUserDtos.addAll(userList1);
+        treeUserDtos.addAll(treeUsers);
         list = disposeUserTree(treeUserDtos, filterList);
         for (TreeUserDto officeDto : officeList) {
             if("0".equals(officeDto.getParentId())){