소스 검색

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper into master

seyason 1 년 전
부모
커밋
67db7ddff5

+ 6 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -7688,6 +7688,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             map.put("realityTime",workingTime.doubleValue());
             map.put("isOver",bigDecimal.doubleValue()<0?"是":"否");
             map.put("remaining",bigDecimal.doubleValue()>0?bigDecimal.doubleValue():0);
+            String participations = String.valueOf(map.get("participations"));
+            String[] split = participations.split(",");
+            map.put("participations",split);
         }
         projectTimeCostList.forEach(pt->{
             List<Map<String, Object>> mapList = taskGroupPlanTimeList.stream().filter(t -> t.get("projectId").equals(pt.get("projectId"))).collect(Collectors.toList());
@@ -7702,6 +7705,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     break;
             }
             pt.put("projectGroupData",mapList);
+            String participations = String.valueOf(pt.get("participations"));
+            String[] split = participations.split(",");
+            pt.put("participations",split);
         });
         responseData.put("projectArrays",projectTimeCostList);
         msg.setData(responseData);

+ 4 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -1037,9 +1037,9 @@
         ps.contract_code as contractCode,ps.project_category_sub as projectCategorySub,ps.region,DATE_FORMAT(p.create_date,'%Y-%m-%d') as createDate,DATE_FORMAT(ps.warranty_start_date,'%Y-%m-%d') as warrantyStartDate,
         DATE_FORMAT(ps.warranty_end_date,'%Y-%m-%d') as warrantyEndDate,DATE_FORMAT(p.finish_date,'%Y-%m-%d') as finishDate,ps.bu,IFNULL(p.man_day*8,0) as planTime,IFNULL(SUM(r.working_time),0) as realityTime,
         case  when p.man_day*8-SUM(r.working_time) &gt;= 0 then '否' else '是' end as isOver ,case when p.man_day*8-SUM(r.working_time) &gt; 0 then (p.man_day*8-SUM(r.working_time)) else '0' end as remaining,
-        CONCAT('[',(select GROUP_CONCAT(CONCAT(u.job_number,'/',u.name)) from participation pa
+        (select GROUP_CONCAT(CONCAT(u.job_number,'/',u.name)) from participation pa
         left join user u on pa.user_id=u.id
-        where pa.project_id=p.id ),']') as participations
+        where pa.project_id=p.id ) as participations
         from project p
         left join project_main pm on p.project_main_id=pm.id
         left join project_level pl on p.level=pl.id
@@ -1070,9 +1070,9 @@
     <select id="getTaskGroupPlanTime" resultType="java.util.Map">
         select tg.project_id as projectId,tg.task_group_code as taskGroupCode,tg.name,tg.wbs_code as wbsCode,IFNULL(tg.man_day*8,0) as planTime,tg.id as groupId,
         CONCAT(uu.job_number,'/',uu.name) as incahrgerName,
-        CONCAT('[',(select GROUP_CONCAT(CONCAT(u.job_number,'/',u.name)) from group_participator gp
+        (select GROUP_CONCAT(CONCAT(u.job_number,'/',u.name)) from group_participator gp
         left join user u on gp.user_id=u.id
-        where gp.group_id=tg.id ),']') as participations
+        where gp.group_id=tg.id ) as participations
         from task_group tg
         left join user uu on uu.id=tg.incharger_id
         <where>

+ 43 - 18
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -5457,34 +5457,59 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
         HttpRespMsg data = getPlanDataWithStation(isFilterDept, filterDeptId, stationId, startDate, endDate, null, null);
         Map<String, Object> objectMap = (Map<String, Object>) data.data;
+        boolean isViewUser = (boolean) objectMap.get("isViewUser");
         List<Map<String, Object>> mapList = (List<Map<String, Object>>) objectMap.get("records");
         List<String> title=new ArrayList<>();
