From cc55ffcea74c7d23dadaa0860befbcdf98f35341 Mon Sep 17 00:00:00 2001 From: admin <2780501319@qq.com> Date: 星期一, 16 九月 2019 23:22:13 +0800 Subject: [PATCH] 资金相关包目录修改 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicController.java | 38 +++++++++++++++++++++++++------------- 1 files changed, 25 insertions(+), 13 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicController.java index 48e8ffd..9c026b0 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicController.java @@ -199,21 +199,33 @@ long old = value.getTime(); long now = nowDate.getTime(); - long oldDay = old/ (1000 * 60 * 60 * 24L); - long nowDay = now / (1000 * 60 * 60 * 24L); - if (y1 == y2 && d1 == d2) {//鍒ゆ柇鏄笉鏄悓涓�骞寸殑鍚屼竴澶� - long cha = now - old; - if (cha < 1000 * 60 * 2L) - desc = "鍒氬垰"; - else if (cha < 1000 * 60 * 60L) - desc = (cha / (1000 * 60)) + "鍒嗛挓鍓�"; - else - desc = (cha / (1000 * 60 * 60)) + "灏忔椂鍓�"; - } else if (nowDay - oldDay == 1) { - desc = "鏄ㄥぉ"; + if (y1 == y2) { + if (d1 == d2) { + long cha = now - old; + if (cha < 1000 * 60 * 2L) { + desc = "鍒氬垰"; + }else if (cha < 1000 * 60 * 60L) { + desc = (cha / (1000 * 60)) + "鍒嗛挓鍓�"; + }else { + desc = (cha / (1000 * 60 * 60)) + "灏忔椂鍓�"; + } + } else if (d2 - d1 == 1) { + desc = "鏄ㄥぉ"; + } else { + desc = (d2 - d1) + "澶╁墠"; + } } else { - desc = (nowDay - oldDay) + "澶╁墠"; + int timeDistance = 0; + for (int i = y1; i < y2; i++) { + if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) { + timeDistance += 366; // 闂板勾 + } else { + timeDistance += 365; // 涓嶆槸闂板勾 + } + } + desc = timeDistance + (d2 - d1) + "澶╁墠"; } + return new JsonPrimitive(desc); } -- Gitblit v1.8.0