浏览代码

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

cs 2 年之前
父节点
当前提交
a58db17843

+ 56 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -98,6 +98,14 @@ public class WeiXinCorpController {
     @Resource
     private SysRoleMapper sysRoleMapper;
     @Resource
+    private ParticipationMapper participationMapper;
+    @Resource
+    private TaskGroupMapper taskGroupMapper;
+    @Resource
+    private TaskMapper taskMapper;
+    @Resource
+    private StagesMapper stagesMapper;
+    @Resource
     private SysModuleMapper sysModuleMapper;
     @Resource
     private SysFunctionMapper sysFunctionMapper;
@@ -1032,6 +1040,54 @@ public class WeiXinCorpController {
                                 .setCompanyId(company.getId())
                                 .setJobNumber(userId);
                         userMapper.insert(user);
+                        //todo: 生成初始测试项目及任务
+                        Project project=new Project();
+                        project.setCompanyId(company.getId());
+                        project.setInchargerId(user.getId());
+                        project.setInchargerName(user.getName());
+                        project.setCreatorId(user.getId());
+                        project.setCreatorName(user.getName());
+                        project.setCreateDate(LocalDate.now());
+                        project.setProjectCode("example1");
+                        project.setProjectName(MessageUtils.message("project.example"));
+                        projectMapper.insert(project);
+                        //todo:  设置初始项目参与人
+                        Participation participation=new Participation();
+                        participation.setProjectId(project.getId()).setUserId(user.getId());
+                        participationMapper.insert(participation);
+                        //todo: 生成初始项目相关日报审核人
+                        ProjectAuditor projectAuditor=new ProjectAuditor();
+                        projectAuditor.setAuditorId(user.getId());
+                        projectAuditor.setAuditorName(user.getName());
+                        projectAuditor.setProjectId(project.getId());
+                        projectAuditorMapper.insert(projectAuditor);
+                        //todo: 生成初始项目相关示例任务分组/任务阶段以及示例任务
+                        TaskGroup taskGroup = new TaskGroup();
+                        taskGroup.setProjectId(project.getId())
+                                .setInchargerId(user.getId())
+                                .setName(MessageUtils.message("entry.projectStage"));
+                        taskGroupMapper.insert(taskGroup);
+                        Stages stage = new Stages();
+                        stage.setGroupId(taskGroup.getId());
+                        stage.setSequence(1);
+                        stage.setProjectId(project.getId());
+                        stage.setStagesName(MessageUtils.message("excel.WorkUnfolds"));
+                        stagesMapper.insert(stage);
+                        Task task=new Task();
+                        task.setCreateDate(LocalDate.now());
+                        task.setProjectId(project.getId());
+                        task.setCompanyId(company.getId());
+                        task.setCreaterId(user.getId());
+                        task.setCreaterName(user.getName());
+                        task.setCreatorColor(user.getColor());
+                        task.setExecutorId(user.getId());
+                        task.setExecutorColor(user.getColor());
+                        task.setExecutorName(user.getName());
+                        task.setStagesId(stage.getId());
+                        task.setGroupId(taskGroup.getId());
+                        task.setSeq(0);
+                        task.setName(MessageUtils.message("Stages.example"));
+                        taskMapper.insert(task);
                     }
 
                     int companyId = company.getId();

+ 141 - 22
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -3116,12 +3116,32 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     if (inchargerCell != null) {
                         String inchargerName = inchargerCell.getStringCellValue().trim();
                         if (!StringUtils.isEmpty(inchargerName)) {
-                            Optional<User> first = userList.stream().filter(u -> u.getName().equals(inchargerName)).findFirst();
+                            String s1;
+                            if(inchargerName.startsWith("/")){
+                                s1=inchargerName.substring(1,inchargerName.length());
+                            }else s1=inchargerName;
+                            String s2;
+                            if(s1.endsWith("/")){
+                                s2=s1.substring(0,s1.length()-1);
+                            }else s2=s1;
+                            String[] split = s2.split("/");
+                            Optional<User> first;
+                            Integer exception;
+                            if(split.length==1){
+                                first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
+                                exception=0;
+                            }else {
+                                first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
+                                exception=1;
+                            }
                             if (first.isPresent()) {
                                 project.setInchargerId(first.get().getId());
-                                project.setInchargerName(inchargerName);
+                                project.setInchargerName(first.get().getName());
                             } else {
-                                throw new Exception("项目负责人["+inchargerName+"]不存在");
+                                switch (exception){
+                                    case 0:throw new Exception("项目负责人姓名/工号为["+split[0]+"]的人员不存在");
+                                    case 1:throw new Exception("项目负责人["+split[0]+"]姓名与工号不匹配");
+                                }
                             }
                         }
                     }
@@ -3188,14 +3208,35 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     List<Participation> participationList = new ArrayList<>();
                     if(inchargerCell!=null){
                         String value = inchargerCell.getStringCellValue();
+                        String s1;
+                        if(value.startsWith("/")){
+                            s1=value.substring(1,value.length());
+                        }else s1=value;
+                        String s2;
+                        if(s1.endsWith("/")){
+                            s2=s1.substring(0,s1.length()-1);
+                        }else s2=s1;
+                        String[] split = s2.split("/");
+                        Optional<User> first;
+                        Integer exception;
+                        if(split.length==1){
+                            first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
+                            exception=0;
+                        }else {
+                            first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
+                            exception=1;
+                        }
                         Participation p = new Participation();
-                        Optional<User> first = userList.stream().filter(u -> u.getName().equals(value)).findFirst();
                         if (first.isPresent()) {
                             p.setUserId(first.get().getId());
                             p.setProjectId(project.getId());
                             participationList.add(p);
                         } else {
-                            throw new Exception("参与人["+value+"]不存在");
+                            switch (exception){
+                                case 0:throw new Exception("参与人姓名/工号为["+split[0]+"]的人员不存在");
+
+                                case 1:throw new Exception("参与人["+split[0]+"]姓名工号不匹配");
+                            }
                         }
                     }
                     if (participatorCell != null) {
@@ -3204,7 +3245,24 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             String[] partSplit = part.split("\\,|\\,");
                             for (String str : partSplit) {
                                 Participation p = new Participation();
-                                Optional<User> first = userList.stream().filter(u -> u.getName().equals(str)).findFirst();
+                                String s1;
+                                if(str.startsWith("/")){
+                                    s1=str.substring(1,str.length());
+                                }else s1=str;
+                                String s2;
+                                if(s1.endsWith("/")){
+                                    s2=s1.substring(0,s1.length()-1);
+                                }else s2=s1;
+                                String[] split = str.split("/");
+                                Optional<User> first;
+                                Integer exception;
+                                if(split.length==1){
+                                    first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
+                                    exception=0;
+                                }else {
+                                    first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
+                                    exception=1;
+                                }
                                 if (first.isPresent()) {
                                     User partMemb = first.get();
 //                                    System.out.println("参与人:"+partMemb.getName());
@@ -3214,7 +3272,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                         participationList.add(p);
                                     }
                                 } else {
-                                    throw new Exception("参与人["+str+"]不存在");
+                                    switch (exception){
+                                        case 0:throw new Exception("参与人姓名/工号为["+split[0]+"]的人员不存在");
+
+                                        case 1:throw new Exception("参与人["+split[0]+"]姓名工号不匹配");
+                                    }
+
                                 }
                             }
                         }
