Parcourir la source

Merge remote-tracking branch 'origin/master'

user5 il y a 2 ans
Parent
commit
1c0600520e

+ 15 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reimbursementApproval/approvalType/domain/OfficeDomain.java

@@ -0,0 +1,15 @@
+package com.jeeplus.test.cw.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
+}

+ 22 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reimbursementApproval/approvalType/mapper/CwReimbursementTypeMapper.java

@@ -10,6 +10,7 @@ import com.jeeplus.core.domain.TreeMapper;
 import com.jeeplus.test.cw.projectRecords.domain.CwProjectRecords;
 import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectRecordsDTO;
 import com.jeeplus.test.cw.reimbursementApproval.approvalType.domain.CwReimbursementTypeInfo;
+import com.jeeplus.test.cw.reimbursementApproval.approvalType.domain.OfficeDomain;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -32,6 +33,27 @@ public interface CwReimbursementTypeMapper extends BaseMapper<CwReimbursementTyp
                                           @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

+ 32 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reimbursementApproval/approvalType/mapper/xml/CwReimbursementTypeMapper.xml

@@ -237,6 +237,38 @@
 				) t
 			${ew.customSqlSegment}
 	</select>
+	<select id="officeInfo"
+			resultType="com.jeeplus.test.cw.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.test.cw.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.test.cw.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}

+ 22 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reimbursementApproval/approvalType/service/CwReimbursementTypeService.java

@@ -11,6 +11,7 @@ import com.jeeplus.sys.utils.UserUtils;
 import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectClientContactDTO;
 import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectRecordsDTO;
 import com.jeeplus.test.cw.reimbursementApproval.approvalType.domain.CwReimbursementTypeInfo;
+import com.jeeplus.test.cw.reimbursementApproval.approvalType.domain.OfficeDomain;
 import com.jeeplus.test.cw.reimbursementApproval.approvalType.mapper.CwReimbursementTypeMapper;
 import com.jeeplus.test.cw.workClientInfo.domain.CwWorkClientContact;
 import org.apache.commons.compress.utils.Lists;
@@ -48,6 +49,27 @@ public class CwReimbursementTypeService {
 
         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()) &&
+                        officeDomains.get(i+1).getGrade().equals("1")){
+                    info.setOfficeId(officeDomains.get(i).getId());
+                }
+            }
+        }
         return mapper.bxList2(wrapper,info.getOfficeId());
     }
 

+ 2 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/roster/domain/RosterBase.java

@@ -82,6 +82,7 @@ public class RosterBase extends BaseEntity {
     /**
      * 手机号码
      */
+    @Query(type = QueryType.LIKE, tableColumn = "rb.mobile")
     private String mobile;
 
     /**
@@ -228,6 +229,7 @@ public class RosterBase extends BaseEntity {
     /**
      * 人员类型  1员工  2游客
      */
+    @Query(type = QueryType.EQ, tableColumn = "rb.person_type")
     private String personType;
 
     /**

+ 0 - 15
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -231,21 +231,6 @@ public class UserController {
         if ( isCheckLoginName ( userDTO.getOldLoginName ( ),userDTO.getId(), userDTO.getLoginName ( ) ) ) {
             return ResponseEntity.badRequest ( ).body ( "保存用户'" + userDTO.getLoginName ( ) + "'失败,登录名已存在!" );
         }
-        //对管理部门做查询操作,根据名称查询部门id信息
-        if(StringUtils.isNotBlank(userDTO.getManageOfficeIds())){
-            List<String> officeIdList = Lists.newLinkedList();
-            //获取当前人管理的部门名称
-            List<String> manageOfficeNameList=Arrays.asList(userDTO.getManageOfficeIds().split(","));
-            if(manageOfficeNameList.size()>0){
-                //查询这些部门信息
-                officeIdList = officeService.getOfficeIdByNames(manageOfficeNameList);
-                if(officeIdList.size()>0){
-                    String officeIds = String.join(",", officeIdList);
-                    userDTO.setManageOfficeIds(officeIds);
-                }
-            }
-            userService.updateUserManageOffice(officeIdList,userDTO);
-        }
         // 保存用户信息
         userService.saveOrUpdate ( userDTO );
         return ResponseEntity.ok ( "保存用户'" + userDTO.getLoginName ( ) + "'成功!" );

+ 1 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/xml/OfficeMapper.xml

@@ -137,6 +137,7 @@
         from sys_office a
         <where>
             a.parent_id in (select id from sys_office where parent_id = 0)
+            and a.del_flag = 0
         </where>
     </select>
 </mapper>

+ 9 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/UserService.java

@@ -273,8 +273,17 @@ public class UserService  extends ServiceImpl<UserMapper, User> {
 				baseMapper.insertUserPost ( userDTO.getId (), postDTO.getId () );
 			} );
 		}
+		// 更新用户的管理部门
+		List<String> officeIdList = new ArrayList<>();
+		if(StringUtils.isNotBlank(userDTO.getManageOfficeIds())){
+			List<String> officeIds = Arrays.asList(userDTO.getManageOfficeIds().split(","));
+			officeIdList.addAll(officeIds);
+		}
+		this.updateUserManageOffice(officeIdList, userDTO);
+
 		// 新增/修改关联花名册数据
 		this.saveOrUpdateRoster(user);
+
 		UserUtils.deleteCache ( userDTO );
 	}