shudonghui 1 год назад
Родитель
Сommit
88e2dec3f9

+ 0 - 2
sop-business/src/main/java/com/qmth/sop/business/mapper/ServiceAnalyseMapper.java

@@ -26,8 +26,6 @@ public interface ServiceAnalyseMapper extends BaseMapper<TBService> {
 
     List<Map<String,Object>> projectProgress(@Param("serviceUnitId") Long serviceUnitId);
 
-    Integer servicePersonnelTotal(@Param("serviceUnitId") Long serviceUnitId);
-
     Integer equipmentOutboundTotal(@Param("serviceUnitId") Long serviceUnitId);
 
     Integer projectCount(@Param("serviceUnitId") Long serviceUnitId);

+ 7 - 6
sop-business/src/main/java/com/qmth/sop/business/service/impl/ServiceAnalyseServiceImpl.java

@@ -67,16 +67,17 @@ public class ServiceAnalyseServiceImpl extends ServiceImpl<ServiceAnalyseMapper,
                     }
                 });
 
-        map.put("projectProgress", (finish[0]) * 100 / crmNum);
+        map.put("projectProgress", (crmNum==0?0:finish[0]) * 100 / crmNum);
         map.put("equipmentOutboundTotal", this.baseMapper.equipmentOutboundTotal(serviceUnitId));
-        Integer outboundTotal = sysDeviceService.count(new LambdaQueryWrapper<SysDevice>().eq(SysDevice::getBound, InOutTypeEnum.OUT));
+        //Integer outboundTotal = sysDeviceService.count(new LambdaQueryWrapper<SysDevice>().eq(SysDevice::getBound, InOutTypeEnum.OUT));
         int totalDevices = sysDeviceService.count(new LambdaQueryWrapper<SysDevice>().eq(SysDevice::getStatus, DeviceStatusEnum.NORMAL));
-        map.put("equipmentOccupancyRate", totalDevices == 0 ? 0 : outboundTotal * 100 / totalDevices);
-        map.put("servicePersonnelTotal", this.baseMapper.servicePersonnelTotal(serviceUnitId));
+        map.put("equipmentOccupancyRate", totalDevices == 0 ? 0 :((Integer) map.get("equipmentOutboundTotal")) * 100 / totalDevices);
+        List<UserArchivesAllocationResult> userArchivesAllocationResults = this.baseMapper.findCrmAllocation(serviceUnitId, null, null);
+        Integer distributed = userArchivesAllocationResults.stream().mapToInt(UserArchivesAllocationResult::getDistributed).sum();
+        map.put("servicePersonnelTotal",distributed);
         //认证有效的人员总数
-        Integer personnelTotal = this.baseMapper.servicePersonnelTotal(null);
         int totalUserArchives = tbUserArchivesSupplierService.countAuthentication();
-        map.put("sitePersonnelOccupancyRate", totalUserArchives == 0 ? 0 : personnelTotal * 100 / totalUserArchives);
+        map.put("sitePersonnelOccupancyRate", totalUserArchives == 0 ? 0 : distributed * 100 / totalUserArchives);
         return map;
     }
 

+ 0 - 51
sop-business/src/main/resources/mapper/ServiceAnalyseMapper.xml

@@ -57,58 +57,7 @@
 
         </where>
     </select>
-    <select id="servicePersonnelTotal" resultType="java.lang.Integer">
-        SELECT count( DISTINCT region_user_id )+ count( DISTINCT user_id )  from
 
-        t_b_user_archives_allocation
-                <where>
-                    <if test="serviceUnitId != null and serviceUnitId != ''">
-                        and service_id = #{serviceUnitId}
-                    </if>
-
-                </where>
-<!--        SELECT count(DISTINCT id)  FROM sys_user  WHERE-->
-<!--        id IN (-->
-<!--        SELECT a.lead_id  FROM t_b_sop_info_detail a-->
-<!--        left join t_b_sop_info i on a.sop_info_id=i.id-->
-
-<!--        LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = i.sop_no-->
-<!--        LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id-->
-<!--        <where>-->
-<!--            and tffa.status!='FINISH'-->
-<!--            <if test="serviceUnitId != null and serviceUnitId != ''">-->
-<!--                and i.service_id = #{serviceUnitId}-->
-<!--            </if>-->
-
-<!--        </where>-->
-<!--        UNION ALL-->
-<!--        SELECT a.region_user_id  FROM t_b_sop_info_detail a-->
-<!--        left join t_b_sop_info i on a.sop_info_id=i.id-->
-
-<!--        LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = i.sop_no-->
-<!--        LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id-->
-<!--        <where>-->
-<!--            and tffa.status!='FINISH'-->
-<!--            <if test="serviceUnitId != null and serviceUnitId != ''">-->
-<!--                and i.service_id = #{serviceUnitId}-->
-<!--            </if>-->
-
-<!--        </where>-->
-<!--        UNION ALL-->
-<!--        SELECT a.engineer_user_id  FROM t_b_sop_info_detail a-->
-<!--        left join t_b_sop_info i on a.sop_info_id=i.id-->
-
-<!--        LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = i.sop_no-->
-<!--        LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id-->
-<!--        <where>-->
-<!--            and tffa.status!='FINISH'-->
-<!--            <if test="serviceUnitId != null and serviceUnitId != ''">-->
-<!--                and i.service_id = #{serviceUnitId}-->
-<!--            </if>-->
-
-<!--        </where>-->
-<!--        )-->
-    </select>
     <select id="projectCount" resultType="java.lang.Integer">
         SELECT
         count(DISTINCT c.id )