Explorar o código

研发打卡修改

anderx %!s(int64=2) %!d(string=hai) anos
pai
achega
47a6affadf

+ 2 - 1
ruoyi-common/src/main/java/com/ruoyi/common/enums/UserRolesType.java

@@ -9,7 +9,8 @@ public enum UserRolesType {
     COMMON(2l,"common"),
     MANAGE(3l,"manage"),
     CEO(4l,"ceo"),
-    INSPECTORS(5l,"inspectors");
+    INSPECTORS(5l,"inspectors"),
+    ERROR(99l,"inspectors"),;
 
     private final String desc;
     private final Long code;

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectStaffRecordServiceImpl.java

@@ -100,6 +100,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
             log.debug(errorStr);
             return AjaxResult.error(errorStr);
         }
+
         return AjaxResult.success();
     }
 

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectStaffServiceImpl.java

@@ -2,16 +2,23 @@ package com.ruoyi.project.service.impl;
 
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.project.domain.ProjectStaff;
+import com.ruoyi.project.domain.ProjectStaffRecord;
 import com.ruoyi.project.mapper.ProjectStaffMapper;
 import com.ruoyi.project.mapper.ProjectStaffRecordMapper;
 import com.ruoyi.project.mapper.ProjectTaskMapper;
 import com.ruoyi.project.service.ProjectStaffService;
 import com.ruoyi.system.mapper.SysUserMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class ProjectStaffServiceImpl implements ProjectStaffService {
+
+    Logger log = LoggerFactory.getLogger(ProjectStaffServiceImpl.class);
     @Autowired
     private ProjectStaffMapper projectStaffMapper;
     @Autowired
@@ -24,6 +31,15 @@ public class ProjectStaffServiceImpl implements ProjectStaffService {
 
     @Override
     public AjaxResult addStaff(ProjectStaff in) {
+        List<ProjectStaff> projectStaffs = projectStaffMapper.selectBypid(in.getPid());
+        for (ProjectStaff projectStaff : projectStaffs) {
+            if (projectStaff.getAid().equals(in.getAid())){
+                String name = projectStaff.getName();
+                String errorStr=String.format("项目成员[%s]已存在.",name);
+                log.error(errorStr);
+                return AjaxResult.error(errorStr);
+            }
+        }
         projectStaffMapper.insertSelective(in);
         userMapper.updateUserProjectSum(in.getAid(),0);
         projectTaskMapper.updateStaffName(in.getPid());