Explorar el Código

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

ggooalice hace 2 años
padre
commit
6117e5896e

+ 23 - 1
fhKeeper/formulahousekeeper/inva_4_tivo/css/index.css

@@ -94,7 +94,7 @@
     font-size: 20px;
     font-style: oblique;
     letter-spacing: .625rem;
-    margin-top: 3.5625rem;
+    margin-top: 2.8125rem;
     /* padding-left: 6.6875rem; */
     color: #cfcfcf;
 }
@@ -118,6 +118,28 @@
 .bannarTxt a {
     color: #ffffff;
 }
+.bannarRz {
+    display: flex;
+    justify-content: space-between;
+    width: 31.25rem;
+    margin-top: .75rem;
+}
+.bannarRzBox {
+    padding: 0 .625rem;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    line-height: 1.375rem;
+    border-radius: .625rem;
+    font-size: .375rem;
+    color: #d7d7d7;
+}
+.bannarRzBox img {
+    width: 1.125rem;
+    height: .9375rem;
+    display: inline-block;
+    margin-right: .3125rem;
+}
 
 /* 产品介绍 */
 .product {

BIN
fhKeeper/formulahousekeeper/inva_4_tivo/image/ions/blue.png


BIN
fhKeeper/formulahousekeeper/inva_4_tivo/image/ions/green.png


+ 10 - 0
fhKeeper/formulahousekeeper/inva_4_tivo/index.html

@@ -95,6 +95,16 @@
         <img src="./image/bannar9.gif" alt="" class="bannarIMgGam">
         <div class="bannarTxt">
             <div class="bannarTil">工时管家</div>
+            <div class="bannarRz">
+                <div class="bannarRzBox" style="border: 0.125rem solid #00b050;">
+                    <img src="./image/ions/green.png" alt="">
+                    通过ISO27001:2013信息安全认证
+                </div>
+                <div class="bannarRzBox" style="border: 0.125rem solid #00b0f0;">
+                    <img src="./image/ions/blue.png" alt="">
+                    通过ISO9001:2015质量体系认证
+                </div>
+            </div>
             <div class="bannarTilP">·提供最全面的项目工时统计解决方案·</div>
             <a href="http://worktime.ttkuaiban.com/#/register">
                 <div class="bannarBtn">免费试用</div>

+ 5 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -991,5 +991,10 @@ public class ProjectController {
     public HttpRespMsg batchExchangeIncharger(String projectIds,String inchargerId,HttpServletRequest request){
         return projectService.batchExchangeIncharger(projectIds,inchargerId,request);
     }
+
+    @RequestMapping("/fixParticipators")
+    public HttpRespMsg fixParticipators(Integer companyId, HttpServletRequest request){
+        return projectService.fixParticipators(companyId,request);
+    }
 }
 

+ 0 - 11
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -290,12 +290,6 @@ public class ReportController {
                         msg.setError("项目["+curP.getProjectName()+"]已撤销。");
                         return msg;
                     }
-                    //取消对截止时间的校验
-//                    if (curP.getPlanEndDate() != null && curP.getPlanEndDate().isBefore(LocalDate.parse(createDate[i], localDtf))) {
-//                        HttpRespMsg msg = new HttpRespMsg();
-//                        msg.setError("项目["+curP.getProjectName()+"]截止于"+localDtf.format(curP.getPlanEndDate())+",请修改。");
-//                        return msg;
-//                    }
                 } else {
                     //批量填报(含代填)
                     String[] dateArr = createDate[i].split("@");
@@ -310,11 +304,6 @@ public class ReportController {
                             msg.setError("项目["+curP.getProjectName()+"]已撤销。");
                             return msg;
                         }
-//                        if (curP.getPlanEndDate() != null && curP.getPlanEndDate().isBefore(LocalDate.parse(curDate, localDtf))) {
-//                            HttpRespMsg msg = new HttpRespMsg();
-//                            msg.setError("项目["+curP.getProjectName()+"]截止于"+localDtf.format(curP.getPlanEndDate())+",请修改。");
-//                            return msg;
-//                        }
                     }
                 }
             }

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ProjectService.java

