diff --git a/policeSecurityServer/src/main/java/com/changhu/controller/AccessKeysController.java b/policeSecurityServer/src/main/java/com/changhu/controller/AccessKeysController.java index 5b3efb4..f532e46 100644 --- a/policeSecurityServer/src/main/java/com/changhu/controller/AccessKeysController.java +++ b/policeSecurityServer/src/main/java/com/changhu/controller/AccessKeysController.java @@ -2,7 +2,6 @@ package com.changhu.controller; import cn.hutool.core.annotation.AnnotationUtil; import cn.hutool.core.lang.Dict; -import com.alibaba.fastjson2.JSON; import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.JsonBody; import com.changhu.common.db.enums.UserType; @@ -67,23 +66,4 @@ public class AccessKeysController { return accessKeysService.list(); } - public static void main(String[] args) { - Class openControllerClass = OpenController.class; - RequestMapping requestMapping = AnnotatedElementUtils.findMergedAnnotation(openControllerClass, RequestMapping.class); - String controllerPath = requestMapping.value()[0]; - - List> method = Arrays.stream(openControllerClass.getMethods()) - .filter(m -> AnnotationUtil.hasAnnotation(m, RequestMapping.class)) - .map(m -> { - Operation operation = m.getAnnotation(Operation.class); - RequestMapping mReq = AnnotatedElementUtils.findMergedAnnotation(m, RequestMapping.class); - return SelectNodeVo.builder() - .value(controllerPath + mReq.value()[0]) - .label(operation.summary()) - .extData(Dict.of("method", mReq.method())) - .build(); - }) - .toList(); - method.forEach(i -> System.out.println(JSON.toJSONString(i))); - } } diff --git a/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java b/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java index 250694a..fc81c3a 100644 --- a/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java +++ b/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java @@ -5,7 +5,8 @@ import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.pojo.dto.DataViewDTO; import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; import com.changhu.pojo.dto.SecurityUnitUseStatisticsDTO; -import com.changhu.pojo.dto.ServiceProjectSecurityUserRosterDTO; +import com.changhu.pojo.dto.SecurityUserRosterDTO; +import com.changhu.pojo.params.EnterprisesUnitOrServiceProjectType; import com.changhu.service.OpenApiService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Schema; @@ -56,10 +57,11 @@ public class OpenController { return openApiService.securityUnitUseStatistics(code, level); } - @Operation(summary = "服务项目安保人员花名册") - @GetMapping("/serviceProjectUserRoster") - public List serviceProjectUserRoster(@Schema(description = "服务项目id") Long serviceProjectId) { - return openApiService.serviceProjectUserRoster(serviceProjectId); + @Operation(summary = "安保人员花名册") + @GetMapping("/securityUserRoster") + public List securityUserRoster(@Schema(description = "事业单位或服务项目id") Long id, + @Schema(description = "类型") EnterprisesUnitOrServiceProjectType type) { + return openApiService.securityUserRoster(id, type); } } diff --git a/policeSecurityServer/src/main/java/com/changhu/mapper/OpenApiMapper.java b/policeSecurityServer/src/main/java/com/changhu/mapper/OpenApiMapper.java index 0155597..6ea93e8 100644 --- a/policeSecurityServer/src/main/java/com/changhu/mapper/OpenApiMapper.java +++ b/policeSecurityServer/src/main/java/com/changhu/mapper/OpenApiMapper.java @@ -2,7 +2,8 @@ package com.changhu.mapper; import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.pojo.dto.SecurityUnitUseStatisticsDTO; -import com.changhu.pojo.dto.ServiceProjectSecurityUserRosterDTO; +import com.changhu.pojo.dto.SecurityUserRosterDTO; +import com.changhu.pojo.params.EnterprisesUnitOrServiceProjectType; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -38,9 +39,7 @@ public interface OpenApiMapper { /** * 获取服务人员花名册 - * - * @param serviceProjectId 服务项目id - * @return 结果 */ - List serviceProjectUserRoster(@Param("serviceProjectId") Long serviceProjectId); + List securityUserRoster(@Param("id") Long id, + @Param("type") EnterprisesUnitOrServiceProjectType type); } diff --git a/policeSecurityServer/src/main/java/com/changhu/pojo/dto/ServiceProjectSecurityUserRosterDTO.java b/policeSecurityServer/src/main/java/com/changhu/pojo/dto/SecurityUserRosterDTO.java similarity index 91% rename from policeSecurityServer/src/main/java/com/changhu/pojo/dto/ServiceProjectSecurityUserRosterDTO.java rename to policeSecurityServer/src/main/java/com/changhu/pojo/dto/SecurityUserRosterDTO.java index e923057..1f5ad27 100644 --- a/policeSecurityServer/src/main/java/com/changhu/pojo/dto/ServiceProjectSecurityUserRosterDTO.java +++ b/policeSecurityServer/src/main/java/com/changhu/pojo/dto/SecurityUserRosterDTO.java @@ -9,10 +9,10 @@ import lombok.Data; /** * @author 20252 * @createTime 2024/11/18 上午10:43 - * @desc ServiceProjectSecurityUserRosterDTO... + * @desc SecurityUserRosterDTO... */ @Data -public class ServiceProjectSecurityUserRosterDTO { +public class SecurityUserRosterDTO { @Schema(description = "id") private Long snowFlakeId; @Schema(description = "名称") diff --git a/policeSecurityServer/src/main/java/com/changhu/pojo/params/EnterprisesUnitOrServiceProjectType.java b/policeSecurityServer/src/main/java/com/changhu/pojo/params/EnterprisesUnitOrServiceProjectType.java new file mode 100644 index 0000000..f6c7190 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/pojo/params/EnterprisesUnitOrServiceProjectType.java @@ -0,0 +1,16 @@ +package com.changhu.pojo.params; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author 20252 + * @createTime 2024/11/21 上午10:35 + * @desc EnterprisesUnitOrServiceProjectType... + */ +@Getter +@AllArgsConstructor +public enum EnterprisesUnitOrServiceProjectType { + ENTERPRISES_UNIT, + SERVICE_PROJECT +} diff --git a/policeSecurityServer/src/main/java/com/changhu/service/OpenApiService.java b/policeSecurityServer/src/main/java/com/changhu/service/OpenApiService.java index 48a4a72..41b8be9 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/OpenApiService.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/OpenApiService.java @@ -4,7 +4,8 @@ import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.pojo.dto.DataViewDTO; import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; import com.changhu.pojo.dto.SecurityUnitUseStatisticsDTO; -import com.changhu.pojo.dto.ServiceProjectSecurityUserRosterDTO; +import com.changhu.pojo.dto.SecurityUserRosterDTO; +import com.changhu.pojo.params.EnterprisesUnitOrServiceProjectType; import java.util.List; @@ -50,8 +51,9 @@ public interface OpenApiService { /** * 服务项目安保人员花名册 * - * @param serviceProjectId 服务项目id + * @param id 事业单位服务项目id + * @param type 类型 * @return 花名册 */ - List serviceProjectUserRoster(Long serviceProjectId); + List securityUserRoster(Long id, EnterprisesUnitOrServiceProjectType type); } diff --git a/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java index a7063e4..6f18a87 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java @@ -12,7 +12,8 @@ import com.changhu.module.miniProgram.pojo.entity.SecurityUser; import com.changhu.pojo.dto.DataViewDTO; import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; import com.changhu.pojo.dto.SecurityUnitUseStatisticsDTO; -import com.changhu.pojo.dto.ServiceProjectSecurityUserRosterDTO; +import com.changhu.pojo.dto.SecurityUserRosterDTO; +import com.changhu.pojo.params.EnterprisesUnitOrServiceProjectType; import com.changhu.service.OpenApiService; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import lombok.SneakyThrows; @@ -103,7 +104,7 @@ public class OpenApiServiceImpl implements OpenApiService { } @Override - public List serviceProjectUserRoster(Long serviceProjectId) { - return openApiMapper.serviceProjectUserRoster(serviceProjectId); + public List securityUserRoster(Long id, EnterprisesUnitOrServiceProjectType type) { + return openApiMapper.securityUserRoster(id, type); } } diff --git a/policeSecurityServer/src/main/resources/mapper/OpenApiMapper.xml b/policeSecurityServer/src/main/resources/mapper/OpenApiMapper.xml index af35578..5727ae3 100644 --- a/policeSecurityServer/src/main/resources/mapper/OpenApiMapper.xml +++ b/policeSecurityServer/src/main/resources/mapper/OpenApiMapper.xml @@ -105,8 +105,8 @@ group by eu.snow_flake_id order by eu.create_time desc - select su.snow_flake_id, su.name, su.sex, @@ -116,12 +116,22 @@ eu.name as 'enterprisesUnitName', suu.name as 'securityUnitName', su.security_number - from enterprises_unit eu - left join service_project sp on sp.enterprises_unit_id = eu.snow_flake_id and sp.delete_flag = 0 - left join security_user su on su.service_project_id = sp.snow_flake_id and su.delete_flag = 0 - left join security_unit suu on su.security_unit_id = suu.snow_flake_id and suu.delete_flag = 0 + from enterprises_unit eu + LEFT JOIN service_project sp ON sp.enterprises_unit_id = eu.snow_flake_id AND sp.delete_flag = 0 + JOIN security_user su ON su.service_project_id = sp.snow_flake_id AND su.delete_flag = 0 + LEFT JOIN security_unit suu ON su.security_unit_id = suu.snow_flake_id AND suu.delete_flag = 0 where eu.delete_flag = 0 - and sp.snow_flake_id = #{serviceProjectId} + + + and eu.snow_flake_id = #{id} + + + and sp.snow_flake_id = #{id} + + + and eu.snow_flake_id = -1 + + order by su.create_time desc \ No newline at end of file