yxh
2 天以前 596834ce4e233130d61888128fe66a0c008543dd
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceExternalpersonController.java
@@ -6,6 +6,7 @@
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.domain.BaseOnlyvalue;
import com.ruoyi.project.domain.ServiceDonatebaseinfo;
import com.ruoyi.project.service.IBaseOnlyvalueService;
import com.ruoyi.web.controller.common.OnlyValueCommon;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -50,7 +51,7 @@
    /**
     * 查询外围单位人员列表
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:list')")
    //// @PreAuthorize("@ss.hasPermi('project:externalperson:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServiceExternalperson serviceExternalperson) {
        logger.info("询外围单位人员列表的入参为 :{}", serviceExternalperson);
@@ -62,7 +63,7 @@
    /**
     * 导出外围单位人员列表
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:export')")
    //// @PreAuthorize("@ss.hasPermi('project:externalperson:export')")
    @Log(title = "外围单位人员", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ServiceExternalperson serviceExternalperson) {
@@ -74,7 +75,7 @@
    /**
     * 获取外围单位人员详细信息
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:query')")
    //// @PreAuthorize("@ss.hasPermi('project:externalperson:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(serviceExternalpersonService.getById(id));
@@ -83,11 +84,27 @@
    /**
     * 新增外围单位人员
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:add')")
    //// @PreAuthorize("@ss.hasPermi('project:externalperson:add')")
    @Log(title = "外围单位人员", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @RepeatSubmit
    public AjaxResult add(@RequestBody ServiceExternalperson serviceExternalperson) {
       //校验人员类型、身份证
        String usertype = serviceExternalperson.getUsertype();
        if (usertype == null || usertype.isEmpty())
        {
            return AjaxResult.error("新增人员需要确定人员类型!");
        }
        // UserType 自 2026-09-27 起为多值字段(逗号分隔),单位判断改为"包含 org"
        if (!hasUserType(usertype, "org")){
            String idcardno = serviceExternalperson.getIdcardno();
            List<ServiceExternalperson> existpsersons = serviceExternalpersonService.getInfoByIDCardNo(idcardno);
            if (existpsersons.size() > 0) {
                return AjaxResult.error("新增人员身份证" + idcardno + "已存在,人员信息不能重复添加!");
            }
        }
        if (StringUtils.isEmpty(serviceExternalperson.getUserno())) {
            String zj = onlyValueCommon.addOnlyValue("zj");
            String formattedNumber = String.format("%05d", zj);
@@ -100,7 +117,7 @@
    /**
     * 修改外围单位人员
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:edit')")
    //// @PreAuthorize("@ss.hasPermi('project:externalperson:edit')")
    @Log(title = "外围单位人员", businessType = BusinessType.UPDATE)
    @PostMapping("/editZJInfo")
    @RepeatSubmit
@@ -111,7 +128,7 @@
    /**
     * 删除外围单位人员
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:remove')")
    //// @PreAuthorize("@ss.hasPermi('project:externalperson:remove')")
    @Log(title = "外围单位人员", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
@@ -127,4 +144,28 @@
    public AjaxResult getInfoByUserNo(@PathVariable("userno") String userno) {
        return AjaxResult.success(serviceExternalpersonService.getInfoByUserNo(userno));
    }
    @GetMapping(value = "/getInfoByIDCardNo/{idcardno}")
    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;
    }
}