@@ -3232,10 +3295,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 msg.data = MessageUtils.message("data.importSucRow",importCount);
                 if (existCodeList.size() > 0) {
                     String collect = existCodeList.stream().collect(Collectors.joining(","));
-                    if(key==1){
-                        //msg.data += "自动更新"+existCodeList.size()+"条已存在项目编码:"+collect;
-                        msg.data += MessageUtils.message("data.upSkip",existCodeList.size(),collect);
-                    }else msg.data += MessageUtils.message("data.upSkip",existCodeList.size(),collect);
+                    msg.data += MessageUtils.message("data.upSkip",existCodeList.size(),collect);
                 }
                 OperationRecord operationRecord=new OperationRecord();
                 operationRecord.setCompanyId(user.getCompanyId());
@@ -3554,12 +3614,32 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     if (inchargerCell != null) {
                         String inchargerName = inchargerCell.getStringCellValue().trim();
                         if (!StringUtils.isEmpty(inchargerName)) {
-                            Optional<User> first = userList.stream().filter(u -> u.getName().equals(inchargerName)).findFirst();
+                            String s1;
+                            if(inchargerName.startsWith("/")){
+                                s1=inchargerName.substring(1,inchargerName.length());
+                            }else s1=inchargerName;
+                            String s2;
+                            if(s1.endsWith("/")){
+                                s2=s1.substring(0,s1.length()-1);
+                            }else s2=s1;
+                            String[] split = s2.split("/");
+                            Optional<User> first;
+                            Integer exception;
+                            if(split.length==1){
+                                first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
+                                exception=0;
+                            }else {
+                                first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
+                                exception=1;
+                            }
                             if (first.isPresent()) {
                                 project.setInchargerId(first.get().getId());
-                                project.setInchargerName(inchargerName);
+                                project.setInchargerName(first.get().getName());
                             } else {
-                                throw new Exception("项目负责人["+inchargerName+"]不存在");
+                                switch (exception){
+                                    case 0:throw new Exception("项目负责人姓名/工号为["+split[0]+"]的人员不存在");
+                                    case 1:throw new Exception("项目负责人["+split[0]+"]姓名与工号不匹配");
+                                }
                             }
                         }
                     }
