Ver código fonte

修改泓浒统计字段

QuYueTing 3 semanas atrás
pai
commit
61de8a8e1d

+ 10 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/FmwDetail.java

@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2025-04-16
+ * @since 2025-04-25
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -73,10 +73,16 @@ public class FmwDetail extends Model<FmwDetail> {
     private String extraField5;
 
     /**
-     * 组装维修工时
+     * 组装工时
      */
-    @TableField("maintance_time")
-    private Double maintanceTime;
+    @TableField("compose_time")
+    private Double composeTime;
+
+    /**
+     * 维修工时
+     */
+    @TableField("repair_time")
+    private Double repairTime;
 
     /**
      * 调试工时

+ 25 - 14
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceMonthlyWorktimeServiceImpl.java

@@ -37,6 +37,17 @@ import java.util.stream.Collectors;
  */
 @Service
 public class FinanceMonthlyWorktimeServiceImpl extends ServiceImpl<FinanceMonthlyWorktimeMapper, FinanceMonthlyWorktime> implements FinanceMonthlyWorktimeService {
+    public static final String TIME_TYPE_COMPOSE = "组装工时(车间)";
+    public static final String TIME_TYPE_REPAIR = "维修工时(车间)";
+    public static final String TIME_TYPE_DEBUG = "调试工时(车间)";
+    public static final String TIME_TYPE_WAIT = "等料工时(车间)";
+    static List<String> groupNameList = new ArrayList<>();
+    {
+        groupNameList.add(TIME_TYPE_COMPOSE);
+        groupNameList.add(TIME_TYPE_REPAIR);
+        groupNameList.add(TIME_TYPE_DEBUG);
+        groupNameList.add(TIME_TYPE_WAIT);
+    }
 
     @Resource
     private FinanceMonthlyWorktimeMapper financeMonthlyWorktimeMapper;
@@ -173,12 +184,8 @@ public class FinanceMonthlyWorktimeServiceImpl extends ServiceImpl<FinanceMonthl
             List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, user.getCompanyId()));
             List<Project> projectList = projectMapper.selectList(new LambdaQueryWrapper<Project>().eq(Project::getCompanyId, user.getCompanyId()));
             List<Project> publicProjectList = projectList.stream().filter(p -> p.getIsPublic() == 1).collect(Collectors.toList());
-            List<ErpOrderInfo> erpOrderInfoList = erpOrderInfoMapper.selectList(new LambdaQueryWrapper<ErpOrderInfo>());
             List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().select(User::getId, User::getName, User::getDepartmentId).eq(User::getCompanyId, user.getCompanyId()));
-            List<String> groupNameList = new ArrayList<>();
-            groupNameList.add("组装/维修工时");
-            groupNameList.add("调试工时");
-            groupNameList.add("等料工时");
+
             List<Report> reportList = reportMapper.getReportProjectGroupDetailList(user.getCompanyId(), firstDayOfMonth, lastDayOfMonth, groupNameList);
             List<Report> assistList = reportMapper.getReportProjectAssistTime(user.getCompanyId(), firstDayOfMonth, lastDayOfMonth, groupNameList);
 
