Browse Source

走访计划完成率优化

yangyue 1 year ago
parent
commit
240d8ac419

+ 45 - 0
video/src/main/java/cn/com/taiji/video/cotroller/VideoUrlController.java

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.util.List;
 
@@ -47,4 +48,48 @@ public class VideoUrlController {
     public List<VideoAnalysisLineDTO> queryLineRecord(Integer type) {
         return urlService.queryLineRecord(type);
     }
+
+
+    public static void main(String[] args) {
+        int targetVisitTotal = 14;
+        int visitShipNum = 6;
+        int completeVisitShipNum = 7;
+
+        int visitPlaceNum = 4;
+        int completeVisitPlaceNum = 2;
+
+        int visitPersonNum = 4;
+        int completeVisitPersonNum = 5;
+
+        float shipV = 0.0F;
+        float placeV = 0.0F;
+        float personV = 0.0F;
+        if (0 != completeVisitShipNum && 0 != visitShipNum) {
+            if (completeVisitShipNum > visitShipNum) {
+                shipV = (float) visitShipNum / targetVisitTotal;
+            } else {
+                shipV = ((float)completeVisitShipNum / visitShipNum) * ((float)visitShipNum / targetVisitTotal);
+            }
+        }
+        if (0 != completeVisitPlaceNum && 0 != visitPlaceNum) {
+            if (completeVisitPlaceNum > visitPlaceNum) {
+                placeV = (float) visitPlaceNum / targetVisitTotal;
+            } else {
+                placeV = ((float)completeVisitPlaceNum / visitPlaceNum) * ((float)visitPlaceNum / targetVisitTotal);
+            }
+        }
+        if (0 != completeVisitPersonNum && 0 != visitPersonNum) {
+            if (completeVisitPersonNum > visitPersonNum) {
+                personV = (float) visitPersonNum / targetVisitTotal;
+            } else {
+                personV = ((float)completeVisitPersonNum / visitPersonNum) * ((float)visitPersonNum / targetVisitTotal);
+            }
+        }
+        float result = BigDecimal.valueOf((shipV + placeV + personV)).setScale(2,BigDecimal.ROUND_DOWN).floatValue();
+        System.out.println(shipV);
+        System.out.println(placeV);
+        System.out.println(personV);
+        System.out.println(shipV + placeV + personV);
+        System.out.println(result);
+    }
 }