@@ -184,4 +184,6 @@ public interface ProjectService extends IService<Project> {
     HttpRespMsg importPersonnelWithGroup(MultipartFile file, HttpServletRequest request);
 
     HttpRespMsg batchExchangeIncharger(String projectIds, String inchargerId, HttpServletRequest request);
+
+    HttpRespMsg fixParticipators(Integer companyId, HttpServletRequest request);
 }

+ 105 - 54
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -47,6 +47,7 @@ import java.time.chrono.ChronoLocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 
 /**
@@ -2945,51 +2946,54 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             }
                         }
                     }
-                    //参与人
+                    //导入项目参与人,遵守只增不减的原则, 避免误删
+                    List<Participation> oldPartList = new ArrayList<>();
+                    if (!flag) {
+                        //更新的项目,检查已经存在的项目参与人
+                        oldPartList = participationMapper.selectList(new QueryWrapper<Participation>().eq("project_id", project.getId()));
+                    }
+                    List<Participation> participationList = new ArrayList<>();
                     if(inchargerCell!=null){
-                        if(participatorCell==null||StringUtils.isEmpty(participatorCell.getStringCellValue())){
-                            String value = inchargerCell.getStringCellValue();
-                            Participation p = new Participation();
-                            Optional<User> first = userList.stream().filter(u -> u.getName().equals(value)).findFirst();
-                            if (first.isPresent()) {
-                                //避免更新操作 想清楚之前存在的参与人
-                                participationMapper.delete(new QueryWrapper<Participation>().eq("project_id",project.getId()));
-                                p.setUserId(first.get().getId());
-                                p.setProjectId(project.getId());
-                                participationMapper.insert(p);
-                            } else {
-                                throw new Exception("参与人["+value+"]不存在");
-                            }
+                        String value = inchargerCell.getStringCellValue();
+                        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+"]不存在");
                         }
                     }
                     if (participatorCell != null) {
                         String part = participatorCell.getStringCellValue().trim();
-                        //将项目负责人也添加到参与人当中来
-                        String incharger = inchargerCell.getStringCellValue().trim();
                         if (!StringUtils.isEmpty(part)) {
                             String[] partSplit = part.split("\\,|\\,");
-                            if(!StringUtils.isEmpty(incharger)){
-                                String[] inchargerSplit = incharger.split("\\,|\\,");
-                                int strLen1 = partSplit.length;// 保存第一个数组长度
-                                int strLen2 = inchargerSplit.length;
-                                partSplit=Arrays.copyOf(partSplit, strLen1+strLen2);
-                                System.arraycopy(inchargerSplit, 0, partSplit, strLen1, strLen2);
-                            }
                             for (String str : partSplit) {
                                 Participation p = new Participation();
                                 Optional<User> first = userList.stream().filter(u -> u.getName().equals(str)).findFirst();
                                 if (first.isPresent()) {
-                                    participationMapper.delete(new QueryWrapper<Participation>().eq("project_id",project.getId()));
-                                    p.setUserId(first.get().getId());
-                                    p.setProjectId(project.getId());
-                                    participationMapper.insert(p);
+                                    User partMemb = first.get();
+//                                    System.out.println("参与人:"+partMemb.getName());
+                                    if (!participationList.stream().anyMatch(partOne->partOne.getUserId().equals(partMemb.getId()))) {
+                                        p.setUserId(partMemb.getId());
+                                        p.setProjectId(project.getId());
+                                        participationList.add(p);
+                                    }
                                 } else {
-                                    projectMapper.deleteById(project.getId());
                                     throw new Exception("参与人["+str+"]不存在");
                                 }
                             }
                         }
                     }
+                    if (participationList.size() > 0) {
+                        //批量保存
+                        List<Participation> finalOldPartList = oldPartList;
+                        List<Participation> addPartList = participationList.stream().filter(newP-> finalOldPartList.stream().anyMatch(oldP->oldP.getUserId().equals(newP.getUserId()))).collect(Collectors.toList());
+                        if (addPartList.size() > 0) {
+                            participationService.saveBatch(addPartList);
+                        }
+                    }
                 }
                 msg.data = "成功导入"+importCount+"条数据。";
                 if (existCodeList.size() > 0) {
@@ -3795,49 +3799,54 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         }
                     }
                     importCount++;
-                    //参与人
+                    //导入项目参与人,遵守只增不减的原则, 避免误删
+                    List<Participation> oldPartList = new ArrayList<>();
+                    if (!flag) {
+                        //更新的项目,检查已经存在的项目参与人
+                        oldPartList = participationMapper.selectList(new QueryWrapper<Participation>().eq("project_id", project.getId()));
+                    }
+                    List<Participation> participationList = new ArrayList<>();
                     if(inchargerCell!=null){
-                        if(participatorCell==null||StringUtils.isEmpty(participatorCell.getStringCellValue())){
-                            String value = inchargerCell.getStringCellValue();
-                            Participation p = new Participation();
-                            Optional<User> first = userList.stream().filter(u -> u.getName().equals(value)).findFirst();
-                            if (first.isPresent()) {
-                                participationMapper.delete(new QueryWrapper<Participation>().eq("project_id",project.getId()));
-                                p.setUserId(first.get().getId());
-                                p.setProjectId(project.getId());
-                                participationMapper.insert(p);
-                            } else {
-                                throw new Exception("参与人["+value+"]不存在");
-                            }
+                        String value = inchargerCell.getStringCellValue();
+                        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+"]不存在");
                         }
                     }
                     if (participatorCell != null) {
                         String part = participatorCell.getStringCellValue().trim();
-                        //将项目负责人也添加到参与人当中来
-                        String incharger = inchargerCell.getStringCellValue().trim();
                         if (!StringUtils.isEmpty(part)) {
                             String[] partSplit = part.split("\\,|\\,");
-                            if(!StringUtils.isEmpty(incharger)){
-                                String[] inchargerSplit = incharger.split("\\,|\\,");
-                                int strLen1 = partSplit.length;// 保存第一个数组长度
-                                int strLen2 = inchargerSplit.length;
-                                partSplit=Arrays.copyOf(partSplit, strLen1+strLen2);
-                                System.arraycopy(inchargerSplit, 0, partSplit, strLen1, strLen2);
-                            }
                             for (String str : partSplit) {
                                 Participation p = new Participation();
                                 Optional<User> first = userList.stream().filter(u -> u.getName().equals(str)).findFirst();
                                 if (first.isPresent()) {
-                                    participationMapper.delete(new QueryWrapper<Participation>().eq("project_id",project.getId()));
-                                    p.setUserId(first.get().getId());
-                                    p.setProjectId(project.getId());
-                                    participationMapper.insert(p);
+                                    User partMemb = first.get();
+//                                    System.out.println("参与人:"+partMemb.getName());
+                                    if (!participationList.stream().anyMatch(partOne->partOne.getUserId().equals(partMemb.getId()))) {
+                                        p.setUserId(partMemb.getId());
+                                        p.setProjectId(project.getId());
+                                        participationList.add(p);
+                                    }
                                 } else {
                                     throw new Exception("参与人["+str+"]不存在");
                                 }
                             }
                         }
                     }
+                    if (participationList.size() > 0) {
+                        //批量保存
+                        List<Participation> finalOldPartList = oldPartList;
+                        List<Participation> addPartList = participationList.stream().filter(newP-> !finalOldPartList.stream().anyMatch(oldP->oldP.getUserId().equals(newP.getUserId()))).collect(Collectors.toList());
+                        if (addPartList.size() > 0) {
+                            participationService.saveBatch(addPartList);
+                        }
+                    }
                 }
                 msg.data = "成功导入"+importCount+"条数据。";
                 if (existCodeList.size() > 0) {
@@ -6218,6 +6227,48 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         return httpRespMsg;
     }
 
+    @Override
+    public HttpRespMsg fixParticipators(Integer companyId, HttpServletRequest request) {
+        //获取全部的分组参与人
+        List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().select("id").eq("company_id", companyId));
+        List<Integer> collect = projectList.stream().map(Project::getId).collect(Collectors.toList());
+        List<TaskGroup> groupList = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().in("project_id", collect));
+        List<Integer> groupIds = groupList.stream().map(TaskGroup::getId).collect(Collectors.toList());
+        List<GroupParticipator> groupParticipatorList = groupParticipatorMapper.selectList(new QueryWrapper<GroupParticipator>().in("group_id", groupIds).isNotNull("user_id"));
+        List<Participation> participationList = participationMapper.selectList(new QueryWrapper<Participation>().in("project_id", collect));
+        List<Participation> addPartList = new ArrayList<>();
+        //过滤出不在项目参与人中的分组参与人
+        for (Project p : projectList) {
+            List<TaskGroup> curGroups = groupList.stream().filter(g -> g.getProjectId().equals(p.getId())).collect(Collectors.toList());
+            List<String> groupInchargerList = curGroups.stream().map(TaskGroup::getInchargerId).collect(Collectors.toList());
+            List<Integer> curGroupIds = curGroups.stream().map(TaskGroup::getId).collect(Collectors.toList());
+            //取到当前这个项目的分组的参与人
+            List<GroupParticipator> curGParticipatorList = groupParticipatorList.stream().filter(gp -> curGroupIds.stream().anyMatch(curG -> curG.equals(gp.getGroupId()))).collect(Collectors.toList());
+            //当前这个项目的参与人
+            List<Participation> projectParticiList = participationList.stream().filter(part -> part.getProjectId().equals(p.getId())).collect(Collectors.toList());
+            //分组的参与人不在项目参与人中的
+            List<String> gpNotInList = curGParticipatorList.stream().filter(gp -> !StringUtils.isEmpty(gp.getUserId()) && !projectParticiList.stream().anyMatch(proPart -> proPart.getUserId().equals(gp.getUserId()))).map(GroupParticipator::getUserId).collect(Collectors.toList());
+            //分组负责人不在项目参与人里面的
+            List<String> inchargerNotInList = groupInchargerList.stream().filter(gi -> !StringUtils.isEmpty(gi) && !projectParticiList.stream().anyMatch(proPart -> proPart.getUserId().equals(gi))).collect(Collectors.toList());
+            //做个排重
+            gpNotInList.addAll(inchargerNotInList);
+            gpNotInList.stream().distinct().forEach(membId->{
+                Participation one = new Participation();
+                one.setProjectId(p.getId());
+                one.setUserId(membId);
+                System.out.println("添加="+one.getProjectId()+","+membId);
+                addPartList.add(one);
+            });
+        }
+        HttpRespMsg msg = new HttpRespMsg();
+        if (addPartList.size() > 0) {
+            msg.data = addPartList.size();
+            participationService.saveBatch(addPartList);
+            System.out.println("需要增加的参与人数量为"+addPartList.size());
+        }
+        return msg;
+    }
+
 
     private List<Department> getSubDepts(Department dp, List<Department> list) {
         List<Department> collect = list.stream().filter(l -> dp.getDepartmentId().equals(l.getSuperiorId())).collect(Collectors.toList());

+ 1 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -684,7 +684,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     //新增或编辑报告
     @Override
     public HttpRespMsg editReport(List<Report> reportList, String date, List<User> userList, BigDecimal hourCost, Integer companyId) {
-        System.out.println("date"+date);
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         TimeType timeType = timeTypeMapper.selectById(companyId);
         //删除不在本次更新名单中的老记录
@@ -4173,7 +4172,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         HttpRespMsg msg = new HttpRespMsg();
         List<String> dateList = JSONArray.parseArray(dateStr, String.class);
         //获取已经填报的工时
-        List<Report> list = reportMapper.selectList(new QueryWrapper<Report>().select("sum(working_time) as working_time, create_date")
+        List<Report> list = reportMapper.selectList(new QueryWrapper<Report>().select("sum(working_time) as working_time, create_date, GROUP_CONCAT(start_time,'-',end_time) as start_time")
                 .eq("creator_id", userId).in("create_date", dateList).groupBy("create_date"));
         msg.data = list;
         return msg;

+ 5 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -4473,7 +4473,11 @@
                                         let datem = new Date(this.zhoData[m].zhoDataTime)
                                         if(datei[0] == datem.getFullYear() && datei[1] == (datem.getMonth() + 1) && datei[2] == datem.getDate()){
                                             this.$set(this.zhoData[m],'filledTime',res.data[i].workingTime)
-                                            let reportTimes = res.data[i].startTime.split(',')
+                                            let reportTimes = [];
+                                            if (res.data[i].startTime != null) {
+                                                reportTimes = res.data[i].startTime.split(',')
+                                            }
+                                            
                                             this.$set(this.zhoData[m],'reportTimes',reportTimes)
                                         }
                                     }