@@ -192,7 +199,8 @@ public class FinanceMonthlyWorktimeServiceImpl extends ServiceImpl<FinanceMonthl
                     setFmwTime(fmwDetail, report);
                 } else {
                     FmwDetail fmwDetail = new FmwDetail();
-                    fmwDetail.setMaintanceTime(0.0);
+                    fmwDetail.setComposeTime(0.0);
+                    fmwDetail.setRepairTime(0.0);
                     fmwDetail.setDebugTime(0.0);
                     fmwDetail.setWaitingTime(0.0);
                     fmwDetail.setAssistTime(0.0);
@@ -254,14 +262,14 @@ public class FinanceMonthlyWorktimeServiceImpl extends ServiceImpl<FinanceMonthl
                     for (Report publicReportDeptItem : publicReportList) {
                         Integer deptId = publicReportDeptItem.getDeptId();
                         List<FmwDetail> deptAllReportList = insertDataList.stream().filter(r -> r.getDeptId().equals(deptId)).collect(Collectors.toList());
-                        double totalDeptTime = deptAllReportList.stream().reduce(0.0, (a, b) -> a + b.getMaintanceTime() + b.getDebugTime() + b.getWaitingTime(), Double::sum);
+                        double totalDeptTime = deptAllReportList.stream().reduce(0.0, (a, b) -> a + b.getComposeTime() + b.getRepairTime() + b.getDebugTime() + b.getWaitingTime(), Double::sum);
                         System.out.println("处理公共工时分摊,总工时=="+totalDeptTime);
                         if (totalDeptTime > 0) {
                             //计算总工时: 用维修组装工时,调试工时和等料工时相加
                             insertDataList.forEach(fmwDetail -> {
                                 //计算每一个项目的部门内部工时占比,按比例分摊公共工时
                                 if (fmwDetail.getDeptId().equals(deptId)) {
-                                    double curProjectTime = fmwDetail.getMaintanceTime() + fmwDetail.getDebugTime() + fmwDetail.getWaitingTime();
+                                    double curProjectTime = fmwDetail.getComposeTime() + fmwDetail.getRepairTime() + fmwDetail.getDebugTime() + fmwDetail.getWaitingTime();
                                     double assignTime = curProjectTime / totalDeptTime * publicReportDeptItem.getWorkingTime();
                                     //理论上不会出现fmwDetail.getPublicTime()有值的情况,但是为了保险起见做个叠加计算吧
                                     fmwDetail.setPublicTime(fmwDetail.getPublicTime() == null ? assignTime : fmwDetail.getPublicTime() + assignTime);
@@ -285,13 +293,13 @@ public class FinanceMonthlyWorktimeServiceImpl extends ServiceImpl<FinanceMonthl
                                         //按目标部门的部门内部工时占比进行二次分配
                                         Integer assignToDeptId = assistDeptItem.getDeptId();
                                         List<FmwDetail> targetDeptReportList = insertDataList.stream().filter(r -> r.getDeptId().equals(assignToDeptId)).collect(Collectors.toList());
-                                        double totalTargetDeptTime = targetDeptReportList.stream().reduce(0.0, (a, b) -> a + b.getMaintanceTime() + b.getDebugTime() + b.getWaitingTime(), Double::sum);
+                                        double totalTargetDeptTime = targetDeptReportList.stream().reduce(0.0, (a, b) -> a + b.getComposeTime() + b.getRepairTime() + b.getDebugTime() + b.getWaitingTime(), Double::sum);
                                         if (totalTargetDeptTime > 0) {
                                             //计算总工时: 用维修组装工时,调试工时和等料工时相加
                                             insertDataList.forEach(fmwDetail -> {
                                                 //计算每一个项目的部门内部工时占比,按比例分摊公共工时
                                                 if (fmwDetail.getDeptId().equals(assignToDeptId)) {
-                                                    double curProjectTime = fmwDetail.getMaintanceTime() + fmwDetail.getDebugTime() + fmwDetail.getWaitingTime();
+                                                    double curProjectTime = fmwDetail.getComposeTime() + fmwDetail.getRepairTime() + fmwDetail.getDebugTime() + fmwDetail.getWaitingTime();
                                                     double assignTime = curProjectTime / totalTargetDeptTime * assignToDeptTime;
                                                     //可能之前已经有其他部门的分摊过来了,需要叠加
                                                     fmwDetail.setPublicTime(fmwDetail.getPublicTime() == null ? assignTime : fmwDetail.getPublicTime() +assignTime);
@@ -326,13 +334,16 @@ public class FinanceMonthlyWorktimeServiceImpl extends ServiceImpl<FinanceMonthl
 
     private void setFmwTime(FmwDetail fmwDetail, Report report) {
         switch (report.getGroupName()) {
-            case "组装/维修工时":
-                fmwDetail.setMaintanceTime(report.getWorkingTime());
+            case TIME_TYPE_COMPOSE:
+                fmwDetail.setComposeTime(report.getWorkingTime());
+                break;
+            case TIME_TYPE_REPAIR:
+                fmwDetail.setRepairTime(report.getWorkingTime());
                 break;
-            case "调试工时":
+            case TIME_TYPE_DEBUG:
                 fmwDetail.setDebugTime(report.getWorkingTime());
                 break;
-            case "等料工时":
+            case TIME_TYPE_WAIT:
                 fmwDetail.setWaitingTime(report.getWorkingTime());
                 break;
         }

+ 8 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/FmwDetailMapper.xml

@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.management.platform.mapper.FmwDetailMapper">
+
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.management.platform.entity.FmwDetail">
         <id column="id" property="id" />
@@ -13,7 +13,8 @@
         <result column="project_code" property="projectCode" />
         <result column="extra_field4" property="extraField4" />
         <result column="extra_field5" property="extraField5" />
-        <result column="maintance_time" property="maintanceTime" />
+        <result column="compose_time" property="composeTime" />
+        <result column="repair_time" property="repairTime" />
         <result column="debug_time" property="debugTime" />
         <result column="waiting_time" property="waitingTime" />
         <result column="assist_time" property="assistTime" />
@@ -22,18 +23,18 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, fmw_id, dept_id, dept_name, dept_code, project_id, project_code, extra_field4, extra_field5, maintance_time, debug_time, waiting_time, assist_time, public_time
+        id, fmw_id, dept_id, dept_name, dept_code, project_id, project_code, extra_field4, extra_field5, compose_time, repair_time, debug_time, waiting_time, assist_time, public_time
     </sql>
     <select id="getTisTime" resultType="com.management.platform.entity.vo.TisTimeVO">
         select extra_field4 as orderId,extra_field5 as line
-             ,sum(maintance_time+debug_time+waiting_time+assist_time+public_time) as workTime
+             ,sum(compose_time+repair_time+debug_time+waiting_time+assist_time+public_time) as workTime
         from fmw_detail
         where fmw_id = #{fmwId}
         group by extra_field4,extra_field5
     </select>
     <select id="getTisTimeByFmwId" resultType="com.management.platform.entity.vo.TisTimeVO">
         select extra_field4 as orderId,extra_field5 as line
-             ,sum(maintance_time+debug_time+waiting_time+assist_time+public_time) as workTime
+             ,sum(compose_time+repair_time+waiting_time+assist_time+public_time) as workTime
         from fmw_detail
         where fmw_id = #{fmwId}
     </select>