瀏覽代碼

fix: 余额

xdd 1 周之前
父節點
當前提交
eede932816

+ 9 - 10
fs-service-system/src/main/java/com/fs/statis/service/impl/FsStatisSalerWatchServiceImpl.java

@@ -171,6 +171,11 @@ public class FsStatisSalerWatchServiceImpl implements FsStatisSalerWatchService
             // 确定当前销售对应的sop任务的执行记录
             List<String> periodList = sopUserLogsMapper.selectSopUserLogsByQwUserIds(qwUserIdList);
 
+            if(CollectionUtils.isEmpty(periodList)){
+                log.info("当前销售 {} 没有相关的SOP营期!", companyUser.getUserId());
+                continue;
+            }
+
             for (String periodId : periodList) {
                 // 去sop记录表找对应的SOP发送记录,记录数作为营期人数
                 Long periodCount = qwSopLogsMapper.selectQwSopLogsCountByQwUserId(qwUserIdList,periodId,previousDay);
@@ -183,19 +188,13 @@ public class FsStatisSalerWatchServiceImpl implements FsStatisSalerWatchService
                 fsStatisSalerWatch.setDeptId(companyUser.getDeptId());
                 fsStatisSalerWatch.setCompanyUserId(companyUser.getUserId());
                 fsStatisSalerWatch.setTrainCampNum(periodCount);
-                fsStatisSalerWatch.setNotRegisteredNum(periodCount - registerCount);
+                fsStatisSalerWatch.setNotRegisteredNum(Math.max(0, periodCount - registerCount));
                 fsStatisSalerWatch.setRegisteredNum(registerCount);
                 fsStatisSalerWatch.setCompletedNum(completedCount);
 
-                float regRate = 0.0f;
-                if(periodCount != 0) {
-                    regRate = registerCount / periodCount;
-                }
-                float finishedRate = 0.0f;
-                if(registerCount != 0) {
-                    finishedRate = completedCount / registerCount;
-                }
-
+                // 修复比率计算
+                float regRate = (periodCount > 0) ? (float) registerCount / periodCount : 0.0f;
+                float finishedRate = (registerCount > 0) ? (float) completedCount / registerCount : 0.0f;
 
                 fsStatisSalerWatch.setRegRate(regRate);
                 fsStatisSalerWatch.setFinishedRate(finishedRate);

+ 2 - 1
fs-service-system/src/main/resources/mapper/statis/ConsumptionBalanceMapper.xml

@@ -345,7 +345,7 @@
         group by start_date
     </select>
     <select id="getCurrentBalance" resultType="java.math.BigDecimal">
-        select sum(money) from company
+        select sum(money) from company where is_del=0
     </select>
     <select id="dealerAggregatedCompanyId" resultType="com.fs.statis.dto.DealerAggregatedDTO">
         SELECT
@@ -394,6 +394,7 @@
             <if test="companyId != null">
                 company_id = #{companyId}
             </if>
+            AND is_del=0
         </where>
     </select>