anderx 1 год назад
Родитель
Сommit
dab218f18f

+ 3 - 0
src/main/java/com/goafanti/common/constant/AFTConstants.java

@@ -203,11 +203,14 @@ public class AFTConstants {
 
 	/** 转公共客户拜访时限 **/
 	public static final long USER_FOLLOW_LIMIT_MS					= 24*3600*1000*30L;
+	public static final long USER_FOLLOW_DAYS					= 30;
 	/** 转公公共客户签单时限 **/
 	public static final long USER_SIGN_LIMIT_MS						= 24*3600*1000*270L;
+	public static final long USER_SIGN_DAYS						=270;
 
 	/** 转公共客户拜访时限 **/
 	public static final long PROJECT_FOLLOW_LIMIT_MS					= 24*3600*1000*30L;
+	public static final long PROJECT_FOLLOW_DAYS					= 30;
 	/** 转公公共客户签单时限 **/
 	public static final long PROJECT_SIGN_LIMIT_MS						= 24*3600*1000*900L;
 

+ 11 - 9
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -35,6 +35,9 @@ import javax.annotation.Resource;
 import java.lang.reflect.InvocationTargetException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 
 @Service
@@ -2142,9 +2145,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	 * @param power
 	 */
 	private void setCustomerList(List<CustomerListOut> tmpList, int i, Integer power) {
-		Date now = new Date();
 		Date s1, s2;
-		long l1, l2;
 		int diff1 = 0, diff2 = 0;
 		for (CustomerListOut clo : tmpList) {
             // 如果最近跟进为空直接取转换时间
@@ -2161,19 +2162,20 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
             }
             // 另外一个时间取转换时间
             s2 = clo.getTransferTime();
-            l1 = s1.getTime();
-            l2 = s2.getTime();
-            if (i == 0) {
-                diff1 = (int) ((l1 + AFTConstants.USER_FOLLOW_LIMIT_MS - now.getTime()) / (24 * 3600 * 1000));
-                diff2 = (int) ((l2 + AFTConstants.USER_SIGN_LIMIT_MS - now.getTime()) / (24 * 3600 * 1000));
+			LocalDate localDate = LocalDate.now();
+			LocalDate localDate1 = s1.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusDays(AFTConstants.USER_FOLLOW_DAYS);
+			LocalDate localDate2 = s2.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusDays(AFTConstants.USER_SIGN_DAYS);
+			if (i == 0) {
+				diff1 =  (int)ChronoUnit.DAYS.between(localDate,localDate1);
+				diff2 =  (int)ChronoUnit.DAYS.between(localDate,localDate2);
 				if (diff1 < 0)diff1 = 0;
 				if (diff2 < 0)diff2 = 0;
             } else if (i == 1) {
-                diff1 = (int) ((l1 + AFTConstants.PROJECT_FOLLOW_LIMIT_MS - now.getTime()) / (24 * 3600 * 1000));
+				localDate1 = s1.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusDays(AFTConstants.PROJECT_FOLLOW_DAYS);
+				diff1 =  (int)ChronoUnit.DAYS.between(localDate,localDate1);
 //                diff2 = (int) ((l2 + AFTConstants.PROJECT_SIGN_LIMIT_MS - now.getTime()) / (24 * 3600 * 1000));
 				if (diff1 < 0)diff1 = 0;
             }
-			if(diff1 ==30)diff1 = 29;
             clo.setSurplusFollowTime(diff1 + "");
             clo.setSurplusSignTime(diff2 + "");
             if (power!=null&&power == 1) {