-        title.add("部门名称");
+        if (isViewUser) {
+            title.add("人员名称");
+        } else {
+            title.add("部门名称");
+        }
         List<String> headerList = (List<String>) objectMap.get("header");
         title.addAll(headerList);
         title.add("合计");
         List<List<String>> dataList=new ArrayList<>();
         dataList.add(title);
         for (Map<String, Object> map : mapList) {
-            List<String> item=new ArrayList<>();
-            item.add((String) map.get("departmentCascade"));
-            List<Map<String, Object>> deptList = (List<Map<String, Object>>) map.get("deptList");
-            for (String dateString : headerList) {
-                Optional<Map<String, Object>> first = deptList.stream().filter(d -> String.valueOf(d.get("startDate")).equals(dateString)).findFirst();
-                if(first.isPresent()){
-                    Map<String, Object> target = first.get();
-                    item.add("计划数:"+target.get("planNum")+"  "+target.get("planHour")+"分钟"+"  "+target.get("planCost")+"元"+"\n"+
-                             "实际数:"+target.get("nowNum")+"  "+target.get("nowHour")+"分钟"+"  "+target.get("nowCost")+"元"+"\n"+
-                             "进度:"+target.get("progress"));
-                }else {
-                   item.add("");
+            if(isViewUser){
+                List<String> item=new ArrayList<>();
+                item.add((String) map.get("userName"));
+                List<Map<String, Object>> deptList = (List<Map<String, Object>>) map.get("userList");
+                for (String dateString : headerList) {
+                    Optional<Map<String, Object>> first = deptList.stream().filter(d -> String.valueOf(d.get("startDate")).equals(dateString)).findFirst();
+                    if(first.isPresent()){
+                        Map<String, Object> target = first.get();
+                        item.add("计划数:"+"  "+target.get("planHour")+"分钟"+"  "+target.get("planCost")+"元"+"\n"+
+                                "实际数:"+"  "+target.get("nowHour")+"分钟"+"  "+target.get("nowCost")+"元"+"\n"
+                                );
+                    }else {
+                        item.add("");
+                    }
+                }
+                item.add("计划数:"+"  "+map.get("totalPlanHour")+"分钟"+"  "+map.get("totalPlanCost")+"元"+"\n"+
+                        "实际数:"+"  "+map.get("totalNowHour")+"分钟"+"  "+map.get("totalNowCost")+"元"+"\n"
+                        );
+                dataList.add(item);
+            }else {
+                List<String> item=new ArrayList<>();
+                item.add((String) map.get("departmentCascade"));
+                List<Map<String, Object>> deptList = (List<Map<String, Object>>) map.get("deptList");
+                for (String dateString : headerList) {
+                    Optional<Map<String, Object>> first = deptList.stream().filter(d -> String.valueOf(d.get("startDate")).equals(dateString)).findFirst();
+                    if(first.isPresent()){
+                        Map<String, Object> target = first.get();
+                        item.add("计划数:"+target.get("planNum")+"  "+target.get("planHour")+"分钟"+"  "+target.get("planCost")+"元"+"\n"+
+                                "实际数:"+target.get("nowNum")+"  "+target.get("nowHour")+"分钟"+"  "+target.get("nowCost")+"元"+"\n"+
+                                "进度:"+target.get("progress"));
+                    }else {
+                        item.add("");
+                    }
                 }
+                item.add("计划数:"+map.get("totalPlanNum")+"  "+map.get("totalPlanHour")+"分钟"+"  "+map.get("totalPlanCost")+"元"+"\n"+
+                        "实际数:"+map.get("totalNowNum")+"  "+map.get("totalNowHour")+"分钟"+"  "+map.get("totalNowCost")+"元"+"\n"+
+                        "进度:"+map.get("totalProgress"));
+                dataList.add(item);
             }
-            item.add("计划数:"+map.get("totalPlanNum")+"  "+map.get("totalPlanHour")+"分钟"+"  "+map.get("totalPlanCost")+"元"+"\n"+
-                    "实际数:"+map.get("totalNowNum")+"  "+map.get("totalNowHour")+"分钟"+"  "+map.get("totalNowCost")+"元"+"\n"+
-                    "进度:"+map.get("totalProgress"));
-            dataList.add(item);
-
         }
         Company company = companyMapper.selectById(companyId);
         String fileName=("车间工位计划表_")+company.getCompanyName()+System.currentTimeMillis();

+ 27 - 35
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ReportMapper.xml

@@ -189,7 +189,7 @@
         from plan_procedure_total a
         left join plan b on a.plan_id=b.id
         left join prod_procedure c on a.prod_procedure_id=c.id
-        where b.company_id=#{companyId}
+        where b.company_id=#{companyId} and b.status!=2
         <if test="userId!=null and userId!=''">
             and d.user_id=#{userId}
         </if>
@@ -200,7 +200,7 @@
             and b.foreman_id=#{foremanId}
         </if>
         <if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
-            and (b.start_date &gt;= #{startDate} and b.end_date &lt;= #{endDate})
+            and b.start_date between #{startDate} and #{endDate}
         </if>
         order by b.create_time desc ,a.id
         <if test="pageStart!=null and pageSize!=null">
@@ -215,7 +215,7 @@
         from plan_procedure_total a
         left join plan b on a.plan_id=b.id
         left join prod_procedure c on a.prod_procedure_id=c.id
-        where b.company_id=#{companyId}
+        where b.company_id=#{companyId} and b.status!=2
         <if test="userId!=null and userId!=''">
             and d.user_id=#{userId}
         </if>
@@ -226,7 +226,7 @@
             and b.foreman_id=#{foremanId}
         </if>
         <if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
-            and (b.start_date &gt;= #{startDate} and b.end_date &lt;= #{endDate})
+            and b.start_date between #{startDate} and #{endDate}
         </if>
         ) as total
     </select>
@@ -373,31 +373,27 @@
     </select>
 
     <select id="getDpetStatisticsProgressList" resultType="java.util.Map">
-        select de.department_id as departmentId, de.department_name as departmentName,
-        SUM(d.work_time) as planWorkTime,
-        SUM((select SUM(working_time) from report where user_procedure_team_id = d.id)) as nowWorkTime,
-        SUM((select SUM(cost) from report where user_procedure_team_id = d.id)) as  nowCost
-        from plan_procedure_total a
-        left join plan b on a.plan_id=b.id
-        left join prod_procedure c on a.prod_procedure_id=c.id
-        left join prod_procedure_team d on a.id=d.plan_procedure_id
-        left join user u on u.id=d.user_id
-        left join department de on b.station_id=de.department_id
-        where b.company_id=#{companyId}
+        select d.department_id as departmentId,d.department_name as departmentName,IFNULL(SUM((select SUM(working_time) from report where plan_id = p.id)),0) as nowWorkTime,
+        IFNULL(SUM((select SUM(cost) from report where plan_id  = p.id)),0) as  nowCost,
+        IFNULL(SUM((select SUM(total_working_hours) from plan_procedure_total where plan_id  = p.id)),0) as   planWorkTime
+        from
+        department d
+        left join plan p on p.station_id=d.department_id
+        where p.company_id=#{companyId} and p.status!=2
         <if test="userId!=null and userId!=''">
             and d.user_id=#{userId}
         </if>
         <if test="deptId!=null and deptId!=''">
-            and b.station_id=#{deptId}
+            and p.station_id=#{deptId}
         </if>
         <if test="foremanId!=null and foremanId!=''">
-            and b.foreman_id=#{foremanId}
+            and p.foreman_id=#{foremanId}
         </if>
         <if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
-            and (b.start_date &gt;= #{startDate} and b.end_date &lt;= #{endDate})
+            and p.start_date between #{startDate} and #{endDate}
         </if>
-        group by b.station_id
-        order by b.create_time desc ,a.id
+        group by d.department_id
+        order by p.create_time desc
         <if test="pageStart!=null and pageSize!=null">
             limit #{pageStart},#{pageSize}
         </if>
@@ -405,30 +401,26 @@
 
     <select id="getDpetStatisticsProgressCount" resultType="java.lang.Integer">
         select count(1) from (
-        select de.department_name as departmentName,
-        SUM(d.work_time) as planWorkTime,
-        SUM((select SUM(working_time) from report where user_procedure_team_id = d.id)) as nowWorkTime,
-        SUM((select SUM(cost) from report where user_procedure_team_id = d.id)) as  nowCost
-        from plan_procedure_total a
-        left join plan b on a.plan_id=b.id
-        left join prod_procedure c on a.prod_procedure_id=c.id
-        left join prod_procedure_team d on a.id=d.plan_procedure_id
-        left join user u on u.id=d.user_id
-        left join department de on b.station_id=de.department_id
-        where b.company_id=#{companyId}
+        select d.department_id as departmentId,d.department_name as departmentName,IFNULL(SUM((select SUM(working_time) from report where plan_id = p.id)),0) as nowWorkTime,
+        IFNULL(SUM((select SUM(cost) from report where plan_id  = p.id)),0) as  nowCost,
+        IFNULL(SUM((select SUM(total_working_hours) from plan_procedure_total where plan_id  = p.id)),0) as   planWorkTime
+        from
+        department d
+        left join plan p on p.station_id=d.department_id
+        where p.company_id=#{companyId} and p.status!=2
         <if test="userId!=null and userId!=''">
             and d.user_id=#{userId}
         </if>
         <if test="deptId!=null and deptId!=''">
-            and b.station_id=#{deptId}
+            and p.station_id=#{deptId}
         </if>
         <if test="foremanId!=null and foremanId!=''">
-            and b.foreman_id=#{foremanId}
+            and p.foreman_id=#{foremanId}
         </if>
         <if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
-            and (b.start_date &gt;= #{startDate} and b.end_date &lt;= #{endDate})
+            and p.start_date between #{startDate} and #{endDate}
         </if>
-        group by b.station_id
+        group by d.department_id
         ) as total
     </select>
     <select id="getReportList" resultType="java.util.Map">

+ 6 - 0
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/statistic/index.vue

@@ -645,6 +645,7 @@ export default {
       planDataWithStationDatas:[],
       planDataWithStationHead:[],
       isViewUser:false,
+      exportDeptId:null,
 
       //筛选项
       productId:"",
@@ -1058,6 +1059,7 @@ export default {
         stationId:this.departmentIdArray[this.departmentIdArray.length - 1],
       }
       if(deptId){
+        this.exportDeptId=deptId
         param.filterDeptId=deptId
         param.isFilterDept=1
       }
@@ -1319,6 +1321,10 @@ export default {
         sl.startDate=this.rangeDatas[0];
         sl.endDate=this.rangeDatas[1];
         sl.deptId=this.departmentIdArray[this.departmentIdArray.length-1];
+        if(this.exportDeptId){
+          sl.filterDeptId=this.exportDeptId;
+          sl.isFilterDept=1
+        }
     }
         this.http.post(url, sl,
         res => {