Browse Source

新增通用指定用户所在部门的分管领导

chenjun 4 months ago
parent
commit
6f5aaf0914

+ 37 - 0
zjugis-module-system/zjugis-module-system-biz/src/main/java/com/zjugis/module/system/controller/admin/ip/IpController.java

@@ -0,0 +1,37 @@
+package com.zjugis.module.system.controller.admin.ip;
+
+import com.zjugis.framework.common.pojo.CommonResult;
+import com.zjugis.framework.common.util.servlet.ServletUtils;
+import com.zjugis.framework.ip.core.Area;
+import com.zjugis.framework.ip.core.utils.AreaUtils;
+import com.zjugis.framework.ip.core.utils.IPUtils;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import static com.zjugis.framework.common.pojo.CommonResult.success;
+
+/**
+ * @Author 陈俊
+ * @Date 2024/5/31 13:40
+ * @Version 1.0
+ */
+@Tag(name = "管理后台 - IP")
+@RestController
+@RequestMapping("/system/ip")
+@Validated
+public class IpController {
+
+    @GetMapping("/auth-admin-ip")
+    @Operation(summary = "判断IP是否能访问AdminLogin")
+    public CommonResult<Boolean> getAreaByIp() {
+        String clientIP = ServletUtils.getClientIP();
+        // 格式化返回
+        return success(true);
+    }
+}

+ 14 - 0
zjugis-workflow/src/main/java/com/zjugis/z_workflow/controller/TParticipantFilterController.java

@@ -125,6 +125,19 @@ public class TParticipantFilterController extends BaseController {
 					map.put("participantTypeSecondaryUserText", participantTypeSecondaryUserText);
 					map.put("participantTypeSecondaryUserJSON", JSON.toJSONString(participantTypeSecondaryUser));
 					break;
+                case ASSIGN_USER_DEPT_LEADER://指定用户所在部门的分管领导
+                    //参与人类型指定次级指定用户
+                    String participantTypeSecondaryUserText2 = "请选择";
+                    Select[] participantTypeSecondaryUser2 = Selects.getParticipantTypeSecondaryUser();
+                    for (Select select : participantTypeSecondaryUser2) {
+                        if (select.getValue().equals(filterEntity.getParticipantTypeSecondary())) {
+                            participantTypeSecondaryUserText2 = select.getText();
+                            break;
+                        }
+                    }
+                    map.put("participantTypeSecondaryUserText", participantTypeSecondaryUserText2);
+                    map.put("participantTypeSecondaryUserJSON", JSON.toJSONString(participantTypeSecondaryUser2));
+                    break;
 				default:
 					break;
 			}
