| | |
| | | |
| | | 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; |
| | |
| | | @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); |
| | |
| | | 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; |
| | | } |
| | | } |