@@ -4106,14 +4186,35 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     List<Participation> participationList = new ArrayList<>();
                     if(inchargerCell!=null){
                         String value = inchargerCell.getStringCellValue();
+                        String s1;
+                        if(value.startsWith("/")){
+                            s1=value.substring(1,value.length());
+                        }else s1=value;
+                        String s2;
+                        if(s1.endsWith("/")){
+                            s2=s1.substring(0,s1.length()-1);
+                        }else s2=s1;
+                        String[] split = s2.split("/");
+                        Optional<User> first;
+                        Integer exception;
+                        if(split.length==1){
+                            first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
+                            exception=0;
+                        }else {
+                            first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
+                            exception=1;
+                        }
                         Participation p = new Participation();
-                        Optional<User> first = userList.stream().filter(u -> u.getName().equals(value)).findFirst();
                         if (first.isPresent()) {
                             p.setUserId(first.get().getId());
                             p.setProjectId(project.getId());
                             participationList.add(p);
                         } else {
-                            throw new Exception("参与人["+value+"]不存在");
+                            switch (exception){
+                                case 0:throw new Exception("参与人姓名/工号为["+split[0]+"]的人员不存在");
+
+                                case 1:throw new Exception("参与人["+split[0]+"]姓名工号不匹配");
+                            }
                         }
                     }
                     if (participatorCell != null) {
@@ -4121,8 +4222,25 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         if (!StringUtils.isEmpty(part)) {
                             String[] partSplit = part.split("\\,|\\,");
                             for (String str : partSplit) {
+                                String s1;
+                                if(str.startsWith("/")){
+                                   s1=str.substring(1,str.length());
+                                }else s1=str;
+                                String s2;
+                                if(s1.endsWith("/")){
+                                    s2=s1.substring(0,s1.length()-1);
+                                }else s2=s1;
+                                String[] split = s2.split("/");
+                                Optional<User> first;
+                                Integer exception;
+                                if(split.length==1){
+                                    first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
+                                    exception=0;
+                                }else {
+                                    first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
+                                    exception=1;
+                                }
                                 Participation p = new Participation();
-                                Optional<User> first = userList.stream().filter(u -> u.getName().equals(str)).findFirst();
                                 if (first.isPresent()) {
                                     User partMemb = first.get();
 //                                    System.out.println("参与人:"+partMemb.getName());
@@ -4132,7 +4250,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                         participationList.add(p);
                                     }
                                 } else {
-                                    throw new Exception("参与人["+str+"]不存在");
+                                    switch (exception){
+                                        case 0:throw new Exception("参与人姓名/工号为["+split[0]+"]的人员不存在");
+
+                                        case 1:throw new Exception("参与人["+split[0]+"]姓名工号不匹配");
+                                    }
                                 }
                             }
                         }
@@ -4150,10 +4272,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 msg.data = MessageUtils.message("data.importSucRow",importCount);
                 if (existCodeList.size() > 0) {
                     String collect = existCodeList.stream().collect(Collectors.joining(","));
-                    if(key==1){
-                        //msg.data += "自动更新"+existCodeList.size()+"条已存在项目编码:"+collect;
-                        msg.data += MessageUtils.message("data.upSkip",existCodeList.size(),collect);
-                    }else msg.data += MessageUtils.message("data.upSkip",existCodeList.size(),collect);
+                    msg.data += MessageUtils.message("data.upSkip",existCodeList.size(),collect);
                 }
                 OperationRecord operationRecord=new OperationRecord();
                 operationRecord.setCompanyId(user.getCompanyId());

