Просмотр исходного кода

Merge branch 'master' of http://s.dev01.dkiboss.com:9001/iBOSS-2.0-Mini/iboss-server-oauth

liuyao 1 год назад
Родитель
Сommit
cf6061fcba

+ 13 - 1
src/main/java/com/dk/oauth/service/integral/IntegralShareService.java

@@ -30,7 +30,9 @@ import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.List;
 
 @Service
@@ -164,7 +166,17 @@ public class IntegralShareService extends BaseService<IntegralShare> {
 		//分享时间
 		integralShareVO.setShareDate(LocalDateTime.now());
 		//截止时间
-		integralShareVO.setEndDate(LocalDateTime.now().plusDays(integralTacticResponses.get(0).getShareValidTimes()));
+		if(Constant.IntegralType.INTEGRAL_TYPE_INVITE.getName().equals(integralShareVO.getIntegralType())) {
+			integralShareVO.setEndDate(LocalDateTime.now().plusHours(integralTacticResponses.get(0).getShareValidTimes()));
+		}else{
+			// 获取当前日期时间
+			LocalDateTime currentDateTime = LocalDateTime.now();			// 设置时间为23点59分
+			LocalDateTime time2359 = currentDateTime.withHour(23).withMinute(59).withSecond(59);
+			// 格式化时间为指定格式
+			DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+			String formattedDateTime = time2359.format(formatter);
+			integralShareVO.setEndDate(LocalDateTime.parse(formattedDateTime));
+		}
 		//实体转换
 		IntegralShare integralShare = integralShareConvert.convertToPo(integralShareVO);
 		//新建