Kaynağa Gözat

驾驶舱百分比无值时默认为0

jiawuxian 1 yıl önce
ebeveyn
işleme
0217e1cb68

+ 2 - 2
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/utils/NumberUtils.java

@@ -12,7 +12,7 @@ public class NumberUtils {
      */
     public static float computeRate(Integer total, Integer divisor) {
         if (ObjectUtil.equal(total, 0) || ObjectUtil.isNull(total)) {
-            return 1F;
+            return 0F;
         } else if (ObjectUtil.equal(divisor, 0) || ObjectUtil.isNull(divisor)) {
             return 0F;
         } else {
@@ -29,7 +29,7 @@ public class NumberUtils {
      */
     public static float computeRate(Float total, Float divisor) {
         if (ObjectUtil.equal(total, 0F) || ObjectUtil.isNull(total)) {
-            return 1F;
+            return 0F;
         } else if (ObjectUtil.equal(divisor, 0F) || ObjectUtil.isNull(divisor)) {
             return 0F;
         } else {

+ 7 - 7
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/impl/CockpitServiceImpl.java

@@ -208,8 +208,8 @@ public class CockpitServiceImpl implements CockpitService {
             vo.setUnequippedRate(NumberUtils.computeRate(vo.getEquippedCount() + vo.getUnequippedCount(), vo.getUnequippedCount()));
         } else {
             vo = new OrgSecurityInfoVo();
-            vo.setEquippedRate(1f);
-            vo.setUnequippedRate(1f);
+            vo.setEquippedRate(0f);
+            vo.setUnequippedRate(0f);
         }
 
         return vo;
@@ -256,12 +256,12 @@ public class CockpitServiceImpl implements CockpitService {
         vo.setUnreform(NumberUtils.computeRate(questionDto.getTotal(), questionDto.getUnconfirmedCount()));
         vo.setReformed(NumberUtils.computeRate(questionDto.getTotal(), questionDto.getReformedCount()));
 
-        if (overdueCount.size() > 0) {
+        if (overdueCount.size() == 2) {
             Long count = (Long) overdueCount.get("count");
             BigDecimal overdue = (BigDecimal) overdueCount.get("overdueCount");
             vo.setOverdue(NumberUtils.computeRate(count.intValue(), overdue.intValue()));
         } else {
-            vo.setOverdue(1f);
+            vo.setOverdue(0f);
         }
 
         return vo;
@@ -292,11 +292,11 @@ public class CockpitServiceImpl implements CockpitService {
         if (ObjectUtil.equal(period, PeriodEnum.Today.getCode())) {
             return DateUtil.beginOfDay(new Date());
         } else if (ObjectUtil.equal(period, PeriodEnum.Nearly7Days.getCode())) {
-            return DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -7));
+            return DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -6));
         } else if (ObjectUtil.equal(period, PeriodEnum.Nearly30Days.getCode())) {
-            return DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -30));
+            return DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -29));
         } else if (ObjectUtil.equal(period, PeriodEnum.Nearly90Days.getCode())) {
-            return DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -90));
+            return DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -89));
         } else if (ObjectUtil.equal(period, PeriodEnum.ThisYear.getCode())) {
             return DateUtil.beginOfDay(DateUtil.beginOfYear(new Date()));
         } else {

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/board/CockpitMapper.xml

@@ -236,6 +236,6 @@
     <select id="selectOverDueQuestionCount" resultType="Map">
         SELECT count(0)                                              as count,
                sum(if(reform_status != 11 and confirm_status != 3 and reform_deadline >= #{startDate} and reform_deadline &lt;=#{endDate}, 1, 0)) as overdueCount
-        FROM core_question
+        FROM core_question where org_path LIKE CONCAT(#{orgPath}, '%')
     </select>
 </mapper>