+ 51 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -88,6 +88,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     @Resource
     private SysModuleMapper sysModuleMapper;
     @Resource
+    private StagesMapper stagesMapper;
+    @Resource
     private DepartmentService departmentService;
     @Resource
     private SysFunctionMapper sysFunctionMapper;
@@ -1021,10 +1023,59 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 expenseTypeList.add(item);
             }
             expenseTypeService.saveBatch(expenseTypeList);
+
             if (userMapper.insert(user) == 0) {
                 //httpRespMsg.setError("操作失败");
                 httpRespMsg.setError(MessageUtils.message("other.operationFail"));
             } else {
+                //todo: 生成初始测试项目及任务
+                Project project=new Project();
+                project.setCompanyId(company.getId());
+                project.setInchargerId(user.getId());
+                project.setInchargerName(user.getName());
+                project.setCreatorId(user.getId());
+                project.setCreatorName(user.getName());
+                project.setCreateDate(LocalDate.now());
+                project.setProjectCode("example1");
+                project.setProjectName(MessageUtils.message("project.example"));
+                projectMapper.insert(project);
+                //todo:  设置初始项目参与人
+                Participation participation=new Participation();
+                participation.setProjectId(project.getId()).setUserId(user.getId());
+                participationMapper.insert(participation);
+                //todo: 生成初始项目相关日报审核人
+                ProjectAuditor projectAuditor=new ProjectAuditor();
+                projectAuditor.setAuditorId(user.getId());
+                projectAuditor.setAuditorName(user.getName());
+                projectAuditor.setProjectId(project.getId());
+                projectAuditorMapper.insert(projectAuditor);
+                //todo: 生成初始项目相关示例任务分组/任务阶段以及示例任务
+                TaskGroup taskGroup = new TaskGroup();
+                taskGroup.setProjectId(project.getId())
+                        .setInchargerId(user.getId())
+                        .setName(MessageUtils.message("entry.projectStage"));
+                taskGroupMapper.insert(taskGroup);
+                Stages stage = new Stages();
+                stage.setGroupId(taskGroup.getId());
+                stage.setSequence(1);
+                stage.setProjectId(project.getId());
+                stage.setStagesName(MessageUtils.message("excel.WorkUnfolds"));
+                stagesMapper.insert(stage);
+                Task task=new Task();
+                task.setCreateDate(LocalDate.now());
+                task.setProjectId(project.getId());
+                task.setCompanyId(company.getId());
+                task.setCreaterId(user.getId());
+                task.setCreaterName(user.getName());
+                task.setCreatorColor(user.getColor());
+                task.setExecutorId(user.getId());
+                task.setExecutorColor(user.getColor());
+                task.setExecutorName(user.getName());
+                task.setStagesId(stage.getId());
+                task.setGroupId(taskGroup.getId());
+                task.setSeq(0);
+                task.setName(MessageUtils.message("Stages.example"));
+                taskMapper.insert(task);
                 httpRespMsg.data = user;
             }
         }

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -482,7 +482,7 @@ public class TimingTask {
 
     @Scheduled(cron = "0 30,0/5 17-19 * * ?")
     public void  getClockRecordWithCorpWx(){
-        /*if(isDev) return;*/
+        if(isDev) return;
         //todo: 有限制无考勤不填报的情况才获取
         LocalDateTime start = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
         LocalDateTime end = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).withSecond(0).withNano(0);

文件差异内容过多而无法显示
+ 714 - 714
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages.properties


+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages_en_US.properties

@@ -224,6 +224,7 @@ project.storesReserve=Project preparation materials
 project.processDocuments=Project process documents
 project.deliverable=Project Deliverable
 project.manage = manage
+project.example=Example Project
 # \u4F9B\u8D27\u76F8\u5173
 provider.noRepeat=Vendor No. already exists.
 provider.classNameRepeat=The supplier name under this category already exists.
@@ -240,6 +241,7 @@ Stages.noExistAndRefresh=This task does not exist, please refresh and view.
 Stages.ListNull=The task list is empty and cannot be saved.
 Stages.ListNotExist=The task list ["{0}"] does not exist.
 Stages.leastOneGroup=Keep at least one task group.
+Stages.example=Example Task
 #\u5206\u7EC4\u76F8\u5173
 group.RepeatName=Group has duplicate name.
 group.userNull=The user ["{0}"] does not exist. Please add the member in the organization structure.