sinake
2 天以前 c76f64a1f4d9a7f7283373be70b1dfd925286e4d
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceExternalpersonController.java
@@ -96,7 +96,8 @@
        {
            return AjaxResult.error("新增人员需要确定人员类型!");
        }
        if (!"org".equals(usertype)){
        // UserType 自 2026-09-27 起为多值字段(逗号分隔),单位判断改为"包含 org"
        if (!hasUserType(usertype, "org")){
            String idcardno = serviceExternalperson.getIdcardno();
            List<ServiceExternalperson> existpsersons = serviceExternalpersonService.getInfoByIDCardNo(idcardno);
            if (existpsersons.size() > 0) {
@@ -148,4 +149,23 @@
    public AjaxResult getInfoByIDCardNo(@PathVariable("idcardno") String idcardno) {
        return AjaxResult.success(serviceExternalpersonService.getInfoByIDCardNo(idcardno));
    }
    /**
     * 判断人员类型(多值,逗号分隔)中是否包含指定类型
     *
     * @param usertype 人员类型,如 "zzry,performance";兼容改造前的单值
     * @param code     字典 sys_UserType 的取值,如 "org"
     * @return 是否包含
     */
    private static boolean hasUserType(String usertype, String code) {
        if (usertype == null || usertype.isEmpty()) {
            return false;
        }
        for (String item : usertype.split(",")) {
            if (code.equals(item.trim())) {
                return true;
            }
        }
        return false;
    }
}