@@ -288,6 +301,7 @@ public class TParticipantFilterController extends BaseController {
 							case ASSIGN_USER_DEPT://指定用户所在部门
 							case ASSIGN_USER_POSITION://指定用户所在职位
 							case ASSIGN_USER_ROLE://指定用户所在角色
+                            case ASSIGN_USER_DEPT_LEADER://指定用户所在部门的分管领导
 							case ASSIGN_USER_LEADER://指定用户的分管领导
 								if (Objects.isNull(participantTypeSecondaryUser)) {
 									participantTypeSecondaryUser = Selects.getParticipantTypeSecondaryUser();

+ 4 - 0
zjugis-workflow/src/main/java/com/zjugis/z_workflow/entity/enumeration/ParticipantFilterTypeEnum.java

@@ -1,5 +1,8 @@
 package com.zjugis.z_workflow.entity.enumeration;
 
+import com.zjugis.z_workflow.utils.ParticipantsUtils.MethodHandler;
+import com.zjugis.z_workflow.utils.ParticipantsUtils.ParamsHandler;
+
 /**
  * 参与人员过滤类型枚举类
  * @author: xufeng
@@ -20,6 +23,7 @@ public enum ParticipantFilterTypeEnum {
     ASSIGN_USER_DEPT_POSITION("指定用户所在部门职位", 16),
     ASSIGN_USER_ROLE("指定用户所在角色", 9),
     ASSIGN_USER_LEADER("指定用户的分管领导", 10),
+    ASSIGN_USER_DEPT_LEADER("指定用户所在部门的分管领导", 17),
 //    ASSIGN_USER_DISTRICT("指定用户所在行政区", 15),
     ASSIGN_ACTIVITY_PARTICIPANT("指定已创建活动实例参与人(最近)", 11),
     CUSTOM_PARTICIPANT("自定义可参与人", 13);

+ 13 - 0
zjugis-workflow/src/main/java/com/zjugis/z_workflow/utils/ParticipantsUtils/MethodHandler.java

@@ -7,6 +7,7 @@ import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.TypeReference;
 import com.zjugis.framework.common.pojo.CommonResult;
 import com.zjugis.framework.workflow.spring.SpringUtils;
+import com.zjugis.module.system.api.dept.DeptApi;
 import com.zjugis.module.system.api.dept.dto.PostRespDTO;
 import com.zjugis.module.system.api.permission.RoleApi;
 import com.zjugis.module.system.api.permission.dto.RoleRespDto;
@@ -147,6 +148,18 @@ public class MethodHandler {
         return handledResult(result.getCheckedData());
     };
 
+    /**
+     * 指定用户所在部门分管领导
+     */
+    public static Function<Map<String, Object>, Set<Map<String, Object>>> getUserByWithDeptLeaderFun = postData -> {
+        AdminUserApi adminUserApi = SpringUtils.getBean(AdminUserApi.class);
+        String id = postData.getOrDefault("id", "").toString();
+        AdminUserRespDTO user = adminUserApi.getUser(id).getCheckedData();
+        DeptApi deptApi = SpringUtils.getBean(DeptApi.class);
+        CommonResult<AdminUserRespDTO> result = deptApi.getDeptLeader(user.getDeptId());
+        return handledResult(result.getCheckedData());
+    };
+
     /**
      * 指定已创建活动实例参与人(最近)
      */

+ 9 - 0
zjugis-workflow/src/main/java/com/zjugis/z_workflow/utils/ParticipantsUtils/ParamsHandler.java

@@ -157,6 +157,15 @@ public class ParamsHandler {
 		return paramMap;
 	};
 
+
+    /**
+     * 指定用户所在部门的分管领导
+     */
+    public static BiFunction<TParticipantFilter,Map<String, Object>,Map<String, Object>> getParamsByWithDeptLeaderFun = (target,inMap) -> {
+        Map<String, Object> paramMap = getUserParam(target.getParticipantTypeSecondary(), inMap);
+        return paramMap;
+    };
+
 	/**
 	 * 指定用户所在行政区
 	 */

+ 1 - 0
zjugis-workflow/src/main/java/com/zjugis/z_workflow/utils/ParticipantsUtils/PostParticipantsUtils.java

@@ -235,6 +235,7 @@ public class PostParticipantsUtils {
 //        ASSIGN_USER_DEPT_POSITION("指定用户所在部门职位", 16, MethodHandler.getUserByWithDeptPositionFun, ParamsHandler.getParamsByWithDeptPositionFun),
         ASSIGN_USER_ROLE("指定用户所在角色", 9, MethodHandler.getUserByWithRoleFun, ParamsHandler.getParamsByWithRoleFun),
         ASSIGN_USER_LEADER("指定用户的分管领导", 10, MethodHandler.getUserByWithLeaderFun, ParamsHandler.getParamsByWithLeaderFun),
+        ASSIGN_USER_DEPT_LEADER("指定用户所在部门的分管领导", 17, MethodHandler.getUserByWithDeptLeaderFun, ParamsHandler.getParamsByWithDeptLeaderFun),
         ASSIGN_ACTIVITY_PARTICIPANT("指定已创建活动实例参与人(最近)", 11, MethodHandler.getUserByActivityInstanceFun, ParamsHandler.getParamsByActivityInstanceFun),
         CUSTOM_PARTICIPANT("自定义可参与人", 13, MethodHandler.getUserByCustomFun, ParamsHandler.getParamsByCustomFun);
 		// 成员变量

+ 1 - 0
zjugis-workflow/src/main/resources/templates/TParticipantFilter/add.ftl

@@ -44,6 +44,7 @@
                     <#case 9>
                     <#case 10>
                     <#case 12>
+                    <#case 17>
                     <#case 15>
                         <div class="z-comp-select z-validate-required <#if 1==iView!0>z-readonly</#if>" name="tParticipantFilter$participantTypeSecondary"
                              value="${ENTITY.participantTypeSecondary?html!}" data='${participantTypeSecondaryUserJSON!}'>